Update to Drupal 8.0.0-rc3. For more information, see https://www.drupal.org/node/2608078

This commit is contained in:
Pantheon Automation 2015-11-04 11:11:27 -08:00 committed by Greg Anderson
parent 6419a031d7
commit 4afb23bbd3
762 changed files with 20080 additions and 6368 deletions

View file

@ -43,6 +43,9 @@ views.display.page:
context:
type: string
label: 'Context'
expanded:
type: boolean
label: 'Expanded'
tab_options:
type: mapping
label: 'Tab options'

View file

@ -30,6 +30,10 @@ views.sort.standard:
# Schema for the views sort expose.
views.sort_expose.*:
type: views_sort_expose
label: 'Fallback sort expose settings'
views.sort_expose.boolean:
type: views_sort_expose
label: 'Boolean sort expose settings'

View file

@ -34,7 +34,7 @@ class HighlightCommand implements CommandInterface {
}
/**
* Implements \Drupal\Core\Ajax\CommandInterface::render().
* {@inheritdoc}
*/
public function render() {
return array(

View file

@ -34,7 +34,7 @@ class ReplaceTitleCommand implements CommandInterface {
}
/**
* Implements \Drupal\Core\Ajax\CommandInterface::render().
* {@inheritdoc}
*/
public function render() {
return array(

View file

@ -34,7 +34,7 @@ class ScrollTopCommand implements CommandInterface {
}
/**
* Implements \Drupal\Core\Ajax\CommandInterface::render().
* {@inheritdoc}
*/
public function render() {
return array(

View file

@ -35,7 +35,7 @@ class ShowButtonsCommand implements CommandInterface {
}
/**
* Implements \Drupal\Core\Ajax\CommandInterface::render().
* {@inheritdoc}
*/
public function render() {
return array(

View file

@ -17,7 +17,7 @@ use Drupal\Core\Ajax\CommandInterface;
class TriggerPreviewCommand implements CommandInterface {
/**
* Implements \Drupal\Core\Ajax\CommandInterface::render().
* {@inheritdoc}
*/
public function render() {
return array(

View file

@ -60,7 +60,7 @@ class DisplayPluginCollection extends DefaultLazyPluginCollection {
}
/**
* Overrides \Drupal\Component\Plugin\LazyPluginCollection::clear().
* {@inheritdoc}
*/
public function clear() {
foreach (array_filter($this->pluginInstances) as $display) {
@ -102,7 +102,7 @@ class DisplayPluginCollection extends DefaultLazyPluginCollection {
}
/**
* Overrides \Drupal\Component\Plugin\LazyPluginCollection::remove().
* {@inheritdoc}
*/
public function remove($instance_id) {
$this->get($instance_id)->remove();

View file

@ -37,7 +37,7 @@ abstract class RendererBase implements CacheableDependencyInterface {
/**
* The type of the entity being rendered.
*
* @var string
* @var \Drupal\Core\Entity\EntityTypeInterface
*/
protected $entityType;

View file

@ -27,21 +27,18 @@ class TranslationLanguageRenderer extends EntityTranslationRendererBase {
* {@inheritdoc}
*/
public function query(QueryPluginBase $query, $relationship = NULL) {
// There is no point in getting the language, in case the site is not
// multilingual.
if (!$this->languageManager->isMultilingual()) {
// In order to render in the translation language of the entity, we need
// to add the language code of the entity to the query. Skip if the site
// is not multilingual or the entity is not translatable.
if (!$this->languageManager->isMultilingual() || !$this->entityType->hasKey('langcode')) {
return;
}
// If the data table is defined, we use the translation language as render
// language, otherwise we fall back to the default entity language, which is
// stored in the revision table for revisionable entity types.
$langcode_key = $this->entityType->getKey('langcode');
foreach (array('data_table', 'revision_table', 'base_table') as $key) {
if ($table = $this->entityType->get($key)) {
$table_alias = $query->ensureTable($table, $relationship);
$this->langcodeAlias = $query->addField($table_alias, $langcode_key);
break;
}
$storage = \Drupal::entityManager()->getStorage($this->entityType->id());
if ($table = $storage->getTableMapping()->getFieldTableName($langcode_key)) {
$table_alias = $query->ensureTable($table, $relationship);
$this->langcodeAlias = $query->addField($table_alias, $langcode_key);
}
}

View file

@ -152,13 +152,17 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac
}
}
$data[$base_table]['operations'] = array(
'field' => array(
'title' => $this->t('Operations links'),
'help' => $this->t('Provides links to perform entity operations.'),
'id' => 'entity_operations',
),
);
// Entity types must implement a list_builder in order to use Views'
// entity operations field.
if ($this->entityType->hasListBuilderClass()) {
$data[$base_table]['operations'] = array(
'field' => array(
'title' => $this->t('Operations links'),
'help' => $this->t('Provides links to perform entity operations.'),
'id' => 'entity_operations',
),
);
}
// Setup relations to the revisions/property data.
if ($data_table) {

View file

@ -127,6 +127,14 @@ class ViewsMenuLink extends MenuLinkBase implements ContainerFactoryPluginInterf
return $this->loadView()->display_handler->getOption('menu')['description'];
}
/**
* {@inheritdoc}
*/
public function isExpanded() {
return (bool) $this->loadView()->display_handler->getOption('menu')['expanded'];
}
/**
* {@inheritdoc}
*/

View file

@ -382,7 +382,10 @@ abstract class PluginBase extends ComponentPluginBase implements ContainerFactor
assert('preg_match(\'/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/\', $key) === 1', 'Tokens need to be valid Twig variables.');
$token_array = array($key => $token_array);
}
$twig_tokens[$top] = $token_array;
if (!isset($twig_tokens[$top])) {
$twig_tokens[$top] = [];
}
$twig_tokens[$top] += $token_array;
}
}

View file

@ -67,7 +67,7 @@ class Entity extends TokenizeAreaPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\area\AreaPluginBase::init().
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);

View file

@ -128,7 +128,7 @@ class Date extends Formula implements ContainerFactoryPluginInterface {
}
/**
* Overrides \Drupal\views\Plugin\views\argument\Formula::getFormula().
* {@inheritdoc}
*/
public function getFormula() {
$this->formula = $this->getDateFormat($this->argFormat);

View file

@ -27,7 +27,7 @@ class Formula extends ArgumentPluginBase {
var $formula = NULL;
/**
* Overrides Drupal\views\Plugin\views\argument\ArgumentPluginBase::init().
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);

View file

@ -30,7 +30,7 @@ use Drupal\views\ManyToOneHelper;
class ManyToOne extends ArgumentPluginBase {
/**
* Overrides \Drupal\views\Plugin\views\argument\ArgumentPluginBase::init().
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);

View file

@ -25,7 +25,7 @@ use Drupal\views\ManyToOneHelper;
class StringArgument extends ArgumentPluginBase {
/**
* Overrides \Drupal\views\Plugin\views\argument\ArgumentPluginBase::init().
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);

View file

@ -23,6 +23,9 @@ use Drupal\Core\Form\FormStateInterface;
*/
class Fixed extends ArgumentDefaultPluginBase implements CacheableDependencyInterface {
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
$options['argument'] = array('default' => '');
@ -30,6 +33,9 @@ class Fixed extends ArgumentDefaultPluginBase implements CacheableDependencyInte
return $options;
}
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['argument'] = array(
@ -40,7 +46,7 @@ class Fixed extends ArgumentDefaultPluginBase implements CacheableDependencyInte
}
/**
* Return the default argument.
* {@inheritdoc}
*/
public function getArgument() {
return $this->options['argument'];

View file

@ -74,6 +74,9 @@ class Raw extends ArgumentDefaultPluginBase implements CacheableDependencyInterf
);
}
/**
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
$options['index'] = array('default' => '');
@ -82,6 +85,9 @@ class Raw extends ArgumentDefaultPluginBase implements CacheableDependencyInterf
return $options;
}
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['index'] = array(
@ -102,6 +108,9 @@ class Raw extends ArgumentDefaultPluginBase implements CacheableDependencyInterf
);
}
/**
* {@inheritdoc}
*/
public function getArgument() {
$path = trim($this->currentPath->getPath($this->view->getRequest()), '/');
if ($this->options['use_alias']) {

View file

@ -27,7 +27,7 @@ use Symfony\Component\HttpFoundation\Request;
class Time extends CachePluginBase {
/**
* Overrides Drupal\views\Plugin\Plugin::$usesOptions.
* {@inheritdoc}
*/
protected $usesOptions = TRUE;

View file

@ -59,7 +59,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
protected $extenders = [];
/**
* Overrides Drupal\views\Plugin\Plugin::$usesOptions.
* {@inheritdoc}
*/
protected $usesOptions = TRUE;

View file

@ -30,22 +30,22 @@ namespace Drupal\views\Plugin\views\display;
class EntityReference extends DisplayPluginBase {
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::$useAJAX.
* {@inheritdoc}
*/
protected $usesAJAX = FALSE;
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::$usesPager.
* {@inheritdoc}
*/
protected $usesPager = FALSE;
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::$usesAttachments.
* {@inheritdoc}
*/
protected $usesAttachments = FALSE;
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
@ -79,21 +79,21 @@ class EntityReference extends DisplayPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::getType().
* {@inheritdoc}
*/
public function getType() {
return 'entity_reference';
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::execute().
* {@inheritdoc}
*/
public function execute() {
return $this->view->render($this->display['id']);
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::render().
* {@inheritdoc}
*/
public function render() {
if (!empty($this->view->result) && $this->view->style_plugin->evenEmpty()) {
@ -103,14 +103,14 @@ class EntityReference extends DisplayPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::usesExposed().
* {@inheritdoc}
*/
public function usesExposed() {
return FALSE;
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::query().
* {@inheritdoc}
*/
public function query() {
if (!empty($this->view->live_preview)) {
@ -157,7 +157,7 @@ class EntityReference extends DisplayPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::validate().
* {@inheritdoc}
*/
public function validate() {
$errors = parent::validate();

View file

@ -45,7 +45,7 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
protected $usesPager = FALSE;
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::getType().
* {@inheritdoc}
*/
public function getType() {
return 'feed';
@ -89,7 +89,7 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
}
/**
* Overrides \Drupal\views\Plugin\views\display\PathPluginBase::preview().
* {@inheritdoc}
*/
public function preview() {
$output = $this->view->render();
@ -106,7 +106,7 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
}
/**
* Overrides \Drupal\views\Plugin\views\display\PathPluginBase::render().
* {@inheritdoc}
*/
public function render() {
$build = $this->view->style_plugin->render($this->view->result);
@ -117,7 +117,7 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
}
/**
* Overrides \Drupal\views\Plugin\views\displays\DisplayPluginBase::defaultableSections().
* {@inheritdoc}
*/
public function defaultableSections($section = NULL) {
$sections = parent::defaultableSections($section);
@ -137,7 +137,7 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
}
/**
* Overrides \Drupal\views\Plugin\views\display\PathPluginBase::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
@ -175,7 +175,7 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().
* {@inheritdoc}
*/
public function optionsSummary(&$categories, &$options) {
parent::optionsSummary($categories, $options);
@ -218,7 +218,7 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
}
/**
* Overrides \Drupal\views\Plugin\views\display\PathPluginBase::buildOptionsForm().
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
// It is very important to call the parent function here.
@ -264,7 +264,7 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::submitOptionsForm().
* {@inheritdoc}
*/
public function submitOptionsForm(&$form, FormStateInterface $form_state) {
parent::submitOptionsForm($form, $form_state);
@ -306,7 +306,7 @@ class Feed extends PathPluginBase implements ResponseDisplayPluginInterface {
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::usesLinkDisplay().
* {@inheritdoc}
*/
public function usesLinkDisplay() {
return TRUE;

View file

@ -118,7 +118,7 @@ class Page extends PathPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\display\PathPluginBase::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
@ -132,6 +132,7 @@ class Page extends PathPluginBase {
'menu_name' => array('default' => 'main'),
'parent' => array('default' => ''),
'context' => array('default' => ''),
'expanded' => array('default' => FALSE),
),
);
$options['tab_options'] = array(
@ -165,7 +166,7 @@ class Page extends PathPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\display\PathPluginBase::execute().
* {@inheritdoc}
*/
public function execute() {
parent::execute();
@ -186,7 +187,7 @@ class Page extends PathPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().
* {@inheritdoc}
*/
public function optionsSummary(&$categories, &$options) {
parent::optionsSummary($categories, $options);
@ -224,7 +225,7 @@ class Page extends PathPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\display\callbackPluginBase::buildOptionsForm().
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@ -239,7 +240,7 @@ class Page extends PathPluginBase {
);
$menu = $this->getOption('menu');
if (empty($menu)) {
$menu = array('type' => 'none', 'title' => '', 'weight' => 0);
$menu = array('type' => 'none', 'title' => '', 'weight' => 0, 'expanded' => FALSE);
}
$form['menu']['type'] = array(
'#prefix' => '<div class="views-left-30">',
@ -293,6 +294,12 @@ class Page extends PathPluginBase {
),
),
);
$form['menu']['expanded'] = [
'#title' => $this->t('Show as expanded'),
'#type' => 'checkbox',
'#default_value' => !empty($menu['expanded']),
'#description' => $this->t('If selected and this menu link has children, the menu will always appear expanded. '),
];
// Only display the parent selector if Menu UI module is enabled.
$menu_parent = $menu['menu_name'] . ':' . $menu['parent'];
@ -431,7 +438,7 @@ class Page extends PathPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\display\callbackPluginBase::validateOptionsForm().
* {@inheritdoc}
*/
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
parent::validateOptionsForm($form, $form_state);
@ -458,7 +465,7 @@ class Page extends PathPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\display\callbackPluginBase::submitOptionsForm().
* {@inheritdoc}
*/
public function submitOptionsForm(&$form, FormStateInterface $form_state) {
parent::submitOptionsForm($form, $form_state);
@ -480,7 +487,7 @@ class Page extends PathPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::validate().
* {@inheritdoc}
*/
public function validate() {
$errors = parent::validate();
@ -501,7 +508,7 @@ class Page extends PathPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::getArgumentText().
* {@inheritdoc}
*/
public function getArgumentText() {
return array(
@ -512,7 +519,7 @@ class Page extends PathPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::getPagerText().
* {@inheritdoc}
*/
public function getPagerText() {
return array(

View file

@ -80,7 +80,7 @@ abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouter
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::hasPath().
* {@inheritdoc}
*/
public function hasPath() {
return TRUE;
@ -134,6 +134,7 @@ abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouter
protected function getRoute($view_id, $display_id) {
$defaults = array(
'_controller' => 'Drupal\views\Routing\ViewPageController::handle',
'_title' => $this->view->getTitle(),
'view_id' => $view_id,
'display_id' => $display_id,
'_view_display_show_admin_links' => $this->getOption('show_admin_links'),
@ -341,7 +342,7 @@ abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouter
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::execute().
* {@inheritdoc}
*/
public function execute() {
// Prior to this being called, the $view should already be set to this
@ -358,7 +359,7 @@ abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouter
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().
* {@inheritdoc}
*/
public function optionsSummary(&$categories, &$options) {
parent::optionsSummary($categories, $options);
@ -388,7 +389,7 @@ abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouter
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::buildOptionsForm().
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@ -412,7 +413,7 @@ abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouter
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::validateOptionsForm().
* {@inheritdoc}
*/
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
parent::validateOptionsForm($form, $form_state);
@ -429,7 +430,7 @@ abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouter
}
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::submitOptionsForm().
* {@inheritdoc}
*/
public function submitOptionsForm(&$form, FormStateInterface $form_state) {
parent::submitOptionsForm($form, $form_state);

View file

@ -36,7 +36,7 @@ use Drupal\views\Plugin\views\PluginBase;
abstract class ExposedFormPluginBase extends PluginBase implements CacheableDependencyInterface {
/**
* Overrides Drupal\views\Plugin\Plugin::$usesOptions.
* {@inheritdoc}
*/
protected $usesOptions = TRUE;

View file

@ -7,7 +7,9 @@
namespace Drupal\views\Plugin\views\field;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Render\ViewsRenderPipelineMarkup;
use Drupal\views\ResultRow;
/**
@ -63,7 +65,7 @@ class Custom extends FieldPluginBase {
*/
public function render(ResultRow $values) {
// Return the text, so the code never thinks the value is empty.
return $this->options['alter']['text'];
return ViewsRenderPipelineMarkup::create(Xss::filterAdmin($this->options['alter']['text']));
}
/**

View file

@ -107,7 +107,7 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
protected $renderer;
/**
* Overrides Drupal\views\Plugin\views\HandlerBase::init().
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);

View file

@ -75,7 +75,7 @@ class BooleanOperator extends FilterPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\filter\FilterPluginBase::init().
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);

View file

@ -73,7 +73,7 @@ class Bundle extends InOperator {
}
/**
* Overrides \Drupal\views\Plugin\views\filter\InOperator::init().
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
@ -84,7 +84,7 @@ class Bundle extends InOperator {
}
/**
* Overrides \Drupal\views\Plugin\views\filter\InOperator::getValueOptions().
* {@inheritdoc}
*/
public function getValueOptions() {
if (!isset($this->valueOptions)) {
@ -104,7 +104,7 @@ class Bundle extends InOperator {
}
/**
* Overrides \Drupal\views\Plugin\views\filter\InOperator::query().
* {@inheritdoc}
*/
public function query() {
// Make sure that the entity base table is in the query.

View file

@ -42,7 +42,7 @@ class InOperator extends FilterPluginBase {
protected $valueTitle;
/**
* Overrides \Drupal\views\Plugin\views\filter\FilterPluginBase::init().
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);

View file

@ -34,7 +34,7 @@ class ManyToOne extends InOperator {
var $helper = NULL;
/**
* Overrides \Drupal\views\Plugin\views\filter\InOperator::init().
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);

View file

@ -26,7 +26,7 @@ use Drupal\Core\Form\FormStateInterface;
class Full extends SqlBase {
/**
* Overrides \Drupal\views\Plugin\views\SqlBase::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
@ -41,7 +41,7 @@ class Full extends SqlBase {
}
/**
* Overrides \Drupal\views\Plugin\views\SqlBase::buildOptionsForm().
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@ -69,7 +69,7 @@ class Full extends SqlBase {
}
/**
* Overrides \Drupal\views\Plugin\views\pager\PagerPluginBase::summaryTitle().
* {@inheritdoc}
*/
public function summaryTitle() {
if (!empty($this->options['offset'])) {

View file

@ -37,7 +37,7 @@ class Mini extends SqlBase {
}
/**
* Overrides \Drupal\views\Plugin\views\pager\PagerPluginBase::summaryTitle().
* {@inheritdoc}
*/
public function summaryTitle() {
if (!empty($this->options['offset'])) {
@ -47,7 +47,7 @@ class Mini extends SqlBase {
}
/**
* Overrides \Drupal\views\Plugin\views\pager\SqlBase::query().
* {@inheritdoc}
*/
public function query() {
parent::query();
@ -64,14 +64,14 @@ class Mini extends SqlBase {
}
/**
* Overrides \Drupal\views\Plugin\views\pager\PagerPluginBase::useCountQuery().
* {@inheritdoc}
*/
public function useCountQuery() {
return FALSE;
}
/**
* Overrides \Drupal\views\Plugin\views\pager\PagerPluginBase::postExecute().
* {@inheritdoc}
*/
public function postExecute(&$result) {
// In query() one more item might have been retrieved than necessary. If so,

View file

@ -26,7 +26,7 @@ use Drupal\views\Plugin\views\display\DisplayPluginBase;
class None extends PagerPluginBase {
/**
* Overrides \Drupal\views\Plugin\views\PluginBase::init().
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);

View file

@ -37,7 +37,7 @@ abstract class PagerPluginBase extends PluginBase {
var $total_items = 0;
/**
* Overrides Drupal\views\Plugin\Plugin::$usesOptions.
* {@inheritdoc}
*/
protected $usesOptions = TRUE;

View file

@ -112,7 +112,7 @@ class Sql extends QueryPluginBase {
protected $noDistinct;
/**
* Overrides \Drupal\views\Plugin\views\PluginBase::init().
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
@ -1687,7 +1687,7 @@ class Sql extends QueryPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\query\QueryPluginBase::getDateField().
* {@inheritdoc}
*/
public function getDateField($field) {
$db_type = Database::getConnection()->databaseType();
@ -1722,7 +1722,7 @@ class Sql extends QueryPluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\query\QueryPluginBase::setupTimezone().
* {@inheritdoc}
*/
public function setupTimezone() {
$timezone = drupal_get_user_timezone();

View file

@ -26,7 +26,7 @@ use Drupal\Core\Form\FormStateInterface;
class EntityReference extends Fields {
/**
* Overrides \Drupal\views\Plugin\views\row\Fields::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
@ -36,7 +36,7 @@ class EntityReference extends Fields {
}
/**
* Overrides \Drupal\views\Plugin\views\row\Fields::buildOptionsForm().
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);

View file

@ -131,7 +131,7 @@ class EntityRow extends RowPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\row\RowPluginBase::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
@ -140,7 +140,7 @@ class EntityRow extends RowPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\row\RowPluginBase::buildOptionsForm().
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@ -154,7 +154,7 @@ class EntityRow extends RowPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\PluginBase::summaryTitle().
* {@inheritdoc}
*/
public function summaryTitle() {
$options = \Drupal::entityManager()->getViewModeOptions($this->entityTypeId);
@ -185,7 +185,7 @@ class EntityRow extends RowPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\row\RowPluginBase::render().
* {@inheritdoc}
*/
public function render($row) {
return $this->getEntityTranslationRenderer()->render($row);

View file

@ -212,6 +212,9 @@ class OpmlFields extends RowPluginBase {
* The index count of the row as expected by views_plugin_style::getField().
* @param $field_id
* The ID assigned to the required field in the display.
*
* @return string
* The rendered field value.
*/
public function getField($index, $field_id) {
if (empty($this->view->style_plugin) || !is_object($this->view->style_plugin) || empty($field_id)) {

View file

@ -43,7 +43,7 @@ use Drupal\views\Views;
abstract class RowPluginBase extends PluginBase {
/**
* Overrides Drupal\views\Plugin\Plugin::$usesOptions.
* {@inheritdoc}
*/
protected $usesOptions = TRUE;

View file

@ -147,8 +147,10 @@ class RssFields extends RowPluginBase {
// @todo Views should expect and store a leading /. See:
// https://www.drupal.org/node/2423913
$item->link = Url::fromUserInput('/' . $this->getField($row_index, $this->options['link_field']))->setAbsolute()->toString();
$field = $this->getField($row_index, $this->options['description_field']);
$item->description = is_array($field) ? $field : ['#markup' => $field];
$item->elements = array(
array('key' => 'pubDate', 'value' => $this->getField($row_index, $this->options['date_field'])),
array(
@ -197,6 +199,11 @@ class RssFields extends RowPluginBase {
* The index count of the row as expected by views_plugin_style::getField().
* @param $field_id
* The ID assigned to the required field in the display.
*
* @return string|null|\Drupal\Component\Render\MarkupInterface
* An empty string if there is no style plugin, or the field ID is empty.
* NULL if the field value is empty. If neither of these conditions apply,
* a MarkupInterface object containing the rendered field value.
*/
public function getField($index, $field_id) {
if (empty($this->view->style_plugin) || !is_object($this->view->style_plugin) || empty($field_id)) {

View file

@ -19,7 +19,7 @@ use Drupal\views\Views;
class GroupByNumeric extends SortPluginBase {
/**
* Overrides \Drupal\views\Plugin\views\HandlerBase::init().
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);

View file

@ -27,22 +27,22 @@ use Drupal\Core\Form\FormStateInterface;
class EntityReference extends StylePluginBase {
/**
* Overrides \Drupal\views\Plugin\views\style\StylePluginBase::usesRowPlugin.
* {@inheritdoc}
*/
protected $usesRowPlugin = TRUE;
/**
* Overrides \Drupal\views\Plugin\views\style\StylePluginBase::usesFields.
* {@inheritdoc}
*/
protected $usesFields = TRUE;
/**
* Overrides \Drupal\views\Plugin\views\style\StylePluginBase::usesGrouping.
* {@inheritdoc}
*/
protected $usesGrouping = FALSE;
/**
* Overrides \Drupal\views\Plugin\views\style\StylePluginBase\StylePluginBase::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
@ -52,7 +52,7 @@ class EntityReference extends StylePluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\style\StylePluginBase\StylePluginBase::buildOptionsForm().
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@ -70,7 +70,7 @@ class EntityReference extends StylePluginBase {
}
/**
* Overrides \Drupal\views\Plugin\views\style\StylePluginBase\StylePluginBase::render().
* {@inheritdoc}
*/
public function render() {
if (!empty($this->view->live_preview)) {

View file

@ -47,7 +47,7 @@ abstract class Mapping extends StylePluginBase {
abstract protected function defineMapping();
/**
* Overrides Drupal\views\Plugin\views\style\StylePluginBase::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
@ -69,7 +69,7 @@ abstract class Mapping extends StylePluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\style\StylePluginBase::buildOptionsForm().
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);

View file

@ -46,7 +46,7 @@ use Drupal\views\ViewExecutable;
abstract class StylePluginBase extends PluginBase {
/**
* Overrides Drupal\views\Plugin\Plugin::$usesOptions.
* {@inheritdoc}
*/
protected $usesOptions = TRUE;

View file

@ -0,0 +1,51 @@
<?php
/**
* @file
* Contains \Drupal\views\Tests\Entity\ViewNonTranslatableEntityTest.
*/
namespace Drupal\views\Tests\Entity;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\language_test\Entity\NoLanguageEntityTest;
use Drupal\simpletest\WebTestBase;
/**
* Tests the view creation of non-translatable entities.
*
* @group views
*/
class ViewNonTranslatableEntityTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array(
'entity_test',
'content_translation',
'language_test',
'views_ui',
);
/**
* Tests displaying a view of non-translatable entities.
*/
public function testViewNoTranslatableEntity() {
// Add a new language.
ConfigurableLanguage::createFromLangcode('sr')->save();
// Create a non-translatable entity.
$no_language_entity = NoLanguageEntityTest::create();
$no_language_entity->save();
// Visit the view page and assert it is displayed properly.
$this->drupalGet('no-entity-translation-view');
$this->assertResponse(200);
$this->assertText('No Entity Translation View');
$this->assertText($no_language_entity->uuid());
}
}

View file

@ -28,7 +28,7 @@ class FieldApiDataTest extends FieldTestBase {
'field_name' => $field_names[0],
'entity_type' => 'node',
'bundle' => 'page',
'label' => 'The giraffe" label'
'label' => 'GiraffeA" label'
);
entity_create('field_config', $field)->save();
@ -38,7 +38,7 @@ class FieldApiDataTest extends FieldTestBase {
'field_name' => $field_names[0],
'entity_type' => 'node',
'bundle' => 'article',
'label' => 'The giraffe2" label'
'label' => 'GiraffeB" label'
])->save();
// Now create some example nodes/users for the view result.
@ -56,18 +56,11 @@ class FieldApiDataTest extends FieldTestBase {
* We check data structure for both node and node revision tables.
*/
function testViewsData() {
$views_data = $this->container->get('views.views_data');
$data = array();
// Check the table and the joins of the first field.
// Attached to node only.
$field_storage = $this->fieldStorages[0];
/** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
$table_mapping = \Drupal::entityManager()->getStorage('node')->getTableMapping();
$field_storage = $this->fieldStorages[0];
$current_table = $table_mapping->getDedicatedDataTableName($field_storage);
$revision_table = $table_mapping->getDedicatedRevisionTableName($field_storage);
$data[$current_table] = $views_data->get($current_table);
$data[$revision_table] = $views_data->get($revision_table);
$data = $this->getViewsData();
$this->assertTrue(isset($data[$current_table]));
$this->assertTrue(isset($data[$revision_table]));
@ -100,10 +93,51 @@ class FieldApiDataTest extends FieldTestBase {
$this->assertTrue(empty($data[$revision_table][$field_storage->getName()]['field']['click sortable']), 'Non-primary fields are not click sortable');
$this->assertTrue($data[$current_table][$field_storage->getName()]['help'] instanceof MarkupInterface);
$this->assertEqual($data[$current_table][$field_storage->getName()]['help'], 'Appears in: page, article. Also known as: Content: The giraffe2&quot; label');
$this->assertEqual($data[$current_table][$field_storage->getName()]['help'], 'Appears in: page, article. Also known as: Content: GiraffeB&quot; label');
$this->assertTrue($data[$current_table][$field_storage->getName() . '_value']['help'] instanceof MarkupInterface);
$this->assertEqual($data[$current_table][$field_storage->getName() . '_value']['help'], 'Appears in: page, article. Also known as: Content: The giraffe&quot; label (field_name_0)');
$this->assertEqual($data[$current_table][$field_storage->getName() . '_value']['help'], 'Appears in: page, article. Also known as: Content: GiraffeA&quot; label (field_name_0)');
// Since each label is only used once, views_entity_field_label() will
// return a label using alphabetical sorting.
$this->assertEqual('GiraffeA&quot; label (field_name_0)', $data[$current_table][$field_storage->getName() . '_value']['title']);
// Attach the same field to a different bundle with a different label.
$this->drupalCreateContentType(['type' => 'news']);
FieldConfig::create([
'field_name' => $this->fieldStorages[0]->getName(),
'entity_type' => 'node',
'bundle' => 'news',
'label' => 'GiraffeB" label'
])->save();
$this->container->get('views.views_data')->clear();
$data = $this->getViewsData();
// Now the 'GiraffeB&quot; label' is used twice and therefore will be
// selected by views_entity_field_label().
$this->assertEqual('GiraffeB&quot; label (field_name_0)', $data[$current_table][$field_storage->getName() . '_value']['title']);
$this->assertTrue($data[$current_table][$field_storage->getName()]['help'] instanceof MarkupInterface);
$this->assertEqual($data[$current_table][$field_storage->getName()]['help'], 'Appears in: page, article, news. Also known as: Content: GiraffeA&quot; label');
}
/**
* Gets the views data for the field created in setUp().
*
* @return array
*/
protected function getViewsData() {
$views_data = $this->container->get('views.views_data');
$data = array();
// Check the table and the joins of the first field.
// Attached to node only.
/** @var \Drupal\Core\Entity\Sql\DefaultTableMapping $table_mapping */
$table_mapping = \Drupal::entityManager()->getStorage('node')->getTableMapping();
$current_table = $table_mapping->getDedicatedDataTableName($this->fieldStorages[0]);
$revision_table = $table_mapping->getDedicatedRevisionTableName($this->fieldStorages[0]);
$data[$current_table] = $views_data->get($current_table);
$data[$revision_table] = $views_data->get($revision_table);
return $data;
}
}

View file

@ -35,7 +35,7 @@ class ArgumentDateTest extends ViewKernelTestBase {
);
/**
* Overrides \Drupal\views\Tests\ViewKernelTestBase::viewsData().
* {@inheritdoc}
*/
public function viewsData() {
$data = parent::viewsData();

View file

@ -7,6 +7,9 @@
namespace Drupal\views\Tests\Handler;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Render\RenderContext;
use Drupal\views\Plugin\views\PluginBase;
use Drupal\views\Tests\ViewKernelTestBase;
use Drupal\views\Views;
@ -24,18 +27,24 @@ class FieldCustomTest extends ViewKernelTestBase {
*/
public static $testViews = array('test_view');
/**
* {@inheritdoc}
*/
function viewsData() {
$data = parent::viewsData();
$data['views_test_data']['name']['field']['id'] = 'custom';
return $data;
}
/**
* Ensure that custom fields work and doesn't escape unnecessary markup.
*/
public function testFieldCustom() {
$view = Views::getView('test_view');
$view->setDisplay();
// Alter the text of the field to a random string.
$random = $this->randomMachineName();
$random = '<div>' . $this->randomMachineName() . '</div>';
$view->displayHandlers->get('default')->overrideOption('fields', array(
'name' => array(
'id' => 'name',
@ -53,4 +62,62 @@ class FieldCustomTest extends ViewKernelTestBase {
$this->assertEqual($random, $view->style_plugin->getField(0, 'name'));
}
/**
* Ensure that custom fields can use tokens.
*/
public function testFieldCustomTokens() {
$view = Views::getView('test_view');
$view->setDisplay();
$view->displayHandlers->get('default')->overrideOption('fields', [
'age' => [
'id' => 'age',
'exclude' => TRUE,
'table' => 'views_test_data',
'field' => 'age',
],
'name' => [
'id' => 'name',
'table' => 'views_test_data',
'field' => 'name',
'relationship' => 'none',
'alter' => [
'text' => 'Amount of kittens: {{ age }}',
],
],
]);
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::service('renderer');
$preview = $view->preview();
$output = $renderer->renderRoot($preview);
$expected_text = 'Amount of kittens: ' . $view->style_plugin->getField(0, 'age');
$this->assertTrue(strpos((string) $output, $expected_text), 'The views token has been successfully replaced.');
}
/**
* Ensure that custom field content is XSS filtered.
*/
public function testCustomFieldXss() {
$view = Views::getView('test_view');
$view->setDisplay();
// Alter the text of the field to include XSS.
$text = '<script>alert("kittens")</script>';
$view->displayHandlers->get('default')->overrideOption('fields', array(
'name' => array(
'id' => 'name',
'table' => 'views_test_data',
'field' => 'name',
'relationship' => 'none',
'alter' => array(
'text' => $text,
),
),
));
$this->executeView($view);
$this->assertEqual(Xss::filter($text), $view->style_plugin->getField(0, 'name'));
}
}

View file

@ -39,7 +39,7 @@ class FieldKernelTest extends ViewKernelTestBase {
);
/**
* Overrides Drupal\views\Tests\ViewTestBase::viewsData().
* {@inheritdoc}
*/
protected function viewsData() {
$data = parent::viewsData();

View file

@ -53,7 +53,7 @@ class FieldWebTest extends HandlerTestBase {
}
/**
* Overrides \Drupal\views\Tests\ViewTestBase::viewsData().
* {@inheritdoc}
*/
protected function viewsData() {
$data = parent::viewsData();

View file

@ -33,7 +33,7 @@ class HandlerAliasTest extends ViewKernelTestBase {
}
/**
* Overrides Drupal\views\Tests\ViewTestBase::viewsData().
* {@inheritdoc}
*/
protected function viewsData() {
$data = parent::viewsData();

View file

@ -45,7 +45,7 @@ class HandlerTest extends ViewTestBase {
}
/**
* Overrides Drupal\views\Tests\ViewTestBase::viewsData().
* {@inheritdoc}
*/
protected function viewsData() {
$data = parent::viewsData();

View file

@ -48,9 +48,13 @@ class DisplayFeedTest extends PluginTestBase {
// Verify a title with HTML entities is properly escaped.
$node_title = 'This "cool" & "neat" article\'s title';
$node = $this->drupalCreateNode(array(
'title' => $node_title
));
$node = $this->drupalCreateNode([
'title' => $node_title,
'body' => [0 => [
'value' => 'A paragraph',
'format' => filter_default_format(),
]],
]);
// Test the site name setting.
$site_name = $this->randomMachineName();
@ -60,6 +64,8 @@ class DisplayFeedTest extends PluginTestBase {
$result = $this->xpath('//title');
$this->assertEqual($result[0], $site_name, 'The site title is used for the feed title.');
$this->assertEqual($result[1], $node_title, 'Node title with HTML entities displays correctly.');
// Verify HTML is properly escaped in the description field.
$this->assertRaw('&lt;p&gt;A paragraph&lt;/p&gt;');
$view = $this->container->get('entity.manager')->getStorage('view')->load('test_display_feed');
$display = &$view->getDisplay('feed_1');
@ -101,12 +107,18 @@ class DisplayFeedTest extends PluginTestBase {
// Verify a title with HTML entities is properly escaped.
$node_title = 'This "cool" & "neat" article\'s title';
$this->drupalCreateNode(array(
'title' => $node_title
'title' => $node_title,
'body' => [0 => [
'value' => 'A paragraph',
'format' => filter_default_format(),
]],
));
$this->drupalGet('test-feed-display-fields.xml');
$result = $this->xpath('//title/a');
$this->assertEqual($result[0], $node_title, 'Node title with HTML entities displays correctly.');
// Verify HTML is properly escaped in the description field.
$this->assertRaw('&lt;p&gt;A paragraph&lt;/p&gt;');
}
/**

View file

@ -136,6 +136,8 @@ class DisplayPageTest extends ViewKernelTestBase {
$this->assertTrue(isset($tree['system.admin']->subtree['views_view:views.test_page_display_menu.page_4']));
$menu_link = $tree['system.admin']->subtree['views_view:views.test_page_display_menu.page_4']->link;
$this->assertEqual($menu_link->getTitle(), 'Test child (with parent)');
$this->assertEqual($menu_link->isExpanded(), TRUE);
$this->assertEqual($menu_link->getDescription(), 'Sample description.');
}
/**

View file

@ -39,7 +39,7 @@ class FilterTest extends PluginTestBase {
}
/**
* Overrides Drupal\views\Tests\ViewTestBase::viewsData().
* {@inheritdoc}
*/
protected function viewsData() {
$data = parent::viewsData();

View file

@ -43,6 +43,20 @@ class PluginBaseTest extends KernelTestBase {
$this->assertIdentical($result, 'en means English');
}
/**
* Test that the token replacement in views works correctly with dots.
*/
public function testViewsTokenReplaceWithDots() {
$text = '{{ argument.first }} comes before {{ argument.second }}';
$tokens = ['{{ argument.first }}' => 'first', '{{ argument.second }}' => 'second'];
$result = \Drupal::service('renderer')->executeInRenderContext(new RenderContext(), function () use ($text, $tokens) {
return $this->testPluginBase->viewsTokenReplace($text, $tokens);
});
$this->assertIdentical($result, 'first comes before second');
}
/**
* Tests viewsTokenReplace without any twig tokens.
*/

View file

@ -30,7 +30,7 @@ abstract class RelationshipJoinTestBase extends PluginKernelTestBase {
protected $rootUser;
/**
* Overrides \Drupal\views\Tests\ViewKernelTestBase::setUpFixtures().
* {@inheritdoc}
*/
protected function setUpFixtures() {
$this->installEntitySchema('user');

View file

@ -34,7 +34,7 @@ class ViewsSqlExceptionTest extends PluginTestBase {
}
/**
* Overrides Drupal\views\Tests\ViewTestBase::viewsData().
* {@inheritdoc}
*/
protected function viewsData() {
$data = parent::viewsData();

View file

@ -1855,11 +1855,11 @@ class ViewExecutable implements \Serializable {
* @param string $display_id
* (Optional) The display id. ( Used only to detail an exception. )
*
* @throws \InvalidArgumentException
* Thrown when the display plugin does not have a URL to return.
*
* @return \Drupal\Core\Url
* The display handlers URL object.
*
* @throws \InvalidArgumentException
* Thrown when the display plugin does not have a URL to return.
*/
public function getUrlInfo($display_id = '') {
$this->initDisplay();

View file

@ -1,8 +1,12 @@
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.teaser
- field.storage.node.body
module:
- node
- text
- user
id: test_display_feed
label: test_display_feed
@ -41,6 +45,68 @@ display:
plugin_id: field
entity_type: node
entity_field: title
body:
id: body
table: node__body
field: body
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: text_default
settings: { }
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
plugin_id: field
filters:
status:
expose:
@ -75,10 +141,21 @@ display:
style:
type: default
title: test_display_feed
display_extenders: { }
display_plugin: default
display_title: Master
id: default
position: 0
cache_metadata:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- 'user.node_grants:view'
- user.permissions
max-age: -1
tags:
- 'config:field.storage.node.body'
feed_1:
display_options:
displays: { }
@ -90,10 +167,20 @@ display:
style:
type: rss
sitename_title: true
display_extenders: { }
display_plugin: feed
display_title: Feed
id: feed_1
position: 0
cache_metadata:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- 'user.node_grants:view'
- user.permissions
max-age: -1
tags:
- 'config:field.storage.node.body'
feed_2:
display_options:
displays: { }
@ -105,7 +192,7 @@ display:
options:
title_field: title
link_field: title
description_field: title
description_field: body
creator_field: title
date_field: title
guid_field_options:
@ -115,14 +202,35 @@ display:
type: rss
sitename_title: true
display_description: ''
display_extenders: { }
display_plugin: feed
display_title: 'Feed with Fields'
id: feed_2
position: 0
cache_metadata:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- 'user.node_grants:view'
- user.permissions
max-age: -1
tags:
- 'config:field.storage.node.body'
page:
display_options:
path: test-feed-display
display_extenders: { }
display_plugin: page
display_title: <em>Page</em>
display_title: '<em>Page</em>'
id: page
position: 0
cache_metadata:
contexts:
- 'languages:language_content'
- 'languages:language_interface'
- url.query_args
- 'user.node_grants:view'
- user.permissions
max-age: -1
tags:
- 'config:field.storage.node.body'

View file

@ -7,7 +7,6 @@ dependencies:
- user
config:
- field.storage.node.field_views_testing_group_rows
module:
id: test_group_rows
label: test_group_rows
module: views

View file

@ -91,10 +91,11 @@ display:
type: normal
title: 'Test child (with parent)'
parent: system.admin
description: ''
description: 'Sample description.'
menu_name: admin
weight: 0
context: '0'
expanded: true
defaults:
title: false
display_plugin: page

View file

@ -3,6 +3,7 @@ status: true
dependencies:
module:
- node
- search
- user
id: test_search
label: 'Search Test'
@ -115,6 +116,9 @@ display:
group_type: group
admin_label: ''
order: DESC
exposed: false
expose:
label: ''
plugin_id: search_score
title: ''
header: { }

View file

@ -28,7 +28,7 @@ class TestExample extends AreaPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\area\AreaPluginBase::option_definition().
* {@inheritdoc}
*/
public function defineOptions() {
$options = parent::defineOptions();
@ -39,7 +39,7 @@ class TestExample extends AreaPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\area\AreaPluginBase::buildOptionsForm()
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@ -47,7 +47,7 @@ class TestExample extends AreaPluginBase {
}
/**
* Implements \Drupal\views\Plugin\views\area\AreaPluginBase::render().
* {@inheritdoc}
*/
public function render($empty = FALSE) {
if (!$empty || !empty($this->options['empty'])) {

View file

@ -20,7 +20,7 @@ use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
class ArgumentDefaultTest extends ArgumentDefaultPluginBase {
/**
* Overrides Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();

View file

@ -33,15 +33,14 @@ class DisplayTest extends DisplayPluginBase {
protected $usesAttachments = TRUE;
/**
* Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::getType().
* {@inheritdoc}
*/
public function getType() {
return 'test';
}
/**
* Overrides
* Drupal\views\Plugin\views\display\DisplayPluginBase::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();

View file

@ -39,7 +39,7 @@ class DisplayExtenderTest extends DisplayExtenderPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().
* {@inheritdoc}
*/
public function optionsSummary(&$categories, &$options) {
parent::optionsSummary($categories, $options);
@ -60,7 +60,7 @@ class DisplayExtenderTest extends DisplayExtenderPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\display_extender\DisplayExtenderPluginBase::buildOptionsForm().
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
switch ($form_state->get('section')) {
@ -76,7 +76,7 @@ class DisplayExtenderTest extends DisplayExtenderPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\display\DisplayExtenderPluginBase::submitOptionsForm().
* {@inheritdoc}
*/
public function submitOptionsForm(&$form, FormStateInterface $form_state) {
parent::submitOptionsForm($form, $form_state);
@ -88,21 +88,21 @@ class DisplayExtenderTest extends DisplayExtenderPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\display\DisplayExtenderPluginBase::defaultableSections().
* {@inheritdoc}
*/
public function defaultableSections(&$sections, $section = NULL) {
$sections['test_extender_test_option'] = array('test_extender_test_option');
}
/**
* Overrides Drupal\views\Plugin\views\display\DisplayExtenderPluginBase::query().
* {@inheritdoc}
*/
public function query() {
$this->testState['query'] = TRUE;
}
/**
* Overrides Drupal\views\Plugin\views\display\DisplayExtenderPluginBase::preExecute().
* {@inheritdoc}
*/
public function preExecute() {
$this->testState['preExecute'] = TRUE;

View file

@ -43,7 +43,7 @@ class FieldTest extends FieldPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\field\FieldPluginBase::addSelfTokens().
* {@inheritdoc}
*/
protected function addSelfTokens(&$tokens, $item) {
$tokens['{{ test_token }}'] = $this->getTestValue();

View file

@ -43,7 +43,7 @@ class FilterTest extends FilterPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\filter\FilterPluginBase::query().
* {@inheritdoc}
*/
public function query() {
// Call the parent if this option is enabled.

View file

@ -42,7 +42,7 @@ class JoinTest extends JoinPluginBase {
/**
* Overrides Drupal\views\Plugin\views\join\JoinPluginBase::buildJoin().
* {@inheritdoc}
*/
public function buildJoin($select_query, $table, $view_query) {
// Add an additional hardcoded condition to the query.

View file

@ -29,7 +29,7 @@ class QueryTest extends QueryPluginBase {
protected $orderBy = array();
/**
* Implements \Drupal\views\Plugin\views\query\QueryPluginBase::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
@ -39,7 +39,7 @@ class QueryTest extends QueryPluginBase {
}
/**
* Implements \Drupal\views\Plugin\views\query\QueryPluginBase::buildOptionsForm().
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@ -98,7 +98,7 @@ class QueryTest extends QueryPluginBase {
}
/**
* Implements Drupal\views\Plugin\views\query\QueryPluginBase::execute().
* {@inheritdoc}
*/
public function execute(ViewExecutable $view) {
$result = array();

View file

@ -33,7 +33,7 @@ class RowTest extends RowPluginBase {
public $output;
/**
* Overrides Drupal\views\Plugin\views\row\RowPluginBase::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
@ -43,7 +43,7 @@ class RowTest extends RowPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\row\RowPluginBase::buildOptionsForm().
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@ -76,7 +76,7 @@ class RowTest extends RowPluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\row\RowPluginBase::render()
* {@inheritdoc}
*/
public function render($row) {
return $this->getOutput();

View file

@ -26,7 +26,7 @@ use Drupal\views\Plugin\views\field\NumericField;
class MappingTest extends Mapping {
/**
* Overrides Drupal\views\Plugin\views\style\Mapping::defineMapping().
* {@inheritdoc}
*/
protected function defineMapping() {
return array(

View file

@ -41,7 +41,7 @@ class StyleTest extends StylePluginBase {
protected $usesRowPlugin = TRUE;
/**
* Overrides Drupal\views\Plugin\views\style\StylePluginBase::defineOptions().
* {@inheritdoc}
*/
protected function defineOptions() {
$options = parent::defineOptions();
@ -51,7 +51,7 @@ class StyleTest extends StylePluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\style\StylePluginBase::buildOptionsForm().
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
@ -94,7 +94,7 @@ class StyleTest extends StylePluginBase {
}
/**
* Overrides Drupal\views\Plugin\views\style\StylePluginBase::render()
* {@inheritdoc}
*/
public function render() {
$output = '';

View file

@ -774,6 +774,26 @@ class EntityViewsDataTest extends UnitTestCase {
$this->assertEquals('entity_link_edit', $data['entity_test']['edit_entity_test']['field']['id']);
}
/**
* @covers ::getViewsData
*/
public function testGetViewsDataWithoutEntityOperations() {
// Make sure there is no list builder. The API does not document is
// supports resetting entity handlers, so this might break in the future.
$this->baseEntityType->setListBuilderClass(NULL);
$data = $this->viewsData->getViewsData();
$this->assertArrayNotHasKey('operations', $data[$this->baseEntityType->getBaseTable()]);
}
/**
* @covers ::getViewsData
*/
public function testGetViewsDataWithEntityOperations() {
$this->baseEntityType->setListBuilderClass('\Drupal\Core\Entity\EntityListBuilder');
$data = $this->viewsData->getViewsData();
$this->assertSame('entity_operations', $data[$this->baseEntityType->getBaseTable()]['operations']['field']['id']);
}
/**
* Tests views data for a string field.
*

View file

@ -108,6 +108,7 @@ class PathPluginBaseTest extends UnitTestCase {
$this->assertEquals('test_id', $route->getDefault('view_id'));
$this->assertEquals('page_1', $route->getDefault('display_id'));
$this->assertSame(FALSE, $route->getOption('returns_response'));
$this->assertEquals('my views title', $route->getDefault('_title'));
}
/**
@ -134,6 +135,7 @@ class PathPluginBaseTest extends UnitTestCase {
$this->pathPlugin->collectRoutes($collection);
$route = $collection->get('view.test_id.page_1');
$this->assertSame(TRUE, $route->getOption('returns_response'));
$this->assertEquals('my views title', $route->getDefault('_title'));
}
/**
@ -161,6 +163,7 @@ class PathPluginBaseTest extends UnitTestCase {
$this->assertEquals('test_id', $route->getDefault('view_id'));
$this->assertEquals('page_1', $route->getDefault('display_id'));
$this->assertEquals(array('arg_0' => 'arg_0'), $route->getOption('_view_argument_map'));
$this->assertEquals('my views title', $route->getDefault('_title'));
}
/**
@ -191,6 +194,7 @@ class PathPluginBaseTest extends UnitTestCase {
$this->assertEquals('test_id', $route->getDefault('view_id'));
$this->assertEquals('page_1', $route->getDefault('display_id'));
$this->assertEquals(array('arg_0' => 'arg_0'), $route->getOption('_view_argument_map'));
$this->assertEquals('my views title', $route->getDefault('_title'));
}
/**
@ -216,6 +220,7 @@ class PathPluginBaseTest extends UnitTestCase {
$this->assertTrue($route instanceof Route);
$this->assertEquals('test_id', $route->getDefault('view_id'));
$this->assertEquals('page_1', $route->getDefault('display_id'));
$this->assertEquals('my views title', $route->getDefault('_title'));
}
/**
@ -245,6 +250,7 @@ class PathPluginBaseTest extends UnitTestCase {
$this->assertTrue($route instanceof Route);
$this->assertEquals('test_id', $route->getDefault('view_id'));
$this->assertEquals('page_1', $route->getDefault('display_id'));
$this->assertEquals('my views title', $route->getDefault('_title'));
// Ensure that the test_route_2 is not overridden.
$route = $collection->get('test_route_2');
@ -285,6 +291,7 @@ class PathPluginBaseTest extends UnitTestCase {
$this->assertEquals('/test_route/{node}/example', $route->getPath());
$this->assertEquals('test_id', $route->getDefault('view_id'));
$this->assertEquals('page_1', $route->getDefault('display_id'));
$this->assertEquals('my views title', $route->getDefault('_title'));
$this->assertEquals(array('arg_0' => 'node'), $route->getOption('_view_argument_map'));
}
@ -322,6 +329,7 @@ class PathPluginBaseTest extends UnitTestCase {
// Ensure that the path did not changed and placeholders are respected.
$this->assertEquals('/test_route/{parameter}', $route->getPath());
$this->assertEquals(array('arg_0' => 'parameter'), $route->getOption('_view_argument_map'));
$this->assertEquals('my views title', $route->getDefault('_title'));
}
/**
@ -359,6 +367,7 @@ class PathPluginBaseTest extends UnitTestCase {
// Ensure that the path did not changed and placeholders are respected kk.
$this->assertEquals('/test_route/{parameter}', $route->getPath());
$this->assertEquals(['arg_0' => 'parameter'], $route->getOption('_view_argument_map'));
$this->assertEquals('my views title', $route->getDefault('_title'));
}
/**
@ -393,6 +402,7 @@ class PathPluginBaseTest extends UnitTestCase {
// Ensure that the path did not changed and placeholders are respected.
$this->assertEquals('/test_route/{parameter}/{arg_1}', $route->getPath());
$this->assertEquals(array('arg_0' => 'parameter'), $route->getOption('_view_argument_map'));
$this->assertEquals('my views title', $route->getDefault('_title'));
}
/**
@ -427,6 +437,10 @@ class PathPluginBaseTest extends UnitTestCase {
$view = $this->getMockBuilder('Drupal\views\ViewExecutable')
->disableOriginalConstructor()
->getMock();
$view->expects($this->any())
->method('getTitle')
->willReturn('my views title');
$view->storage = $view_entity;
// Skip views options caching.

View file

@ -313,3 +313,21 @@ function _views_update_argument_map($displays) {
/**
* @} End of "addtogroup updates-8.0.0-beta".
*/
/**
* @addtogroup updates-8.0.0-rc
* @{
*/
/**
* Clear caches to fix entity operations field.
*/
function views_update_8003() {
// Empty update to cause a cache flush so that views data is rebuilt. Entity
// types that don't implement a list builder cannot have the entity operations
// field.
}
/**
* @} End of "addtogroup updates-8.0.0-rc".
*/

View file

@ -863,11 +863,14 @@ function template_preprocess_views_view_row_rss(&$variables) {
$variables['title'] = $item->title;
$variables['link'] = $item->link;
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::service('renderer');
// We render the item description. It might contain entities, which attach rss
// elements via hook_entity_view, see comment_entity_view().
$variables['description'] = is_array($item->description) ? $renderer->render($item->description) : $item->description;
// The description is the only place where we should find HTML.
// @see https://validator.w3.org/feed/docs/rss2.html#hrelementsOfLtitemgt
// If we have a render array, render it here and pass the result to the
// template, letting Twig autoescape it.
if (isset($item->description) && is_array($item->description)) {
$variables['description'] = (string) \Drupal::service('renderer')->render($item->description);
}
$variables['item_elements'] = array();
foreach ($item->elements as $element) {
if (isset($element['attributes']) && is_array($element['attributes'])) {

View file

@ -263,7 +263,14 @@ function views_entity_field_label($entity_type, $field_name) {
return array($field_name, $all_labels);
}
// Sort the field labels by it most used label and return the most used one.
arsort($label_counter);
// If the counts are equal, sort by the label to ensure the result is
// deterministic.
uksort($label_counter, function($a, $b) use ($label_counter) {
if ($label_counter[$a] === $label_counter[$b]) {
return strcmp($a, $b);
}
return $label_counter[$a] > $label_counter[$b] ? -1 : 1;
});
$label_counter = array_keys($label_counter);
return array($label_counter[0], $all_labels);
}