diff --git a/core/modules/config/src/Form/ConfigSync.php b/core/modules/config/src/Form/ConfigSync.php index f73de96..16bceed 100644 --- a/core/modules/config/src/Form/ConfigSync.php +++ b/core/modules/config/src/Form/ConfigSync.php @@ -20,7 +20,6 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Lock\LockBackendInterface; use Drupal\Core\Config\StorageComparer; -use Drupal\Core\Routing\UrlGeneratorInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -72,13 +71,6 @@ class ConfigSync extends FormBase { protected $configManager; /** - * URL generator service. - * - * @var \Drupal\Core\Routing\UrlGeneratorInterface - */ - protected $urlGenerator; - - /** * The typed config manager. * * @var \Drupal\Core\Config\TypedConfigManagerInterface @@ -114,8 +106,6 @@ class ConfigSync extends FormBase { * Event dispatcher. * @param \Drupal\Core\Config\ConfigManagerInterface $config_manager * Configuration manager. - * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator - * The url generator service. * @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config * The typed configuration manager. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler @@ -123,14 +113,13 @@ class ConfigSync extends FormBase { * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler * The theme handler */ - public function __construct(StorageInterface $staging_storage, StorageInterface $active_storage, StorageInterface $snapshot_storage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, UrlGeneratorInterface $url_generator, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler) { + public function __construct(StorageInterface $staging_storage, StorageInterface $active_storage, StorageInterface $snapshot_storage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigManagerInterface $config_manager, TypedConfigManagerInterface $typed_config, ModuleHandlerInterface $module_handler, ThemeHandlerInterface $theme_handler) { $this->stagingStorage = $staging_storage; $this->activeStorage = $active_storage; $this->snapshotStorage = $snapshot_storage; $this->lock = $lock; $this->eventDispatcher = $event_dispatcher; $this->configManager = $config_manager; - $this->urlGenerator = $url_generator; $this->typedConfigManager = $typed_config; $this->moduleHandler = $module_handler; $this->themeHandler = $theme_handler; @@ -147,7 +136,6 @@ public static function create(ContainerInterface $container) { $container->get('lock'), $container->get('event_dispatcher'), $container->get('config.manager'), - $container->get('url_generator'), $container->get('config.typed'), $container->get('module_handler'), $container->get('theme_handler') @@ -268,15 +256,16 @@ public function buildForm(array $form, FormStateInterface $form_state) { $route_options = array('source_name' => $config_name); } if ($collection != StorageInterface::DEFAULT_COLLECTION) { + $route_name = 'config.diff_collection'; $route_options['collection'] = $collection; - $href = $this->urlGenerator->getPathFromRoute('config.diff_collection', $route_options); } else { - $href = $this->urlGenerator->getPathFromRoute('config.diff', $route_options); + $route_name = 'config.diff'; } $links['view_diff'] = array( 'title' => $this->t('View differences'), - 'href' => $href, + 'route_name' => $route_name, + 'route_parameters' => $route_options, 'attributes' => array( 'class' => array('use-ajax'), 'data-accepts' => 'application/vnd.drupal-modal', diff --git a/core/modules/language/src/Form/NegotiationConfigureForm.php b/core/modules/language/src/Form/NegotiationConfigureForm.php index 83eb567..5b2b471 100644 --- a/core/modules/language/src/Form/NegotiationConfigureForm.php +++ b/core/modules/language/src/Form/NegotiationConfigureForm.php @@ -295,10 +295,10 @@ protected function configureFormTable(array &$form, $type) { $table_form['description'][$method_id] = array('#markup' => Xss::filterAdmin($method['description'])); $config_op = array(); - if (isset($method['config_path'])) { + if (isset($method['config_route_name'])) { $config_op['configure'] = array( 'title' => $this->t('Configure'), - 'href' => $method['config_path'], + 'route_name' => $method['config_route_name'], ); // If there is at least one operation enabled show the operation // column. diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php index 0ce2c86..e9fc38e 100644 --- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php +++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php @@ -20,7 +20,7 @@ * cache = 0, * name = @Translation("Browser"), * description = @Translation("Language from the browser's language settings."), - * config_path = "admin/config/regional/language/detection/browser" + * config_route_name = "language.negotiation_browser" * ) */ class LanguageNegotiationBrowser extends LanguageNegotiationMethodBase { diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php index 4819abf..c4cd150 100644 --- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php +++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php @@ -18,7 +18,7 @@ * weight = 12, * name = @Translation("Selected language"), * description = @Translation("Language based on a selected language."), - * config_path = "admin/config/regional/language/detection/selected" + * config_route_name = "language.negotiation_selected" * ) */ class LanguageNegotiationSelected extends LanguageNegotiationMethodBase { diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php index 293ac62..7f0085d 100644 --- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php +++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php @@ -22,7 +22,7 @@ * weight = -6, * name = @Translation("Session"), * description = @Translation("Language from a request/session parameter."), - * config_path = "admin/config/regional/language/detection/session" + * config_route_name = "language.negotiation_session" * ) */ class LanguageNegotiationSession extends LanguageNegotiationMethodBase implements OutboundPathProcessorInterface, LanguageSwitcherInterface { diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php index e54a9c1..0b46727 100644 --- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php +++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php @@ -26,7 +26,7 @@ * weight = -8, * name = @Translation("URL"), * description = @Translation("Language from the URL (Path prefix or domain)."), - * config_path = "admin/config/regional/language/detection/url" + * config_route_name = "language.negotiation_url" * ) */ class LanguageNegotiationUrl extends LanguageNegotiationMethodBase implements InboundPathProcessorInterface, OutboundPathProcessorInterface, LanguageSwitcherInterface { diff --git a/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/LinkFormatter.php b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/LinkFormatter.php index 4f57b2e..00b2e8f 100644 --- a/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/LinkFormatter.php +++ b/core/modules/taxonomy/src/Plugin/Field/FieldFormatter/LinkFormatter.php @@ -46,8 +46,10 @@ public function viewElements(FieldItemListInterface $items) { ); if (!empty($item->_attributes)) { - $elements[$delta]['#options'] += array('attributes' => array()); - $elements[$delta]['#options']['attributes'] += $item->_attributes; + $options = $elements[$delta]['#url']->getOptions(); + $options += array('attributes' => array()); + $options['attributes'] += $item->_attributes; + $elements[$delta]['#url']->setOptions($options); // Unset field item attributes since they have been included in the // formatter output and should not be rendered in the field template. unset($item->_attributes); diff --git a/core/modules/toolbar/src/Element/ToolbarItem.php b/core/modules/toolbar/src/Element/ToolbarItem.php index 4c2324a..e1249b9 100644 --- a/core/modules/toolbar/src/Element/ToolbarItem.php +++ b/core/modules/toolbar/src/Element/ToolbarItem.php @@ -33,6 +33,7 @@ public function getInfo() { 'tab' => array( '#type' => 'link', '#title' => NULL, + '#route_name' => '', ), ); } diff --git a/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module b/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module index d0d96b0..deda1d1 100644 --- a/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module +++ b/core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module @@ -17,6 +17,7 @@ function toolbar_test_toolbar() { 'tab' => array( '#type' => 'link', '#title' => t('Test tab'), + '#route_name' => '', '#options' => array( 'html' => FALSE, 'attributes' => array( diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index d411e98..f370bea 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -1042,7 +1042,7 @@ public function optionLink($text, $section, $class = '', $title = '') { $title = $text; } - return \Drupal::l($text, new Url('views_ui.form_display', ['view' => $this->view->storage->id(), 'display_id' => $this->display['id'], 'type' => $section], array('attributes' => array('class' => array('views-ajax-link', $class), 'title' => $title, 'id' => drupal_html_id('views-' . $this->display['id'] . '-' . $section)), 'html' => TRUE))); + return \Drupal::l($text, new Url('views_ui.form_display', ['js' => 'nojs', 'view' => $this->view->storage->id(), 'display_id' => $this->display['id'], 'type' => $section], array('attributes' => array('class' => array('views-ajax-link', $class), 'title' => $title, 'id' => drupal_html_id('views-' . $this->display['id'] . '-' . $section)), 'html' => TRUE))); } /** diff --git a/core/modules/views_ui/src/ViewEditForm.php b/core/modules/views_ui/src/ViewEditForm.php index 0e84df1..2ca0dca 100644 --- a/core/modules/views_ui/src/ViewEditForm.php +++ b/core/modules/views_ui/src/ViewEditForm.php @@ -695,12 +695,12 @@ public function renderDisplayTop(ViewUI $view) { '#links' => array( 'edit-details' => array( 'title' => $this->t('Edit view name/description'), - 'url' => Url::fromRoute('views_ui.form_edit_details', ['view' => $view->id(), 'display_id' => $display_id]), + 'url' => Url::fromRoute('views_ui.form_edit_details', ['js' => 'nojs', 'view' => $view->id(), 'display_id' => $display_id]), 'attributes' => array('class' => array('views-ajax-link')), ), 'analyze' => array( 'title' => $this->t('Analyze view'), - 'url' => Url::fromRoute('views_ui.form_analyze', ['view' => $view->id(), 'display_id' => $display_id]), + 'url' => Url::fromRoute('views_ui.form_analyze', ['js' => 'nojs', 'view' => $view->id(), 'display_id' => $display_id]), 'attributes' => array('class' => array('views-ajax-link')), ), 'duplicate' => array( @@ -708,7 +708,7 @@ public function renderDisplayTop(ViewUI $view) { ) + $view->urlInfo('duplicate-form')->toArray(), 'reorder' => array( 'title' => $this->t('Reorder displays'), - 'url' => Url::fromRoute('views_ui.form_reorder_displays', ['view' => $view->id(), 'display_id' => $display_id]), + 'url' => Url::fromRoute('views_ui.form_reorder_displays', ['js' => 'nojs', 'view' => $view->id(), 'display_id' => $display_id]), 'attributes' => array('class' => array('views-ajax-link')), ), ), @@ -944,7 +944,7 @@ public function getFormBucket(ViewUI $view, $type, $display) { $build['#name'] = $build['#title'] = $types[$type]['title']; - $rearrange_url = Url::fromRoute('views_ui.form_rearrange', ['view' => $view->id(), 'display_id' => $display['id'], 'type' => $type]); + $rearrange_url = Url::fromRoute('views_ui.form_rearrange', ['js' => 'nojs', 'view' => $view->id(), 'display_id' => $display['id'], 'type' => $type]); $class = 'icon compact rearrange'; // Different types now have different rearrange forms, so we use this switch @@ -953,7 +953,7 @@ public function getFormBucket(ViewUI $view, $type, $display) { case 'filter': // The rearrange form for filters contains the and/or UI, so override // the used path. - $rearrange_url = Url::fromRoute('views_ui.form_rearrange_filter', ['view' => $view->id(), 'display_id' => $display['id']]); + $rearrange_url = Url::fromRoute('views_ui.form_rearrange_filter', ['js' => 'nojs', 'view' => $view->id(), 'display_id' => $display['id']]); // TODO: Add another class to have another symbol for filter rearrange. $class = 'icon compact rearrange'; break; @@ -993,7 +993,7 @@ public function getFormBucket(ViewUI $view, $type, $display) { $actions['add'] = array( 'title' => $add_text, - 'url' => Url::fromRoute('views_ui.form_add_handler', ['view' => $view->id(), 'display_id' => $display['id'], 'type' => $type]), + 'url' => Url::fromRoute('views_ui.form_add_handler', ['js' => 'nojs', 'view' => $view->id(), 'display_id' => $display['id'], 'type' => $type]), 'attributes' => array('class' => array('icon compact add', 'views-ajax-link'), 'id' => 'views-add-' . $type), 'html' => TRUE, ); @@ -1062,6 +1062,7 @@ public function getFormBucket(ViewUI $view, $type, $display) { $build['fields'][$id]['#class'][] = 'broken'; $field_name = $handler->adminLabel(); $build['fields'][$id]['#link'] = $this->l($field_name, new Url('views_ui.form_handler', array( + 'js' => 'nojs', 'view' => $view->id(), 'display_id' => $display['id'], 'type' => $type, @@ -1084,6 +1085,7 @@ public function getFormBucket(ViewUI $view, $type, $display) { $link_text .= ' [' . $this->t('hidden') . ']'; } $build['fields'][$id]['#link'] = $this->l($link_text, new Url('views_ui.form_handler', array( + 'js' => 'nojs', 'view' => $view->id(), 'display_id' => $display['id'], 'type' => $type, @@ -1093,6 +1095,7 @@ public function getFormBucket(ViewUI $view, $type, $display) { if ($executable->display_handler->useGroupBy() && $handler->usesGroupBy()) { $build['fields'][$id]['#settings_links'][] = $this->l('' . $this->t('Aggregation settings') . '', new Url('views_ui.form_handler_group', array( + 'js' => 'nojs', 'view' => $view->id(), 'display_id' => $display['id'], 'type' => $type, @@ -1102,6 +1105,7 @@ public function getFormBucket(ViewUI $view, $type, $display) { if ($handler->hasExtraOptions()) { $build['fields'][$id]['#settings_links'][] = $this->l('' . $this->t('Settings') . '', new Url('views_ui.form_handler_extra', array( + 'js' => 'nojs', 'view' => $view->id(), 'display_id' => $display['id'], 'type' => $type, diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module index 073332e..ca61352 100644 --- a/core/modules/views_ui/views_ui.module +++ b/core/modules/views_ui/views_ui.module @@ -181,13 +181,13 @@ function views_ui_view_preview_section_handler_links(ViewExecutable $view, $type $field_name = $handler->adminLabel(TRUE); $links[$type . '-edit-' . $id] = array( 'title' => t('Edit @section', array('@section' => $field_name)), - 'url' => Url::fromRoute('views_ui.form_handler', ['view' => $view->storage->id(), 'display_id' => $display['id'], 'type' => $type, 'id' => $id]), + 'url' => Url::fromRoute('views_ui.form_handler', ['js' => 'nojs', 'view' => $view->storage->id(), 'display_id' => $display['id'], 'type' => $type, 'id' => $id]), 'attributes' => array('class' => array('views-ajax-link')), ); } $links[$type . '-add'] = array( 'title' => t('Add new'), - 'url' => Url::fromRoute('views_ui.form_add_handler', ['view' => $view->storage->id(), 'display_id' => $display['id'], 'type' => $type]), + 'url' => Url::fromRoute('views_ui.form_add_handler', ['js' => 'nojs', 'view' => $view->storage->id(), 'display_id' => $display['id'], 'type' => $type]), 'attributes' => array('class' => array('views-ajax-link')), ); @@ -202,7 +202,7 @@ function views_ui_view_preview_section_display_category_links(ViewExecutable $vi $links = array( $type . '-edit' => array( 'title' => t('Edit @section', array('@section' => $title)), - 'url' => Url::fromRoute('views_ui.form_display', ['view' => $view->storage->id(), 'display_id' => $display['id'], 'type' => $type]), + 'url' => Url::fromRoute('views_ui.form_display', ['js' => 'nojs', 'view' => $view->storage->id(), 'display_id' => $display['id'], 'type' => $type]), 'attributes' => array('class' => array('views-ajax-link')), ), ); diff --git a/core/modules/views_ui/views_ui.routing.yml b/core/modules/views_ui/views_ui.routing.yml index c81ada4..9a36472 100644 --- a/core/modules/views_ui/views_ui.routing.yml +++ b/core/modules/views_ui/views_ui.routing.yml @@ -142,7 +142,6 @@ views_ui.form_add_handler: type: entity:view defaults: _content: '\Drupal\views_ui\Form\Ajax\AddHandler::getForm' - js: 'nojs' requirements: _entity_access: view.update js: 'nojs|ajax' @@ -156,7 +155,6 @@ views_ui.form_edit_details: type: entity:view defaults: _content: '\Drupal\views_ui\Form\Ajax\EditDetails::getForm' - js: 'nojs' requirements: _entity_access: view.update js: 'nojs|ajax' @@ -170,7 +168,6 @@ views_ui.form_reorder_displays: type: entity:view defaults: _content: '\Drupal\views_ui\Form\Ajax\ReorderDisplays::getForm' - js: 'nojs' requirements: _entity_access: view.update js: 'nojs|ajax' @@ -184,7 +181,6 @@ views_ui.form_analyze: type: entity:view defaults: _content: '\Drupal\views_ui\Form\Ajax\Analyze::getForm' - js: 'nojs' requirements: _entity_access: view.update js: 'nojs|ajax' @@ -198,7 +194,6 @@ views_ui.form_rearrange: type: entity:view defaults: _content: '\Drupal\views_ui\Form\Ajax\Rearrange::getForm' - js: 'nojs' requirements: _entity_access: view.update js: 'nojs|ajax' @@ -212,7 +207,6 @@ views_ui.form_rearrange_filter: type: entity:view defaults: _content: '\Drupal\views_ui\Form\Ajax\RearrangeFilter::getForm' - js: 'nojs' requirements: _entity_access: view.update js: 'nojs|ajax' @@ -226,7 +220,6 @@ views_ui.form_display: type: entity:view defaults: _content: '\Drupal\views_ui\Form\Ajax\Display::getForm' - js: 'nojs' requirements: _entity_access: view.update js: 'nojs|ajax' @@ -240,7 +233,6 @@ views_ui.form_handler: type: entity:view defaults: _content: '\Drupal\views_ui\Form\Ajax\ConfigHandler::getForm' - js: 'nojs' requirements: _entity_access: view.update js: 'nojs|ajax' @@ -254,7 +246,6 @@ views_ui.form_handler_extra: type: entity:view defaults: _content: '\Drupal\views_ui\Form\Ajax\ConfigHandlerExtra::getForm' - js: 'nojs' requirements: _entity_access: view.update js: 'nojs|ajax' @@ -268,7 +259,6 @@ views_ui.form_handler_group: type: entity:view defaults: _content: '\Drupal\views_ui\Form\Ajax\ConfigHandlerGroup::getForm' - js: 'nojs' form_state: NULL requirements: _entity_access: view.update