diff --git a/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php b/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php index 7a4d98f..7fc0312 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php @@ -127,7 +127,12 @@ public function save(array $form, array &$form_state) { watchdog('aggregator', 'Feed %feed added.', array('%feed' => $feed->label()), WATCHDOG_NOTICE, l(t('view'), 'admin/config/services/aggregator')); drupal_set_message(t('The feed %feed has been added.', array('%feed' => $feed->label()))); } - $form_state['redirect'] = 'aggregator/sources/' . $feed->id(); + if (strpos(\Drupal::request()->attributes->get('system_path'), '/admin') === 0) { + $form_state['redirect'] = 'admin/config/services/aggregator'; + } + else { + $form_state['redirect'] = 'aggregator/sources/' . $feed > id(); + } } /** diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDeleteForm.php b/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDeleteForm.php index b0c0f96..a9be7e3 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDeleteForm.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDeleteForm.php @@ -41,7 +41,13 @@ public function submit(array $form, array &$form_state) { $this->entity->delete(); watchdog('aggregator', 'Feed %feed deleted.', array('%feed' => $this->entity->label())); drupal_set_message(t('The feed %feed has been deleted.', array('%feed' => $this->entity->label()))); - $form_state['redirect'] = 'aggregator/sources'; + + if (strpos(\Drupal::request()->attributes->get('system_path'), '/admin') === 0) { + $form_state['redirect'] = 'admin/config/services/aggregator'; + } + else { + $form_state['redirect'] = 'aggregator/sources'; + } } } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php index 4ebcf30..6d27c91 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php @@ -26,6 +26,7 @@ function testAddFeed() { $feed = $this->createFeed(); // Check feed data. + $this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/add/feed', array('absolute' => TRUE)), 'Directed to correct url.'); $this->assertTrue($this->uniqueFeed($feed->label(), $feed->url->value), 'The feed is unique.'); // Check feed source. diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Tests/UpdateFeedTest.php b/core/modules/aggregator/lib/Drupal/aggregator/Tests/UpdateFeedTest.php index fd0b302..8b25bc7 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Tests/UpdateFeedTest.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Tests/UpdateFeedTest.php @@ -37,6 +37,7 @@ function testUpdateFeed() { $this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title'])), format_string('The feed %name has been updated.', array('%name' => $edit['title']))); // Check feed data. + $this->assertEqual($this->getUrl(), url('admin/config/services/aggregator', array('absolute' => TRUE))); $this->assertTrue($this->uniqueFeed($edit['title'], $edit['url']), 'The feed is unique.'); // Check feed source. diff --git a/core/modules/dblog/dblog.module b/core/modules/dblog/dblog.module index 3d35c97..a0a5f87 100644 --- a/core/modules/dblog/dblog.module +++ b/core/modules/dblog/dblog.module @@ -87,7 +87,7 @@ function dblog_menu() { * Implements hook_page_build(). */ function dblog_page_build(&$page) { - if (strpos(Drupal::request()->attributes->get('system_path'), 'admin/reports') === 0) { + if (strpos(Drupal::request()->attributes->get('system_path'), '/admin/reports') === 0) { $page['#attached']['css'][] = drupal_get_path('module', 'dblog') . '/css/dblog.module.css'; } } diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 6fe9c4f..87fdac4 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -100,7 +100,7 @@ function update_help($path, $arg) { */ function update_page_build() { $path = Drupal::request()->attributes->get('system_path'); - if (strpos($path, 'admin') === 0 && user_access('administer site configuration')) { + if (strpos($path, '/admin') === 0 && user_access('administer site configuration')) { switch ($path) { // These pages don't need additional nagging. case 'admin/appearance/update': diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument_default/Raw.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument_default/Raw.php index 9577af2..a49e106 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/argument_default/Raw.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument_default/Raw.php @@ -9,6 +9,8 @@ use Drupal\Component\Annotation\Plugin; use Drupal\Core\Annotation\Translation; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\HttpFoundation\Request; /** * Default argument plugin to use the raw value from the URL. @@ -22,6 +24,41 @@ */ class Raw extends ArgumentDefaultPluginBase { + /** + * The request object. + * + * @var \Symfony\Component\HttpFoundation\Request + */ + protected $request; + + /** + * Constructs a Raw object. + * + * @param array $configuration + * A configuration array containing information about the plugin instance. + * @param string $plugin_id + * The plugin_id for the plugin instance. + * @param array $plugin_definition + * The plugin implementation definition. + * @param \Symfony\Component\HttpFoundation\Request $request + * The request object. + */ + public function __construct(array $configuration, $plugin_id, array $plugin_definition, Request $request) { + parent::__construct($configuration, $plugin_id, $plugin_definition); + + $this->request = $request; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, array $plugin_definition) { + return new static($container, $configuration, $plugin_id, $plugin_definition, + $container->get('request') + ); + } + + protected function defineOptions() { $options = parent::defineOptions(); $options['index'] = array('default' => ''); @@ -55,7 +92,7 @@ public function getArgument() { $path = drupal_get_path_alias(); } if (!$path) { - $path = \Drupal::request()->attributes->get('system_path'); + $path = $this->request->attributes->get('system_path'); } $args = explode('/', $path); if (isset($args[$this->options['index']])) { diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index cfb24aa..7495396 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -2711,7 +2711,7 @@ public function getSpecialBlocks() { */ public function viewExposedFormBlocks() { // avoid interfering with the admin forms. - if (strpos(\Drupal::request()->attributes->get('system_path'), 'admin/structure/views') === 0) { + if (strpos(\Drupal::request()->attributes->get('system_path'), '/admin/structure/views') === 0) { return; } $this->view->initHandlers();