Update to Drupal 8.1.1. For more information, see https://www.drupal.org/node/2718713
This commit is contained in:
parent
c0a0d5a94c
commit
9eae24d844
669 changed files with 3873 additions and 1553 deletions
|
|
@ -496,7 +496,7 @@ class EntityViewsData implements EntityHandlerInterface, EntityViewsDataInterfac
|
|||
$views_field['title'] = $this->t('Translation language');
|
||||
}
|
||||
if ($table == $this->entityType->getBaseTable() || $table == $this->entityType->getRevisionTable()) {
|
||||
$views_field['title'] = $this->t('Original language');
|
||||
$views_field['title'] = $this->t('Original language');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,7 +269,6 @@ class ViewsEntitySchemaSubscriber implements EntityTypeListenerInterface, EventS
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Updates views if a data table is renamed.
|
||||
*
|
||||
* @param \Drupal\views\Entity\View[] $all_views
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class ViewsHandlerManager extends DefaultPluginManager implements FallbackPlugin
|
|||
}
|
||||
|
||||
// @todo This is crazy. Find a way to remove the override functionality.
|
||||
$plugin_id = $override ? : $definition['id'];
|
||||
$plugin_id = $override ?: $definition['id'];
|
||||
// Try to use the overridden handler.
|
||||
$handler = $this->createInstance($plugin_id, $definition);
|
||||
if ($override && method_exists($handler, 'broken') && $handler->broken()) {
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ abstract class HandlerBase extends PluginBase implements ViewsHandlerInterface {
|
|||
|
||||
$form['admin_label'] = array(
|
||||
'#type' => 'details',
|
||||
'#title' =>$this->t('Administrative title'),
|
||||
'#title' => $this->t('Administrative title'),
|
||||
'#weight' => 150,
|
||||
);
|
||||
$form['admin_label']['admin_label'] = array(
|
||||
|
|
|
|||
|
|
@ -51,34 +51,32 @@ abstract class ArgumentValidatorPluginBase extends PluginBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieve the options when this is a new access
|
||||
* control plugin
|
||||
* Retrieves the options when this is a new access control plugin.
|
||||
*/
|
||||
protected function defineOptions() { return array(); }
|
||||
|
||||
/**
|
||||
* Provide the default form for setting options.
|
||||
* Provides the default form for setting options.
|
||||
*/
|
||||
public function buildOptionsForm(&$form, FormStateInterface $form_state) { }
|
||||
|
||||
/**
|
||||
* Provide the default form form for validating options
|
||||
* Provides the default form for validating options.
|
||||
*/
|
||||
public function validateOptionsForm(&$form, FormStateInterface $form_state) { }
|
||||
|
||||
/**
|
||||
* Provide the default form form for submitting options
|
||||
* Provides the default form for submitting options.
|
||||
*/
|
||||
public function submitOptionsForm(&$form, FormStateInterface $form_state, &$options = array()) { }
|
||||
|
||||
/**
|
||||
* Determine if the administrator has the privileges to use this plugin
|
||||
* Determines if the administrator has the privileges to use this plugin.
|
||||
*/
|
||||
public function access() { return TRUE; }
|
||||
|
||||
/**
|
||||
* If we don't have access to the form but are showing it anyway, ensure that
|
||||
* the form is safe and cannot be changed from user input.
|
||||
* Blocks user input when the form is shown but we don´t have access.
|
||||
*
|
||||
* This is only called by child objects if specified in the buildOptionsForm(),
|
||||
* so it will not always be used.
|
||||
|
|
@ -91,10 +89,13 @@ abstract class ArgumentValidatorPluginBase extends PluginBase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs validation for a given argument.
|
||||
*/
|
||||
public function validateArgument($arg) { return TRUE; }
|
||||
|
||||
/**
|
||||
* Process the summary arguments for displaying.
|
||||
* Processes the summary arguments for displaying.
|
||||
*
|
||||
* Some plugins alter the argument so it uses something else internally.
|
||||
* For example the user validation set's the argument to the uid,
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ class Block extends DisplayPluginBase {
|
|||
* @param \Drupal\Core\Form\FormStateInterface $form_state
|
||||
* The current state of the form.
|
||||
*
|
||||
* * @see \Drupal\views\Plugin\Block\ViewsBlock::blockSubmit()
|
||||
* @see \Drupal\views\Plugin\Block\ViewsBlock::blockSubmit()
|
||||
*/
|
||||
public function blockSubmit(ViewsBlock $block, $form, FormStateInterface $form_state) {
|
||||
if ($items_per_page = $form_state->getValue(array('override', 'items_per_page'))) {
|
||||
|
|
|
|||
|
|
@ -1524,7 +1524,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
|||
);
|
||||
|
||||
$access = $this->getOption('access');
|
||||
$form['access']['type'] = array(
|
||||
$form['access']['type'] = array(
|
||||
'#title' => $this->t('Access'),
|
||||
'#title_display' => 'invisible',
|
||||
'#type' => 'radios',
|
||||
|
|
@ -1561,7 +1561,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
|||
);
|
||||
|
||||
$cache = $this->getOption('cache');
|
||||
$form['cache']['type'] = array(
|
||||
$form['cache']['type'] = array(
|
||||
'#title' => $this->t('Caching'),
|
||||
'#title_display' => 'invisible',
|
||||
'#type' => 'radios',
|
||||
|
|
@ -1782,7 +1782,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
|||
);
|
||||
|
||||
$exposed_form = $this->getOption('exposed_form');
|
||||
$form['exposed_form']['type'] = array(
|
||||
$form['exposed_form']['type'] = array(
|
||||
'#title' => $this->t('Exposed form'),
|
||||
'#title_display' => 'invisible',
|
||||
'#type' => 'radios',
|
||||
|
|
@ -1818,7 +1818,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
|||
);
|
||||
|
||||
$pager = $this->getOption('pager');
|
||||
$form['pager']['type'] = array(
|
||||
$form['pager']['type'] = array(
|
||||
'#title' => $this->t('Pager'),
|
||||
'#title_display' => 'invisible',
|
||||
'#type' => 'radios',
|
||||
|
|
@ -2372,7 +2372,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
|
|||
$build['#cache']['keys'][] = implode(',', $args);
|
||||
}
|
||||
|
||||
$build['#cache_properties'] = ['#view_id', '#view_display_show_admin_links', '#view_display_plugin_id'];
|
||||
$build['#cache_properties'] = ['#view_id', '#view_display_show_admin_links', '#view_display_plugin_id'];
|
||||
|
||||
return $build;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,13 @@ namespace Drupal\views\Plugin\views\display;
|
|||
*/
|
||||
class Embed extends DisplayPluginBase {
|
||||
|
||||
// This display plugin does nothing apart from exist.
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildRenderable(array $args = [], $cache = TRUE) {
|
||||
$build = parent::buildRenderable($args, $cache);
|
||||
$build['#embed'] = TRUE;
|
||||
return $build;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ abstract class PathPluginBase extends DisplayPluginBase implements DisplayRouter
|
|||
$path = implode('/', $bits);
|
||||
$view_id = $this->view->storage->id();
|
||||
$display_id = $this->display['id'];
|
||||
$view_id_display = "{$view_id}.{$display_id}";
|
||||
$view_id_display = "{$view_id}.{$display_id}";
|
||||
$menu_link_id = 'views.' . str_replace('/', '.', $view_id_display);
|
||||
|
||||
if ($path) {
|
||||
|
|
|
|||
|
|
@ -116,8 +116,9 @@ interface FieldHandlerInterface extends ViewsHandlerInterface {
|
|||
* @param \Drupal\views\ResultRow $values
|
||||
* An object containing all retrieved values.
|
||||
*
|
||||
* @return \Drupal\Core\Entity\EntityInterface
|
||||
* Returns the entity matching the values.
|
||||
* @return \Drupal\Core\Entity\EntityInterface|null
|
||||
* Returns the entity matching the values or NULL if there is no matching
|
||||
* entity.
|
||||
*/
|
||||
public function getEntity(ResultRow $values);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,4 +45,3 @@ interface MultiItemsFieldHandlerInterface extends FieldHandlerInterface {
|
|||
public function renderItems($items);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class Combine extends StringFilter {
|
|||
$separated_fields = array();
|
||||
foreach ($fields as $key => $field) {
|
||||
$separated_fields[] = $field;
|
||||
if ($key < $count-1) {
|
||||
if ($key < $count - 1) {
|
||||
$separated_fields[] = "' '";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -789,6 +789,17 @@ class Sql extends QueryPluginBase {
|
|||
* ensuring that all fields are fully qualified (TABLE.FIELD) and that
|
||||
* the table already exists in the query.
|
||||
*
|
||||
* The $field, $value and $operator arguments can also be passed in with a
|
||||
* single DatabaseCondition object, like this:
|
||||
* @code
|
||||
* $this->query->addWhere(
|
||||
* $this->options['group'],
|
||||
* db_or()
|
||||
* ->condition($field, $value, 'NOT IN')
|
||||
* ->condition($field, $value, 'IS NULL')
|
||||
* );
|
||||
* @endcode
|
||||
*
|
||||
* @param $group
|
||||
* The WHERE group to add these to; groups are used to create AND/OR
|
||||
* sections. Groups cannot be nested. Use 0 as the default group.
|
||||
|
|
@ -804,17 +815,6 @@ class Sql extends QueryPluginBase {
|
|||
* complex options such as IN, LIKE, LIKE BINARY, or BETWEEN. Defaults to =.
|
||||
* If $field is a string you have to use 'formula' here.
|
||||
*
|
||||
* The $field, $value and $operator arguments can also be passed in with a
|
||||
* single DatabaseCondition object, like this:
|
||||
* @code
|
||||
* $this->query->addWhere(
|
||||
* $this->options['group'],
|
||||
* db_or()
|
||||
* ->condition($field, $value, 'NOT IN')
|
||||
* ->condition($field, $value, 'IS NULL')
|
||||
* );
|
||||
* @endcode
|
||||
*
|
||||
* @see \Drupal\Core\Database\Query\ConditionInterface::condition()
|
||||
* @see \Drupal\Core\Database\Query\Condition
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -678,6 +678,7 @@ abstract class StylePluginBase extends PluginBase {
|
|||
$renderer = $this->getRenderer();
|
||||
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache_plugin */
|
||||
$cache_plugin = $this->view->display_handler->getPlugin('cache');
|
||||
$max_age = $cache_plugin->getCacheMaxAge();
|
||||
|
||||
/** @var \Drupal\views\ResultRow $row */
|
||||
foreach ($result as $index => $row) {
|
||||
|
|
@ -698,6 +699,7 @@ abstract class StylePluginBase extends PluginBase {
|
|||
'#cache' => [
|
||||
'keys' => $cache_plugin->getRowCacheKeys($row),
|
||||
'tags' => $cache_plugin->getRowCacheTags($row),
|
||||
'max-age' => $max_age,
|
||||
],
|
||||
'#cache_properties' => $field_ids,
|
||||
];
|
||||
|
|
|
|||
|
|
@ -59,13 +59,13 @@ class FieldEntityTranslationTest extends ViewTestBase {
|
|||
$node = Node::create([
|
||||
'type' => 'article',
|
||||
'title' => 'example EN',
|
||||
'sticky' => false,
|
||||
'sticky' => FALSE,
|
||||
]);
|
||||
$node->save();
|
||||
|
||||
$translation = $node->addTranslation('es');
|
||||
$translation->title->value = 'example ES';
|
||||
$translation->sticky->value = true;
|
||||
$translation->sticky->value = TRUE;
|
||||
$translation->save();
|
||||
|
||||
$this->drupalGet('test_entity_field_renderers/entity_translation');
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Drupal\views\Tests\Plugin;
|
||||
|
||||
use Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest as DisplayExtenderTestData;
|
||||
use Drupal\views\Views;
|
||||
|
||||
/**
|
||||
|
|
@ -38,7 +39,7 @@ class DisplayExtenderTest extends PluginTestBase {
|
|||
$this->assertEqual(count($view->display_handler->getExtenders()), 1, 'Make sure that only one extender is initialized.');
|
||||
|
||||
$display_extender = $view->display_handler->getExtenders()['display_extender_test'];
|
||||
$this->assertTrue($display_extender instanceof \Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest, 'Make sure the right class got initialized.');
|
||||
$this->assertTrue($display_extender instanceof DisplayExtenderTestData, 'Make sure the right class got initialized.');
|
||||
|
||||
$view->preExecute();
|
||||
$this->assertTrue($display_extender->testState['preExecute'], 'Make sure the display extender was able to react on preExecute.');
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ class ExposedFormTest extends ViewTestBase {
|
|||
$identifier = 'bad identifier';
|
||||
$view->displayHandlers->get('default')->overrideOption('filters', array(
|
||||
'type' => [
|
||||
'exposed' => TRUE,
|
||||
'exposed' => TRUE,
|
||||
'field' => 'type',
|
||||
'id' => 'type',
|
||||
'table' => 'node_field_data',
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\views\Tests;
|
||||
|
||||
use Drupal\config\Tests\SchemaCheckTestTrait;
|
||||
use Drupal\config_test\TestInstallStorage;
|
||||
use Drupal\Core\Config\InstallStorage;
|
||||
use Drupal\Core\Config\TypedConfigManager;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
|
||||
/**
|
||||
* Tests that test views provided by all modules match schema.
|
||||
*
|
||||
* @group config
|
||||
*/
|
||||
class TestViewsTest extends KernelTestBase {
|
||||
|
||||
use SchemaCheckTestTrait;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('views_test_data');
|
||||
|
||||
/**
|
||||
* Tests default configuration data type.
|
||||
*/
|
||||
public function testDefaultConfig() {
|
||||
// Create a typed config manager with access to configuration schema in
|
||||
// every module, profile and theme.
|
||||
$typed_config = new TypedConfigManager(
|
||||
\Drupal::service('config.storage'),
|
||||
new TestInstallStorage(InstallStorage::CONFIG_SCHEMA_DIRECTORY),
|
||||
\Drupal::service('cache.discovery'),
|
||||
\Drupal::service('module_handler')
|
||||
);
|
||||
|
||||
// Create a configuration storage with access to default configuration in
|
||||
// every module, profile and theme.
|
||||
$default_config_storage = new TestInstallStorage('test_views');
|
||||
|
||||
foreach ($default_config_storage->listAll() as $config_name) {
|
||||
// Skip files provided by the config_schema_test module since that module
|
||||
// is explicitly for testing schema.
|
||||
if (strpos($config_name, 'config_schema_test') === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data = $default_config_storage->read($config_name);
|
||||
$this->assertConfigSchema($typed_config, $config_name, $data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,29 +18,10 @@ class ViewElementTest extends ViewTestBase {
|
|||
*/
|
||||
public static $testViews = array('test_view_embed');
|
||||
|
||||
/**
|
||||
* The raw render data array to use in tests.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $render;
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->enableViewsTestModule();
|
||||
|
||||
// Set up a render array to use. We need to copy this as drupal_render
|
||||
// passes by reference.
|
||||
$this->render = array(
|
||||
'view' => array(
|
||||
'#type' => 'view',
|
||||
'#name' => 'test_view_embed',
|
||||
'#display_id' => 'default',
|
||||
'#arguments' => array(25),
|
||||
'#embed' => FALSE,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -50,10 +31,11 @@ class ViewElementTest extends ViewTestBase {
|
|||
/** @var \Drupal\Core\Render\RendererInterface $renderer */
|
||||
$renderer = $this->container->get('renderer');
|
||||
$view = Views::getView('test_view_embed');
|
||||
$view->setDisplay();
|
||||
|
||||
// Set the content as our rendered array.
|
||||
$render = $this->render;
|
||||
// Get the render array, #embed must be FALSE since this is the default
|
||||
// display.
|
||||
$render = $view->buildRenderable();
|
||||
$this->assertEqual($render['#embed'], FALSE);
|
||||
$this->setRawContent($renderer->renderRoot($render));
|
||||
|
||||
$xpath = $this->xpath('//div[@class="views-element-container"]');
|
||||
|
|
@ -98,7 +80,8 @@ class ViewElementTest extends ViewTestBase {
|
|||
$view->save();
|
||||
|
||||
// Test the render array again.
|
||||
$render = $this->render;
|
||||
$view = Views::getView('test_view_embed');
|
||||
$render = $view->buildRenderable(NULL, [25]);
|
||||
$this->setRawContent($renderer->renderRoot($render));
|
||||
// There should be 1 row in the results, 'John' arg 25.
|
||||
$xpath = $this->xpath('//div[@class="view-content"]/div');
|
||||
|
|
@ -118,11 +101,10 @@ class ViewElementTest extends ViewTestBase {
|
|||
/** @var \Drupal\Core\Render\RendererInterface $renderer */
|
||||
$renderer = $this->container->get('renderer');
|
||||
$view = Views::getView('test_view_embed');
|
||||
$view->setDisplay('embed_1');
|
||||
|
||||
// Set the content as our rendered array.
|
||||
$render = $this->render;
|
||||
$render['view']['#embed'] = TRUE;
|
||||
// Get the render array, #embed must be TRUE since this is an embed display.
|
||||
$render = $view->buildRenderable('embed_1');
|
||||
$this->assertEqual($render['#embed'], TRUE);
|
||||
$this->setRawContent($renderer->renderRoot($render));
|
||||
|
||||
$xpath = $this->xpath('//div[@class="views-element-container"]');
|
||||
|
|
@ -167,8 +149,8 @@ class ViewElementTest extends ViewTestBase {
|
|||
$view->save();
|
||||
|
||||
// Test the render array again.
|
||||
$render = $this->render;
|
||||
$render['view']['#embed'] = TRUE;
|
||||
$view = Views::getView('test_view_embed');
|
||||
$render = $view->buildRenderable('embed_1', [25]);
|
||||
$this->setRawContent($renderer->renderRoot($render));
|
||||
// There should be 1 row in the results, 'John' arg 25.
|
||||
$xpath = $this->xpath('//div[@class="view-content"]/div');
|
||||
|
|
@ -180,9 +162,8 @@ class ViewElementTest extends ViewTestBase {
|
|||
$this->assertEqual(count($xpath), 1);
|
||||
|
||||
// Tests the render array with an exposed filter.
|
||||
$render = $this->render;
|
||||
$render['view']['#display_id'] = 'embed_2';
|
||||
$render['view']['#embed'] = TRUE;
|
||||
$view = Views::getView('test_view_embed');
|
||||
$render = $view->buildRenderable('embed_2');
|
||||
$this->setRawContent($renderer->renderRoot($render));
|
||||
|
||||
// Ensure that the exposed form is rendered.
|
||||
|
|
|
|||
|
|
@ -2062,7 +2062,7 @@ class ViewExecutable implements \Serializable {
|
|||
|
||||
$result = $this->displayHandlers->get($id)->validate();
|
||||
if (!empty($result) && is_array($result)) {
|
||||
$errors[$id] = $result;
|
||||
$errors[$id] = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,4 +190,3 @@ class ViewsDataHelper {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue