diff --git a/core/modules/path/lib/Drupal/path/Controller/PathController.php b/core/modules/path/lib/Drupal/path/Controller/PathController.php index fca2d8a..0d932c9 100644 --- a/core/modules/path/lib/Drupal/path/Controller/PathController.php +++ b/core/modules/path/lib/Drupal/path/Controller/PathController.php @@ -7,13 +7,13 @@ namespace Drupal\path\Controller; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Database\Connection; +use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Language\Language; use Drupal\Core\Path\AliasManagerInterface; -use Drupal\Component\Utility\Unicode; use Drupal\path\Form\PathAdminFilterForm; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -22,11 +22,11 @@ class PathController extends ControllerBase implements ContainerInjectionInterface { /** - * The connection service. + * The database connection service. * * @var \Drupal\Core\Database\Connection */ - protected $databaseConnection; + protected $database; /** * The alias service. @@ -38,13 +38,13 @@ class PathController extends ControllerBase implements ContainerInjectionInterfa /** * Constructs a PathController object. * - * @param \Drupal\Core\Database\Connection $database_connection + * @param \Drupal\Core\Database\Connection $database * The database connection service. * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager * The path alias manager service. */ - public function __construct(Connection $database_connection, AliasManagerInterface $alias_manager ) { - $this->databaseConnection = $database_connection; + public function __construct(Connection $database, AliasManagerInterface $alias_manager) { + $this->database = $database; $this->aliasManager = $alias_manager; } @@ -59,10 +59,10 @@ public static function create(ContainerInterface $container) { } /** - * The admin overview. + * Returns a listing of all defined URL aliases. * - * When filter key passed, perform a standard search on the given key, - * and return the list of matching URL aliases. + * When filter key passed, perform a standard search on the given key and + * return the list of matching URL aliases. * * @param string $alias * Filter key. @@ -71,7 +71,8 @@ public static function create(ContainerInterface $container) { * Returns a listing of all defined URL aliases. */ public function adminOverview($alias = NULL) { - // @todo Implement the session service: http://drupal.org/node/1858196 + // @todo Implement the session service. + // @see http://drupal.org/node/1858196 if (!empty($_SESSION['path_admin_filter_form'])) { $alias = $_SESSION['path_admin_filter_form']; } @@ -80,12 +81,12 @@ public function adminOverview($alias = NULL) { // Enable language column if language.module is enabled or if we have any // alias with a language. - $query = $this->databaseConnection->select('url_alias', 'u') + $query = $this->database->select('url_alias', 'u') ->fields('u', array('pid')) ->condition('langcode', Language::LANGCODE_NOT_SPECIFIED, '<>') ->range(0,1); $alias_exists = (bool) $query->execute()->fetchField(); - $multilanguage = ($this->moduleHandler()->moduleExists('language') || $alias_exists); + $multilanguage = $this->moduleHandler()->moduleExists('language') || $alias_exists; $header = array(); $header[] = array('data' => $this->t('Alias'), 'field' => 'alias', 'sort' => 'asc'); @@ -95,7 +96,7 @@ public function adminOverview($alias = NULL) { } $header[] = $this->t('Operations'); - $query = $this->databaseConnection->select('url_alias') + $query = $this->database->select('url_alias') ->extend('\Drupal\Core\Database\Query\PagerSelectExtender') ->extend('\Drupal\Core\Database\Query\TableSortExtender'); if ($alias) { diff --git a/core/modules/path/lib/Drupal/path/Form/EditForm.php b/core/modules/path/lib/Drupal/path/Form/EditForm.php index ef43907..e1bf3f6 100644 --- a/core/modules/path/lib/Drupal/path/Form/EditForm.php +++ b/core/modules/path/lib/Drupal/path/Form/EditForm.php @@ -7,11 +7,11 @@ namespace Drupal\path\Form; -use Drupal\Core\Form\FormBase; -use Drupal\Core\Path\Path; use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\Core\Form\FormBase; use Drupal\Core\Language\Language; +use Drupal\Core\Path\AliasManagerInterface; +use Drupal\Core\Path\Path; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -114,7 +114,8 @@ public function buildForm(array $form, array &$form_state, $pid = NULL) { // A hidden value unless language.module is enabled. if ($this->moduleHandler->moduleExists('language')) { - // @todo add DI for language_list https://drupal.org/node/1862202 + // @todo Add DI for language_list. + // @see https://drupal.org/node/1862202 $languages = language_list(); $language_options = array(); foreach ($languages as $langcode => $language) { @@ -173,7 +174,6 @@ public function validateForm(array &$form, array &$form_state) { $alias_exists = $this->aliasManager->checkAliasExists($pid, $alias, $langcode); if ($alias_exists) { - $this->setFormError('alias', $form_state, $this->t('The alias %alias is already in use in this language.', array('%alias' => $alias))); } if (!drupal_valid_path($source)) { diff --git a/core/modules/path/lib/Drupal/path/Form/PathAdminFilterForm.php b/core/modules/path/lib/Drupal/path/Form/PathAdminFilterForm.php index 793cf93..944e504 100644 --- a/core/modules/path/lib/Drupal/path/Form/PathAdminFilterForm.php +++ b/core/modules/path/lib/Drupal/path/Form/PathAdminFilterForm.php @@ -79,7 +79,7 @@ public function validateFilter(array &$form, array &$form_state) { } /** - * Filters form submission handler. + * Form submission handler for the 'filter' action. * * @param array $form * An associative array containing the structure of the form. @@ -91,7 +91,7 @@ public function submitFilter(array &$form, array &$form_state) { } /** - * Resets form submission handler. + * Form submission handler for the 'reset' action. * * @param array $form * An associative array containing the structure of the form. diff --git a/core/modules/path/path.local_tasks.yml b/core/modules/path/path.local_tasks.yml index 15e1990..bfe0489 100644 --- a/core/modules/path/path.local_tasks.yml +++ b/core/modules/path/path.local_tasks.yml @@ -1,9 +1,9 @@ path.admin_overview_tab: route_name: path.admin_overview title: 'URL aliases' - tab_root_id: path.admin_overview_tab + base_route: path.admin_overview_tab path.admin_add_tab: route_name: path.admin_add title: 'Add alias' - tab_root_id: path.admin_overview_tab + base_route: path.admin_overview_tab