diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php index 9bd0d93..1171a86 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php @@ -25,24 +25,7 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException as DependencyInjectionRuntimeException; /** - * @defgroup views_display_plugins Views display plugins - * @{ - * Plugins to handle the overall display of views. - * - * Display plugins are responsible for controlling where a view is rendered; - * that is, how it is exposed to other parts of Drupal. 'Page' and 'block' are - * the most commonly used display plugins. Each view also has a 'master' (or - * 'default') display that includes information shared between all its - * displays (see \Drupal\views\Plugin\views\display\DefaultDisplay). - * - * Display plugins extend \Drupal\views\Plugin\views\display\DisplayPluginBase. - * They must be annotated with \Drupal\views\Annotation\ViewsDisplay - * annotation, and they must be in namespace directory Plugin\views\display. - * - * @ingroup views_plugins - * - * @see plugin_api - * @see views_display_extender_plugins + * Base class for views display plugins. */ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInterface { @@ -2039,7 +2022,7 @@ public function renderMoreLink() { if ($this->getOption('link_display') == 'custom_url' && $override_path = $this->getOption('link_url')) { $tokens = $this->getArgumentsTokens(); $path = $this->viewsTokenReplace($override_path, $tokens); - $url = Url::fromUri('user-input:' . $path); + $url = Url::fromUri('user-path:' . $path); } else { $url = $this->view->getUrl(NULL, $this->display['id']); diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php b/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php index eab59d4..e84348c 100644 --- a/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php +++ b/core/modules/views/src/Plugin/views/display/DisplayPluginInterface.php @@ -1,18 +1,35 @@ title = $this->getField($row_index, $this->options['title_field']); - $item->link = Url::fromUri('user-input:' . $this->getField($row_index, $this->options['link_field']))->setAbsolute()->toString(); + $item->link = Url::fromUri('user-path:' . $this->getField($row_index, $this->options['link_field']))->setAbsolute()->toString(); $item->description = $this->getField($row_index, $this->options['description_field']); $item->elements = array( array('key' => 'pubDate', 'value' => $this->getField($row_index, $this->options['date_field'])), @@ -158,7 +158,7 @@ public function render($row) { $item_guid = $this->getField($row_index, $this->options['guid_field_options']['guid_field']); if ($this->options['guid_field_options']['guid_field_is_permalink']) { $guid_is_permalink_string = 'true'; - $item_guid = Url::fromUri('user-input:' . $item_guid)->setAbsolute()->toString(); + $item_guid = Url::fromUri('user-path:' . $item_guid)->setAbsolute()->toString(); } $item->elements[] = array( 'key' => 'guid', diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php index 5b7a145..c6248ec 100644 --- a/core/modules/views/src/ViewExecutable.php +++ b/core/modules/views/src/ViewExecutable.php @@ -1723,7 +1723,7 @@ public function getUrl($args = NULL, $display_id = NULL) { $display_handler = $this->displayHandlers->get($display_id ?: $this->current_display); if (!$display_handler instanceof DisplayRouterInterface) { - throw new \InvalidArgumentException('You cannot create a URl to a display without routes.'); + throw new \InvalidArgumentException('You cannot create a URL to a display without routes.'); } if (!isset($path)) { @@ -1766,6 +1766,7 @@ public function getUrl($args = NULL, $display_id = NULL) { $parameters[$variable_name] = $this->argument[$id]->options['exception']['value']; } else { + // Gotta put something if there just isn't one. $parameters[$variable_name] = '*'; } } diff --git a/core/modules/views/src/ViewExecutableFactory.php b/core/modules/views/src/ViewExecutableFactory.php index 520e060..0975a48 100644 --- a/core/modules/views/src/ViewExecutableFactory.php +++ b/core/modules/views/src/ViewExecutableFactory.php @@ -54,6 +54,8 @@ class ViewExecutableFactory { * The request stack. * @param \Drupal\views\ViewsData $views_data * The views data. + * @param \Drupal\Core\Routing\RouteProviderInterface $route_provider + * The route provider. */ public function __construct(AccountInterface $user, RequestStack $request_stack, ViewsData $views_data, RouteProviderInterface $route_provider) { $this->user = $user; diff --git a/core/modules/views/tests/src/Unit/ViewExecuableTest.php b/core/modules/views/tests/src/Unit/ViewExecutableTest.php similarity index 85% rename from core/modules/views/tests/src/Unit/ViewExecuableTest.php rename to core/modules/views/tests/src/Unit/ViewExecutableTest.php index 2356446..52070a3 100644 --- a/core/modules/views/tests/src/Unit/ViewExecuableTest.php +++ b/core/modules/views/tests/src/Unit/ViewExecutableTest.php @@ -2,7 +2,7 @@ /** * @file - * Contains Drupal\Tests\views\Unit\ViewExecuableTest. + * Contains Drupal\Tests\views\Unit\ViewExecutableTest. */ namespace Drupal\Tests\views\Unit; @@ -16,40 +16,53 @@ * @coversDefaultClass \Drupal\views\ViewExecutable * @group views */ -class ViewExecuableTest extends UnitTestCase { +class ViewExecutableTest extends UnitTestCase { /** + * The tested view executable. + * * @var \Drupal\views\ViewExecutable */ protected $executable; /** - * @var + * The mocked view entity. + * + * @var \Drupal\views\ViewEntityInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $view; /** - * @var + * The mocked user. + * + * @var \Drupal\Core\Session\AccountInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $user; /** - * @var + * The mocked views data. + * + * @var \Drupal\views\ViewsData|\PHPUnit_Framework_MockObject_MockObject */ protected $viewsData; /** - * @var \Drupal\views\Plugin\views\display\DisplayPluginBase|\PHPUnit_Framework_MockObject_MockObject + * The mocked display handler. + * + * @var \Drupal\views\Plugin\views\display\DisplayPluginInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $displayHandler; /** - * The route provider. + * The mocked route provider. * * @var \Drupal\Core\Routing\RouteProviderInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $routeProvider; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); @@ -58,7 +71,7 @@ protected function setUp() { $this->viewsData = $this->getMockBuilder('Drupal\views\ViewsData') ->disableOriginalConstructor() ->getMock(); - $this->displayHandler = $this->getMockBuilder('Drupal\views\Plugin\views\display\PathPluginBase') + $this->displayHandler = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayRouterInterface') ->disableOriginalConstructor() ->getMock(); $this->routeProvider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface'); @@ -92,9 +105,7 @@ public function testGetUrlWithPathNoPlaceholders() { * @expectedException \InvalidArgumentException */ public function testGetUrlWithoutRouterDisplay() { - $this->displayHandler = $this->getMockBuilder('Drupal\views\Plugin\views\display\DisplayPluginBase') - ->disableOriginalConstructor() - ->getMock(); + $this->displayHandler = $this->getMock('Drupal\views\Plugin\views\display\DisplayPluginInterface'); $this->executable->display_handler = $this->displayHandler; $this->executable->getUrl(); diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index 7960fc3..dc317e2 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -336,7 +336,7 @@ function template_preprocess_views_view_summary(&$variables) { $base_path = $argument->options['summary_options']['base_path']; $tokens = $this->getArgumentsTokens(); $base_path = $this->viewsTokenReplace($base_path, $tokens); - $url = Url::fromUri('user-input:' . $base_path); + $url = Url::fromUri('user-path:' . $base_path); } else { $url = $view->getUrl($args)->setOptions($url_options); @@ -405,7 +405,7 @@ function template_preprocess_views_view_summary_unformatted(&$variables) { $base_path = $argument->options['summary_options']['base_path']; $tokens = $this->getArgumentsTokens(); $base_path = $this->viewsTokenReplace($base_path, $tokens); - $url = Url::fromUri('user-input:' . $base_path); + $url = Url::fromUri('user-path:' . $base_path); } else { $url = $view->getUrl($args)->setOptions($url_options); @@ -915,7 +915,7 @@ function template_preprocess_views_view_rss(&$variables) { // Compare the link to the default home page; if it's the default home page, // just use $base_url. $url_string = $url->setOptions($url_options)->toString(); - if ($url_string === Url::fromUri('user-input:' . $config->get('page.front'))) { + if ($url_string === Url::fromUri('user-path:' . $config->get('page.front'))) { $url_string = Url::fromRoute('')->setAbsolute()->toString(); }