Update to Drupal 8.0.1. For more information, see https://www.drupal.org/node/2627402
This commit is contained in:
parent
013aaaf2ff
commit
1a0e9d9fac
153 changed files with 1268 additions and 670 deletions
|
@ -136,13 +136,6 @@
|
|||
editor.addCommand('drupalunlink', {
|
||||
contextSensitive: 1,
|
||||
startDisabled: 1,
|
||||
allowedContent: {
|
||||
a: {
|
||||
attributes: {
|
||||
'!href': true
|
||||
}
|
||||
}
|
||||
},
|
||||
requiredContent: new CKEDITOR.style({
|
||||
element: 'a',
|
||||
attributes: {
|
||||
|
|
|
@ -14,6 +14,7 @@ use Drupal\Core\Entity\EntityTypeInterface;
|
|||
use Drupal\Core\Form\FormBase;
|
||||
use Drupal\Core\Form\FormState;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\StringTranslation\TranslatableMarkup;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
|
@ -169,8 +170,12 @@ class ConfigSingleExportForm extends FormBase {
|
|||
$entity_storage = $this->entityManager->getStorage($config_type);
|
||||
foreach ($entity_storage->loadMultiple() as $entity) {
|
||||
$entity_id = $entity->id();
|
||||
$label = $entity->label() ?: $entity_id;
|
||||
$names[$entity_id] = $label;
|
||||
if ($label = $entity->label()) {
|
||||
$names[$entity_id] = new TranslatableMarkup('@label (@id)', ['@label' => $label, '@id' => $entity_id]);
|
||||
}
|
||||
else {
|
||||
$names[$entity_id] = $entity_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Handle simple configuration.
|
||||
|
|
|
@ -23,7 +23,7 @@ class ConfigExportUITest extends WebTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('config', 'config_test', 'config_export_test');
|
||||
public static $modules = array('config', 'config_test');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -31,6 +31,13 @@ class ConfigExportUITest extends WebTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Set up an override.
|
||||
$settings['config']['system.maintenance']['message'] = (object) array(
|
||||
'value' => 'Foo',
|
||||
'required' => TRUE,
|
||||
);
|
||||
$this->writeSettings($settings);
|
||||
|
||||
$this->drupalLogin($this->drupalCreateUser(array('export configuration')));
|
||||
}
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ EOD;
|
|||
$this->assertFieldByXPath('//select[@name="config_type"]//option[@selected="selected"]', t('Date format'), 'The date format entity type is selected when specified in the URL.');
|
||||
|
||||
$this->drupalGet('admin/config/development/configuration/single/export/date_format/fallback');
|
||||
$this->assertFieldByXPath('//select[@name="config_name"]//option[@selected="selected"]', t('Fallback date format'), 'The fallback date format config entity is selected when specified in the URL.');
|
||||
$this->assertFieldByXPath('//select[@name="config_name"]//option[@selected="selected"]', t('Fallback date format (fallback)'), 'The fallback date format config entity is selected when specified in the URL.');
|
||||
|
||||
$fallback_date = \Drupal::entityManager()->getStorage('date_format')->load('fallback');
|
||||
$data = Yaml::encode($fallback_date->toArray());
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
name: 'Configuration export test'
|
||||
type: module
|
||||
package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provides config export testing support functionality.
|
||||
*/
|
||||
|
||||
// Override the system maintenance message for testing.
|
||||
$GLOBALS['config']['system.maintenance']['message'] = 'Foo';
|
|
@ -9,7 +9,6 @@
|
|||
* - translation: The translation for the target language.
|
||||
*
|
||||
* @see template_preprocess()
|
||||
* @see template_preprocess_config_translation_manage_form_element()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
|
|
|
@ -122,9 +122,9 @@
|
|||
break;
|
||||
|
||||
case 'activating':
|
||||
// When transformation filters have been been applied to the formatted
|
||||
// text of this field, then we'll need to load a re-formatted version
|
||||
// of it without the transformation filters.
|
||||
// When transformation filters have been applied to the formatted text
|
||||
// of this field, then we'll need to load a re-formatted version of it
|
||||
// without the transformation filters.
|
||||
if (this.textFormatHasTransformations) {
|
||||
var $textElement = this.$textElement;
|
||||
this._getUntransformedText(function (untransformedText) {
|
||||
|
|
|
@ -28,7 +28,7 @@ class EditorController extends ControllerBase {
|
|||
* @param \Drupal\Core\Entity\EntityInterface $entity
|
||||
* The entity of which a formatted text field is being rerendered.
|
||||
* @param string $field_name
|
||||
* The name of the (formatted text) field that that is being rerendered
|
||||
* The name of the (formatted text) field that is being rerendered
|
||||
* @param string $langcode
|
||||
* The name of the language for which the formatted text field is being
|
||||
* rerendered.
|
||||
|
|
|
@ -18,7 +18,7 @@ use Drupal\Core\Render\BubbleableMetadata;
|
|||
class Element {
|
||||
|
||||
/**
|
||||
* The Text Editor plugin manager manager service.
|
||||
* The Text Editor plugin manager service.
|
||||
*
|
||||
* @var \Drupal\Component\Plugin\PluginManagerInterface
|
||||
*/
|
||||
|
|
|
@ -68,7 +68,7 @@ function field_help($route_name, RouteMatchInterface $route_match) {
|
|||
$field_ui_url = \Drupal::moduleHandler()->moduleExists('field_ui') ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#';
|
||||
$output = '';
|
||||
$output .= '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('The Field module allows custom data fields to be defined for <em>entity</em> types (see below). The Field module takes care of storing, loading, editing, and rendering field data. Most users will not interact with the Field module directly, but will instead use the <a href=":field-ui-help">Field UI module</a> user interface. Module developers can use the Field API to make new entity types "fieldable" and thus allow fields to be attached to them. For more information, see the <a href=":field">online documentation for the Field module</a>.', array(':field-ui-help' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) :'#', ':field' => 'https://www.drupal.org/documentation/modules/field')). '</p>';
|
||||
$output .= '<p>' . t('The Field module allows custom data fields to be defined for <em>entity</em> types (see below). The Field module takes care of storing, loading, editing, and rendering field data. Most users will not interact with the Field module directly, but will instead use the <a href=":field-ui-help">Field UI module</a> user interface. Module developers can use the Field API to make new entity types "fieldable" and thus allow fields to be attached to them. For more information, see the <a href=":field">online documentation for the Field module</a>.', array(':field-ui-help' => $field_ui_url, ':field' => 'https://www.drupal.org/documentation/modules/field')). '</p>';
|
||||
$output .= '<h3>' . t('Terminology') . '</h3>';
|
||||
$output .= '<dl>';
|
||||
$output .= '<dt>' . t('Entities and entity types') . '</dt>';
|
||||
|
@ -133,7 +133,7 @@ function field_help($route_name, RouteMatchInterface $route_match) {
|
|||
$output .= '<li><p>' . t('<strong>Entity Reference</strong> fields allow you to create fields that contain links to other entities (such as content items, taxonomy terms, etc.) within the site. This allows you, for example, to include a link to a user within a content item. For more information, see <a href=":er_do">the online documentation for the Entity Reference module</a>.', array(':er_do' => 'https://drupal.org/documentation/modules/entityreference')) . '</p>';
|
||||
$output .= '<dl>';
|
||||
$output .= '<dt>' . t('Managing and displaying entity reference fields') . '</dt>';
|
||||
$output .= '<dd>' . t('The <em>settings</em> and the <em>display</em> of the entity reference field can be configured separately. See the <a href=":field_ui">Field UI help</a> for more information on how to manage fields and their display.', array(':field_ui' => \Drupal::url('help.page', array('name' => 'field_ui')))) . '</dd>';
|
||||
$output .= '<dd>' . t('The <em>settings</em> and the <em>display</em> of the entity reference field can be configured separately. See the <a href=":field_ui">Field UI help</a> for more information on how to manage fields and their display.', array(':field_ui' => $field_ui_url)) . '</dd>';
|
||||
$output .= '<dt>' . t('Selecting reference type') . '</dt>';
|
||||
$output .= '<dd>' . t('In the field settings you can select which entity type you want to create a reference to.') . '</dd>';
|
||||
$output .= '<dt>' . t('Filtering and sorting reference fields') . '</dt>';
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
namespace Drupal\field\Tests\EntityReference;
|
||||
|
||||
use Drupal\Core\Entity\Entity;
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
use Drupal\field_ui\Tests\FieldUiTestTrait;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
|
@ -235,7 +236,12 @@ class EntityReferenceAdminTest extends WebTestBase {
|
|||
'field_name' => $field_name,
|
||||
);
|
||||
$this->drupalPostForm($bundle_path . '/fields/add-field', $edit, t('Save and continue'));
|
||||
$this->drupalPostForm(NULL, array(), t('Save field settings'));
|
||||
|
||||
// Set to unlimited.
|
||||
$edit = array(
|
||||
'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
|
||||
);
|
||||
$this->drupalPostForm(NULL, $edit, t('Save field settings'));
|
||||
|
||||
// Add the view to the test field.
|
||||
$edit = array(
|
||||
|
@ -268,6 +274,17 @@ class EntityReferenceAdminTest extends WebTestBase {
|
|||
$this->assertRaw($node1->getTitle() . ' (' . $node1->id() . ')');
|
||||
$this->assertRaw($node2->getTitle() . ' (' . $node2->id() . ')');
|
||||
|
||||
// Try to add a new node, fill the entity reference field and submit the
|
||||
// form.
|
||||
$this->drupalPostForm('node/add/' . $this->type, [], t('Add another item'));
|
||||
$edit = array(
|
||||
'title[0][value]' => 'Example',
|
||||
'field_test_entity_ref_field[0][target_id]' => 'Foo Node (' . $node1->id() . ')',
|
||||
'field_test_entity_ref_field[1][target_id]' => 'Foo Node (' . $node2->id() . ')',
|
||||
);
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertResponse(200);
|
||||
|
||||
$edit = array(
|
||||
'title[0][value]' => 'Example',
|
||||
'field_test_entity_ref_field[0][target_id]' => 'Test'
|
||||
|
|
|
@ -85,11 +85,12 @@ class FieldUiTable extends Table {
|
|||
if ($depth = count($parents[$name])) {
|
||||
$children = Element::children($row);
|
||||
$cell = current($children);
|
||||
$row[$cell]['#prefix'] = [
|
||||
$indentation = [
|
||||
'#theme' => 'indentation',
|
||||
'#size' => $depth,
|
||||
'#suffix' => isset($row[$cell]['#prefix']) ? $row[$cell]['#prefix'] : '',
|
||||
];
|
||||
$row[$cell]['#prefix'] = \Drupal::service('renderer')->render($indentation);
|
||||
}
|
||||
|
||||
// Add row id and associate JS settings.
|
||||
|
|
45
core/modules/field_ui/src/Tests/FieldUIIndentationTest.php
Normal file
45
core/modules/field_ui/src/Tests/FieldUIIndentationTest.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\field_ui\Tests\FieldUIIndentationTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\field_ui\Tests;
|
||||
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
|
||||
/**
|
||||
* Tests indentation on Field UI.
|
||||
*
|
||||
* @group field_ui
|
||||
*/
|
||||
class FieldUIIndentationTest extends WebTestBase {
|
||||
|
||||
/**
|
||||
* Modules to install.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('node', 'field_ui', 'field_ui_test');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Create a test user.
|
||||
$admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer node display'));
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
// Create Basic page node type.
|
||||
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
|
||||
|
||||
}
|
||||
|
||||
function testIndentation() {
|
||||
$this->drupalGet('admin/structure/types/manage/page/display');
|
||||
$this->assertRaw('js-indentation indentation');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
name: 'Field UI test'
|
||||
type: module
|
||||
description: 'Support module for Field UI tests.'
|
||||
core: 8.x
|
||||
package: Testing
|
||||
version: VERSION
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Field UI test module.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Render\Element;
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_BASE_ID_alter().
|
||||
*/
|
||||
function field_ui_test_form_entity_view_display_edit_form_alter(&$form, FormStateInterface $form_state) {
|
||||
$table = &$form['fields'];
|
||||
|
||||
foreach (Element::children($table) as $name) {
|
||||
$table[$name]['parent_wrapper']['parent']['#options'] = array('indent' => 'Indent');
|
||||
$table[$name]['parent_wrapper']['parent']['#default_value'] = 'indent';
|
||||
}
|
||||
|
||||
$table['indent'] = [
|
||||
'#attributes' => array('class' => array('draggable', 'field-group'), 'id' => 'indent-id'),
|
||||
'#row_type' => 'group',
|
||||
'#region_callback' => 'field_ui_test_region_callback',
|
||||
'#js_settings' => array('rowHandler' => 'group'),
|
||||
'human_name' => array(
|
||||
'#markup' => 'Indent',
|
||||
'#prefix' => '<span class="group-label">',
|
||||
'#suffix' => '</span>',
|
||||
),
|
||||
'weight' => array(
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => 0,
|
||||
'#size' => 3,
|
||||
'#attributes' => array('class' => array('field-weight')),
|
||||
),
|
||||
'parent_wrapper' => array(
|
||||
'parent' => array(
|
||||
'#type' => 'select',
|
||||
'#options' => array('indent' => 'Indent'),
|
||||
'#empty_value' => '',
|
||||
'#default_value' => '',
|
||||
'#attributes' => array('class' => array('field-parent')),
|
||||
'#parents' => array('fields', 'indent', 'parent'),
|
||||
),
|
||||
'hidden_name' => array(
|
||||
'#type' => 'hidden',
|
||||
'#default_value' => 'indent',
|
||||
'#attributes' => array('class' => array('field-name')),
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
function field_ui_test_region_callback($row) {
|
||||
return 'content';
|
||||
}
|
|
@ -338,19 +338,19 @@ class FilterFormat extends ConfigEntityBase implements FilterFormatInterface, En
|
|||
continue;
|
||||
}
|
||||
// The new filter allows less attributes (all -> list or none).
|
||||
else if (!is_array($current_attributes) && $current_attributes == TRUE && ($new_attributes == FALSE || is_array($new_attributes))) {
|
||||
elseif (!is_array($current_attributes) && $current_attributes == TRUE && ($new_attributes == FALSE || is_array($new_attributes))) {
|
||||
$intersection[$tag] = $new_attributes;
|
||||
}
|
||||
// The new filter allows less attributes (list -> none).
|
||||
else if (is_array($current_attributes) && $new_attributes == FALSE) {
|
||||
elseif (is_array($current_attributes) && $new_attributes == FALSE) {
|
||||
$intersection[$tag] = $new_attributes;
|
||||
}
|
||||
// The new filter allows more attributes; retain current.
|
||||
else if (is_array($current_attributes) && $new_attributes == TRUE) {
|
||||
elseif (is_array($current_attributes) && $new_attributes == TRUE) {
|
||||
continue;
|
||||
}
|
||||
// The new filter allows the same attributes; retain current.
|
||||
else if ($current_attributes == $new_attributes) {
|
||||
elseif ($current_attributes == $new_attributes) {
|
||||
continue;
|
||||
}
|
||||
// Both list an array of attribute values; do an intersection,
|
||||
|
|
|
@ -346,6 +346,7 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
$alt = $this->randomString(512);
|
||||
$title = $this->randomString(1024);
|
||||
$edit = array(
|
||||
// Get the path of the 'image-test.png' file.
|
||||
'files[settings_default_image_uuid]' => drupal_realpath($images[0]->uri),
|
||||
'settings[default_image][alt]' => $alt,
|
||||
'settings[default_image][title]' => $title,
|
||||
|
@ -378,7 +379,8 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
// Create alt text for the image.
|
||||
$alt = $this->randomMachineName();
|
||||
|
||||
$nid = $this->uploadNodeImage($images[1], $field_name, 'article', $alt);
|
||||
// Upload the 'image-test.gif' file.
|
||||
$nid = $this->uploadNodeImage($images[2], $field_name, 'article', $alt);
|
||||
$node_storage->resetCache(array($nid));
|
||||
$node = $node_storage->load($nid);
|
||||
$file = $node->{$field_name}->entity;
|
||||
|
@ -413,7 +415,8 @@ class ImageFieldDisplayTest extends ImageFieldTestBase {
|
|||
$this->createImageField($private_field_name, 'article', array('uri_scheme' => 'private'));
|
||||
// Add a default image to the new field.
|
||||
$edit = array(
|
||||
'files[settings_default_image_uuid]' => drupal_realpath($images[1]->uri),
|
||||
// Get the path of the 'image-test.gif' file.
|
||||
'files[settings_default_image_uuid]' => drupal_realpath($images[2]->uri),
|
||||
'settings[default_image][alt]' => $alt,
|
||||
'settings[default_image][title]' => $title,
|
||||
);
|
||||
|
|
|
@ -311,8 +311,13 @@ function language_negotiation_url_domains() {
|
|||
*/
|
||||
function language_modules_installed($modules) {
|
||||
if (!in_array('language', $modules)) {
|
||||
// Since newly (un)installed modules may change the default settings for
|
||||
// non-locked language types (e.g. content language), we need to resave the
|
||||
// language type configuration.
|
||||
/** @var \Drupal\language\LanguageNegotiatorInterface $negotiator */
|
||||
$negotiator = \Drupal::service('language_negotiator');
|
||||
$negotiator->updateConfiguration(array());
|
||||
$configurable = \Drupal::config('language.types')->get('configurable');
|
||||
$negotiator->updateConfiguration($configurable);
|
||||
$negotiator->purgeConfiguration();
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -181,8 +181,8 @@ class LanguageNegotiationContentEntity extends LanguageNegotiationMethodBase imp
|
|||
* \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationContentEntity::processOutbound().
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the the content entity language negotiator has higher priority
|
||||
* than the url language negotiator, FALSE otherwise.
|
||||
* TRUE if the content entity language negotiator has higher priority than
|
||||
* the url language negotiator, FALSE otherwise.
|
||||
*/
|
||||
protected function hasLowerLanguageNegotiationWeight() {
|
||||
if (!isset($this->hasLowerLanguageNegotiationWeightResult)) {
|
||||
|
|
|
@ -23,14 +23,14 @@ class LanguageNegotiationInfoTest extends WebTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('language');
|
||||
public static $modules = ['language', 'content_translation'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages', 'view the administration theme'));
|
||||
$admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages', 'view the administration theme', 'administer modules']);
|
||||
$this->drupalLogin($admin_user);
|
||||
$this->drupalPostForm('admin/config/regional/language/add', array('predefined_langcode' => 'it'), t('Add language'));
|
||||
}
|
||||
|
@ -174,4 +174,41 @@ class LanguageNegotiationInfoTest extends WebTestBase {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests altering config of configurable language types.
|
||||
*/
|
||||
public function testConfigLangTypeAlterations() {
|
||||
// Default of config.
|
||||
$test_type = LanguageInterface::TYPE_CONTENT;
|
||||
$this->assertFalse($this->isLanguageTypeConfigurable($test_type), 'Language type is not configurable.');
|
||||
|
||||
// Editing config.
|
||||
$edit = [$test_type . '[configurable]' => TRUE];
|
||||
$this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
|
||||
$this->assertTrue($this->isLanguageTypeConfigurable($test_type), 'Language type is now configurable.');
|
||||
|
||||
// After installing another module, the config should be the same.
|
||||
$this->drupalPostForm('admin/modules', ['modules[Testing][test_module][enable]' => 1], t('Install'));
|
||||
$this->assertTrue($this->isLanguageTypeConfigurable($test_type), 'Language type is still configurable.');
|
||||
|
||||
// After uninstalling the other module, the config should be the same.
|
||||
$this->drupalPostForm('admin/modules/uninstall', ['uninstall[test_module]' => 1], t('Uninstall'));
|
||||
$this->assertTrue($this->isLanguageTypeConfigurable($test_type), 'Language type is still configurable.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given language type is configurable.
|
||||
*
|
||||
* @param string $type
|
||||
* The language type.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the specified language type is configurable, FALSE otherwise.
|
||||
*/
|
||||
protected function isLanguageTypeConfigurable($type) {
|
||||
$configurable_types = $this->config('language.types')->get('configurable');
|
||||
return in_array($type, $configurable_types);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
name: 'Test Module'
|
||||
type: module
|
||||
description: 'Support module for testing.'
|
||||
package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
namespace Drupal\locale;
|
||||
|
||||
use Drupal\Core\Config\InstallStorage;
|
||||
use Drupal\Core\Config\ExtensionInstallStorage;
|
||||
use Drupal\Core\Config\StorageInterface;
|
||||
use Drupal\language\ConfigurableLanguageManagerInterface;
|
||||
|
||||
|
@ -66,8 +66,8 @@ class LocaleDefaultConfigStorage {
|
|||
$this->configStorage = $config_storage;
|
||||
$this->languageManager = $language_manager;
|
||||
|
||||
$this->requiredInstallStorage = new InstallStorage();
|
||||
$this->optionalInstallStorage = new InstallStorage(InstallStorage::CONFIG_OPTIONAL_DIRECTORY);
|
||||
$this->requiredInstallStorage = new ExtensionInstallStorage($this->configStorage);
|
||||
$this->optionalInstallStorage = new ExtensionInstallStorage($this->configStorage, ExtensionInstallStorage::CONFIG_OPTIONAL_DIRECTORY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -61,4 +61,17 @@ class LocaleConfigManagerTest extends KernelTestBase {
|
|||
$this->assertFalse($translation_after->isNew());
|
||||
$translation_after->setString('updated_translation')->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests getDefaultConfigLangcode().
|
||||
*/
|
||||
public function testGetDefaultConfigLangcode() {
|
||||
// Install the Language module's configuration so we can use the
|
||||
// module_installer service.
|
||||
$this->installConfig(['language']);
|
||||
$this->assertNull(\Drupal::service('locale.config_manager')->getDefaultConfigLangcode('locale_test_translate.settings'), 'Before installing a module the locale config manager can not access the shipped configuration.');
|
||||
\Drupal::service('module_installer')->install(['locale_test_translate']);
|
||||
$this->assertEqual('en', \Drupal::service('locale.config_manager')->getDefaultConfigLangcode('locale_test_translate.settings'), 'After installing a module the locale config manager can get the shipped configuration langcode.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,13 @@ use Drupal\simpletest\WebTestBase;
|
|||
*/
|
||||
class LocalePluralFormatTest extends WebTestBase {
|
||||
|
||||
/**
|
||||
* An admin user.
|
||||
*
|
||||
* @var \Drupal\user\Entity\User
|
||||
*/
|
||||
protected $adminUser;
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
|
@ -30,8 +37,8 @@ class LocalePluralFormatTest extends WebTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$admin_user = $this->drupalCreateUser(array('administer languages', 'translate interface', 'access administration pages'));
|
||||
$this->drupalLogin($admin_user);
|
||||
$this->adminUser = $this->drupalCreateUser(array('administer languages', 'translate interface', 'access administration pages'));
|
||||
$this->drupalLogin($this->adminUser);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,7 +165,10 @@ class LocalePluralFormatTest extends WebTestBase {
|
|||
// Set French as the site default language.
|
||||
$this->config('system.site')->set('default_langcode', 'fr')->save();
|
||||
|
||||
// Visit User Info page before updating translation strings.
|
||||
// Visit User Info page before updating translation strings. Change the
|
||||
// created time to ensure that the we're dealing in seconds and it can't be
|
||||
// exactly 1 minute.
|
||||
$this->adminUser->set('created', time() - 1)->save();
|
||||
$this->drupalGet('user');
|
||||
|
||||
// Member for time should be translated.
|
||||
|
@ -199,9 +209,12 @@ class LocalePluralFormatTest extends WebTestBase {
|
|||
// User interface input for translating seconds should not be duplicated
|
||||
$this->assertUniqueText('@count seconds', 'Interface translation input for @count seconds only appears once.');
|
||||
|
||||
// Member for time should be translated.
|
||||
// Member for time should be translated. Change the created time to ensure
|
||||
// that the we're dealing in multiple seconds and it can't be exactly 1
|
||||
// second or minute.
|
||||
$this->adminUser->set('created', time() - 2)->save();
|
||||
$this->drupalGet('user');
|
||||
$this->assertText("seconde", "'Member for' text is translated.");
|
||||
$this->assertText("secondes updated", "'Member for' text is translated.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -102,7 +102,7 @@ function shortcut_set_switch_access($account = NULL) {
|
|||
if (!isset($account)) {
|
||||
return AccessResult::allowed()->cachePerPermissions();
|
||||
}
|
||||
else if ($user->id() == $account->id()) {
|
||||
elseif ($user->id() == $account->id()) {
|
||||
return AccessResult::allowed()->cachePerPermissions()->cachePerUser();
|
||||
}
|
||||
|
||||
|
|
BIN
core/modules/simpletest/files/image-test-transparent-indexed.gif
Normal file
BIN
core/modules/simpletest/files/image-test-transparent-indexed.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 140 B |
|
@ -220,23 +220,23 @@ trait AssertContentTrait {
|
|||
* placeholders in the query. The values may be either strings or numeric
|
||||
* values.
|
||||
*
|
||||
* @return array
|
||||
* The return value of the xpath search. For details on the xpath string
|
||||
* format and return values see the SimpleXML documentation,
|
||||
* http://php.net/manual/function.simplexml-element-xpath.php.
|
||||
* @return \SimpleXMLElement[]|bool
|
||||
* The return value of the xpath search or FALSE on failure. For details on
|
||||
* the xpath string format and return values see the SimpleXML
|
||||
* documentation.
|
||||
*
|
||||
* @see http://php.net/manual/function.simplexml-element-xpath.php
|
||||
*/
|
||||
protected function xpath($xpath, array $arguments = array()) {
|
||||
protected function xpath($xpath, array $arguments = []) {
|
||||
if ($this->parse()) {
|
||||
$xpath = $this->buildXPathQuery($xpath, $arguments);
|
||||
$result = $this->elements->xpath($xpath);
|
||||
// Some combinations of PHP / libxml versions return an empty array
|
||||
// instead of the documented FALSE. Forcefully convert any falsish values
|
||||
// to an empty array to allow foreach(...) constructions.
|
||||
return $result ? $result : array();
|
||||
}
|
||||
else {
|
||||
return FALSE;
|
||||
return $result ?: [];
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2970,7 +2970,7 @@ abstract class WebTestBase extends TestBase {
|
|||
}
|
||||
// The URL generator service is not necessarily available yet; e.g., in
|
||||
// interactive installer tests.
|
||||
else if ($this->container->has('url_generator')) {
|
||||
elseif ($this->container->has('url_generator')) {
|
||||
$force_internal = isset($options['external']) && $options['external'] == FALSE;
|
||||
if (!$force_internal && UrlHelper::isExternal($path)) {
|
||||
return Url::fromUri($path, $options)->toString();
|
||||
|
|
|
@ -107,12 +107,12 @@ class CreateNew extends GDImageToolkitOperationBase {
|
|||
|
||||
case IMAGETYPE_GIF:
|
||||
if (empty($arguments['transparent_color'])) {
|
||||
// No transparency color specified, fill white.
|
||||
$fill_color = imagecolorallocate($res, 255, 255, 255);
|
||||
// No transparency color specified, fill white transparent.
|
||||
$fill_color = imagecolorallocatealpha($res, 255, 255, 255, 127);
|
||||
}
|
||||
else {
|
||||
$fill_rgb = Color::hexToRgb($arguments['transparent_color']);
|
||||
$fill_color = imagecolorallocate($res, $fill_rgb['red'], $fill_rgb['green'], $fill_rgb['blue']);
|
||||
$fill_color = imagecolorallocatealpha($res, $fill_rgb['red'], $fill_rgb['green'], $fill_rgb['blue'], 127);
|
||||
imagecolortransparent($res, $fill_color);
|
||||
}
|
||||
imagefill($res, 0, 0, $fill_color);
|
||||
|
|
|
@ -465,7 +465,7 @@ class BulkForm extends FieldPluginBase implements CacheableDependencyInterface {
|
|||
}
|
||||
|
||||
// An entity ID could be an arbitrary string (although they are typically
|
||||
// numeric). JSON then Base64 encoding ensures the the bulk_form_key is
|
||||
// numeric). JSON then Base64 encoding ensures the bulk_form_key is
|
||||
// safe to use in HTML, and that the key parts can be retrieved.
|
||||
$key = json_encode($key_parts);
|
||||
return base64_encode($key);
|
||||
|
|
|
@ -83,7 +83,7 @@ class FieldModuleUninstallValidatorTest extends EntityUnitTestBase {
|
|||
}
|
||||
catch (ModuleUninstallValidatorException $e) {
|
||||
$this->pass($message);
|
||||
$this->assertEqual($e->getMessage(), 'The following reasons prevents the modules from being uninstalled: There is data for the field extra_base_field on entity type Test entity');
|
||||
$this->assertEqual($e->getMessage(), 'The following reasons prevent the modules from being uninstalled: There is data for the field extra_base_field on entity type Test entity');
|
||||
}
|
||||
|
||||
// Verify uninstalling entity_test is not possible when there is content for
|
||||
|
|
|
@ -271,13 +271,6 @@ class ToolkitGdTest extends KernelTestBase {
|
|||
$image_truecolor = imageistruecolor($toolkit->getResource());
|
||||
$this->assertTrue($image_truecolor, SafeMarkup::format('Image %file after load is a truecolor image.', array('%file' => $file)));
|
||||
|
||||
if ($image->getToolkit()->getType() == IMAGETYPE_GIF) {
|
||||
if ($op == 'desaturate') {
|
||||
// Transparent GIFs and the imagefilter function don't work together.
|
||||
$values['corners'][3][3] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Store the original GD resource.
|
||||
$old_res = $toolkit->getResource();
|
||||
|
||||
|
@ -330,11 +323,21 @@ class ToolkitGdTest extends KernelTestBase {
|
|||
if ($image->getToolkit()->getType() != IMAGETYPE_JPEG && $image_original_type != IMAGETYPE_JPEG) {
|
||||
// Now check each of the corners to ensure color correctness.
|
||||
foreach ($values['corners'] as $key => $corner) {
|
||||
// The test gif that does not have transparency has yellow where the
|
||||
// others have transparent.
|
||||
if ($file === 'image-test-no-transparency.gif' && $corner === $this->transparent) {
|
||||
$corner = $this->yellow;
|
||||
// The test gif that does not have transparency color set is a
|
||||
// special case.
|
||||
if ($file === 'image-test-no-transparency.gif') {
|
||||
if ($op == 'desaturate') {
|
||||
// For desaturating, keep the expected color from the test
|
||||
// data, but set alpha channel to fully opaque.
|
||||
$corner[3] = 0;
|
||||
}
|
||||
elseif ($corner === $this->transparent) {
|
||||
// Set expected pixel to yellow where the others have
|
||||
// transparent.
|
||||
$corner = $this->yellow;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the location of the corner.
|
||||
switch ($key) {
|
||||
case 0:
|
||||
|
@ -436,9 +439,46 @@ class ToolkitGdTest extends KernelTestBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests loading an image whose transparent color index is out of range.
|
||||
* Tests for GIF images with transparency.
|
||||
*/
|
||||
function testTransparentColorOutOfRange() {
|
||||
function testGifTransparentImages() {
|
||||
// Prepare a directory for test file results.
|
||||
$directory = $this->publicFilesDirectory .'/imagetest';
|
||||
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
|
||||
|
||||
// Test loading an indexed GIF image with transparent color set.
|
||||
// Color at top-right pixel should be fully transparent.
|
||||
$file = 'image-test-transparent-indexed.gif';
|
||||
$image = $this->imageFactory->get(drupal_get_path('module', 'simpletest') . '/files/' . $file);
|
||||
$resource = $image->getToolkit()->getResource();
|
||||
$color_index = imagecolorat($resource, $image->getWidth() - 1, 0);
|
||||
$color = array_values(imagecolorsforindex($resource, $color_index));
|
||||
$this->assertEqual($this->rotateTransparent, $color, "Image {$file} after load has full transparent color at corner 1.");
|
||||
|
||||
// Test deliberately creating a GIF image with no transparent color set.
|
||||
// Color at top-right pixel should be fully transparent while in memory,
|
||||
// fully opaque after flushing image to file.
|
||||
$file = 'image-test-no-transparent-color-set.gif';
|
||||
$file_path = $directory . '/' . $file ;
|
||||
// Create image.
|
||||
$image = $this->imageFactory->get();
|
||||
$image->createNew(50, 20, 'gif', NULL);
|
||||
$resource = $image->getToolkit()->getResource();
|
||||
$color_index = imagecolorat($resource, $image->getWidth() - 1, 0);
|
||||
$color = array_values(imagecolorsforindex($resource, $color_index));
|
||||
$this->assertEqual($this->rotateTransparent, $color, "New GIF image with no transparent color set after creation has full transparent color at corner 1.");
|
||||
// Save image.
|
||||
$this->assertTrue($image->save($file_path), "New GIF image {$file} was saved.");
|
||||
// Reload image.
|
||||
$image_reloaded = $this->imageFactory->get($file_path);
|
||||
$resource = $image_reloaded->getToolkit()->getResource();
|
||||
$color_index = imagecolorat($resource, $image_reloaded->getWidth() - 1, 0);
|
||||
$color = array_values(imagecolorsforindex($resource, $color_index));
|
||||
// Check explicitly for alpha == 0 as the rest of the color has been
|
||||
// compressed and may have slight difference from full white.
|
||||
$this->assertEqual(0, $color[3], "New GIF image {$file} after reload has no transparent color at corner 1.");
|
||||
|
||||
// Test loading an image whose transparent color index is out of range.
|
||||
// This image was generated by taking an initial image with a palette size
|
||||
// of 6 colors, and setting the transparent color index to 6 (one higher
|
||||
// than the largest allowed index), as follows:
|
||||
|
|
|
@ -133,6 +133,15 @@ class RouteProviderTest extends KernelTestBase {
|
|||
$this->assertTrue(array_key_exists('/node', $candidates), 'Seventh candidate found.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't fail when given an empty path.
|
||||
*/
|
||||
public function testEmptyPathCandidatesOutlines() {
|
||||
$provider = new TestRouteProvider(Database::getConnection(), $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes');
|
||||
$candidates = $provider->getCandidateOutlines([]);
|
||||
$this->assertEqual(count($candidates), 0, 'Empty parts should return no candidates.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirms that we can find routes with the exact incoming path.
|
||||
*/
|
||||
|
|
|
@ -256,7 +256,7 @@ msgid "I have context."
|
|||
msgstr "I HAZ KONTEX."
|
||||
EOF;
|
||||
}
|
||||
else if ($langcode === 'zz') {
|
||||
elseif ($langcode === 'zz') {
|
||||
return <<< EOF
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
namespace Drupal\system\Tests\Update;
|
||||
|
||||
/**
|
||||
* Tests the upgrade path for local actions/tasks being converted into blocks.
|
||||
*
|
||||
* @see https://www.drupal.org/node/507488
|
||||
* Tests the upgrade path for page site variables being converted into a block.
|
||||
*
|
||||
* @group system
|
||||
*/
|
||||
|
|
|
@ -99,18 +99,18 @@ function system_requirements($phase) {
|
|||
if ($matches[1] < 2) {
|
||||
$rewrite_error = TRUE;
|
||||
}
|
||||
else if ($matches[1] == 2) {
|
||||
elseif ($matches[1] == 2) {
|
||||
if (!isset($matches[2])) {
|
||||
$rewrite_warning = TRUE;
|
||||
}
|
||||
else if ($matches[2] < 2) {
|
||||
elseif ($matches[2] < 2) {
|
||||
$rewrite_error = TRUE;
|
||||
}
|
||||
else if ($matches[2] == 2) {
|
||||
elseif ($matches[2] == 2) {
|
||||
if (!isset($matches[3])) {
|
||||
$rewrite_warning = TRUE;
|
||||
}
|
||||
else if ($matches[3] < 16) {
|
||||
elseif ($matches[3] < 16) {
|
||||
$rewrite_error = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -646,10 +646,21 @@ function system_requirements($phase) {
|
|||
'value' => t('Up to date'),
|
||||
];
|
||||
// Verify that no entity updates are pending.
|
||||
if (\Drupal::entityDefinitionUpdateManager()->needsUpdates()) {
|
||||
if ($change_list = \Drupal::entityDefinitionUpdateManager()->getChangeSummary()) {
|
||||
$build = [];
|
||||
foreach ($change_list as $entity_type_id => $changes) {
|
||||
$entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);
|
||||
$build[] = [
|
||||
'#theme' => 'item_list',
|
||||
'#title' => $entity_type->getLabel(),
|
||||
'#items' => $changes,
|
||||
];
|
||||
}
|
||||
|
||||
$entity_update_issues = \Drupal::service('renderer')->render($build);
|
||||
$requirements['entity_update']['severity'] = REQUIREMENT_ERROR;
|
||||
// @todo Provide details: https://www.drupal.org/node/2554911
|
||||
$requirements['entity_update']['value'] = t('Mismatched entity and/or field definitions');
|
||||
$requirements['entity_update']['description'] = t('The following changes were detected in the entity type and field definitions. @updates', ['@updates' => $entity_update_issues]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* - children: Contains the child elements of the dropbutton menu.
|
||||
*
|
||||
* @see template_preprocess()
|
||||
* @see template_preprocess_dropbutton_wrapper()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
*
|
||||
* Each item in these variables (primary and secondary) can be individually
|
||||
* themed in menu-local-task.html.twig.
|
||||
*
|
||||
* @see template_preprocess_menu_local_tasks()
|
||||
*
|
||||
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
* - title_suffix: Additional output populated by modules, intended to be
|
||||
* displayed after the main title tag that appears in the template.
|
||||
*
|
||||
* @see template_preprocess_page_title()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
|
|
|
@ -19,11 +19,6 @@
|
|||
* Site identity:
|
||||
* - front_page: The URL of the front page. Use this instead of base_path when
|
||||
* linking to the front page. This includes the language domain or prefix.
|
||||
* - logo: The url of the logo image, as defined in theme settings.
|
||||
* - site_name: The name of the site. This is empty when displaying the site
|
||||
* name has been disabled in the theme settings.
|
||||
* - site_slogan: The slogan of the site. This is empty when displaying the site
|
||||
* slogan has been disabled in theme settings.
|
||||
*
|
||||
* Page content (in order of occurrence in the default page.html.twig):
|
||||
* - messages: Status and error messages. Should be displayed prominently.
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
* - attributes: HTML attributes for the element, including:
|
||||
* - class: HTML classes.
|
||||
*
|
||||
* @see template_preprocess_status_messages()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
*
|
||||
* This template will be used when a system config form specifies 'config_form'
|
||||
* as its #theme callback. Otherwise, by default, system config forms will be
|
||||
* themed by theme_form(). This does not alter the appearance of a form at all,
|
||||
* but is provided as a convenience for themers.
|
||||
* themed by form.html.twig. This does not alter the appearance of a form at
|
||||
* all, but is provided as a convenience for themers.
|
||||
*
|
||||
* Available variables:
|
||||
* - form: The confirm form.
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* Available variables:
|
||||
* - style: Either 'asc' or 'desc', indicating the sorting direction.
|
||||
*
|
||||
* @see template_preprocess_tablesort_indicator()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
|
|
|
@ -61,32 +61,6 @@ function module_test_hook_info() {
|
|||
return $hooks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Page callback for 'hook dynamic loading' test.
|
||||
*
|
||||
* If the hook is dynamically loaded correctly, the menu callback should
|
||||
* return 'success!'.
|
||||
*
|
||||
* @deprecated \Drupal\module_test\Controller\ModuleTestController::hookDynamicLoadingInvoke()
|
||||
*/
|
||||
function module_test_hook_dynamic_loading_invoke() {
|
||||
$result = \Drupal::moduleHandler()->invoke('module_test', 'test_hook');
|
||||
return $result['module_test'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Page callback for 'hook dynamic loading' test.
|
||||
*
|
||||
* If the hook is dynamically loaded correctly, the menu callback should
|
||||
* return 'success!'.
|
||||
*
|
||||
* @deprecated \Drupal\module_test\Controller\ModuleTestController::hookDynamicLoadingInvokeAll()
|
||||
*/
|
||||
function module_test_hook_dynamic_loading_invoke_all() {
|
||||
$result = \Drupal::moduleHandler()->invokeAll('test_hook');
|
||||
return $result['module_test'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Load function used by module_test_hook_dynamic_loading_invoke_all_during_load().
|
||||
*
|
||||
|
@ -97,23 +71,6 @@ function module_test_load($param) {
|
|||
return $result[$param];
|
||||
}
|
||||
|
||||
/**
|
||||
* Page callback for 'class loading' test.
|
||||
*
|
||||
* This module does not have a dependency on module_autoload_test.module. If
|
||||
* that module is enabled, this function should return the string
|
||||
* 'Drupal\\module_autoload_test\\SomeClass::testMethod() was invoked.'. If
|
||||
* that module is not enabled, this function should return nothing.
|
||||
*
|
||||
* @deprecated \Drupal\module_test\Controller\ModuleTestController::testClassLoading()
|
||||
*/
|
||||
function module_test_class_loading() {
|
||||
if (class_exists('Drupal\module_autoload_test\SomeClass')) {
|
||||
$obj = new Drupal\module_autoload_test\SomeClass();
|
||||
return $obj->testMethod();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_modules_installed().
|
||||
*/
|
||||
|
|
|
@ -13,24 +13,40 @@ namespace Drupal\module_test\Controller;
|
|||
class ModuleTestController {
|
||||
|
||||
/**
|
||||
* @todo Remove module_test_hook_dynamic_loading_invoke().
|
||||
* Returns dynamically invoked hook results for the 'module_test' module
|
||||
*
|
||||
* @return array
|
||||
* Renderable array.
|
||||
*/
|
||||
public function hookDynamicLoadingInvoke() {
|
||||
return module_test_hook_dynamic_loading_invoke();
|
||||
$result = \Drupal::moduleHandler()->invoke('module_test', 'test_hook');
|
||||
return $result['module_test'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Remove module_test_hook_dynamic_loading_invoke_all().
|
||||
* Returns dynamically invoked hook results for all modules.
|
||||
*
|
||||
* @return array
|
||||
* Renderable array.
|
||||
*/
|
||||
public function hookDynamicLoadingInvokeAll() {
|
||||
return module_test_hook_dynamic_loading_invoke_all();
|
||||
$result = \Drupal::moduleHandler()->invokeAll('test_hook');
|
||||
return $result['module_test'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Remove module_test_class_loading().
|
||||
* Returns the result of an autoloaded class's public method.
|
||||
*
|
||||
* @return array
|
||||
* Renderable array.
|
||||
*/
|
||||
public function testClassLoading() {
|
||||
return ['#markup' => module_test_class_loading()];
|
||||
$markup = NULL;
|
||||
if (class_exists('Drupal\module_autoload_test\SomeClass')) {
|
||||
$obj = new \Drupal\module_autoload_test\SomeClass();
|
||||
$markup = $obj->testMethod();
|
||||
}
|
||||
return ['#markup' => $markup];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
use Drupal\Core\Extension\Extension;
|
||||
|
||||
/**
|
||||
* Implements hook_init().
|
||||
* Includes .theme file from themes.
|
||||
*
|
||||
* @param \Drupal\Core\Extension\Extension $theme
|
||||
* The theme extension object.
|
||||
*/
|
||||
function nyan_cat_init(Extension $theme) {
|
||||
$theme->load();
|
||||
|
|
|
@ -58,7 +58,7 @@ abstract class TourTestBase extends WebTestBase {
|
|||
$elements = \PHPUnit_Util_XML::cssSelect('#' . $tip['data-id'], TRUE, $this->content, TRUE);
|
||||
$this->assertTrue(!empty($elements) && count($elements) === 1, format_string('Found corresponding page element for tour tip with id #%data-id', array('%data-id' => $tip['data-id'])));
|
||||
}
|
||||
else if (!empty($tip['data-class'])) {
|
||||
elseif (!empty($tip['data-class'])) {
|
||||
$elements = \PHPUnit_Util_XML::cssSelect('.' . $tip['data-class'], TRUE, $this->content, TRUE);
|
||||
$this->assertFalse(empty($elements), format_string('Found corresponding page element for tour tip with class .%data-class', array('%data-class' => $tip['data-class'])));
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
* - download_link: The URL for the downloadable file.
|
||||
* - release_link: The URL for the release notes.
|
||||
*
|
||||
* @see template_preprocess_update_version()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
|
|
|
@ -44,7 +44,7 @@ class UserAccessControlHandler extends EntityAccessControlHandler {
|
|||
return AccessResult::allowed()->cachePerPermissions()->cacheUntilEntityChanges($entity);
|
||||
}
|
||||
// Users can view own profiles at all times.
|
||||
else if ($account->id() == $entity->id()) {
|
||||
elseif ($account->id() == $entity->id()) {
|
||||
return AccessResult::allowed()->cachePerUser();
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -8,14 +8,6 @@ views.argument_default.fixed:
|
|||
type: string
|
||||
label: 'Fixed value'
|
||||
|
||||
views.argument_default.php:
|
||||
type: mapping
|
||||
label: 'PHP Code'
|
||||
mapping:
|
||||
code:
|
||||
type: string
|
||||
label: 'PHP contextual filter code'
|
||||
|
||||
views.argument_default.raw:
|
||||
type: mapping
|
||||
label: 'Raw value from URL'
|
||||
|
|
|
@ -94,7 +94,7 @@ views.style.table:
|
|||
label: 'Enable Drupal style "sticky" table headers (Javascript)'
|
||||
summary:
|
||||
type: label
|
||||
label: 'Table summary'
|
||||
label: 'Summary title'
|
||||
order:
|
||||
type: string
|
||||
label: 'Default order'
|
||||
|
@ -103,10 +103,10 @@ views.style.table:
|
|||
label: 'Show the empty text in the table'
|
||||
caption:
|
||||
type: label
|
||||
label: 'Caption'
|
||||
label: 'Caption for the table'
|
||||
description:
|
||||
type: text
|
||||
label: 'Caption'
|
||||
label: 'Table description'
|
||||
|
||||
views.style.default_summary:
|
||||
type: views_style
|
||||
|
|
|
@ -55,8 +55,7 @@
|
|||
var path = Drupal.Views.getPath(href);
|
||||
// Ensure we have a correct path.
|
||||
if (viewPath && path.substring(0, viewPath.length + 1) === viewPath + '/') {
|
||||
var args = decodeURIComponent(path.substring(viewPath.length + 1, path.length));
|
||||
returnObj.view_args = args;
|
||||
returnObj.view_args = decodeURIComponent(path.substring(viewPath.length + 1, path.length));
|
||||
returnObj.view_path = path;
|
||||
}
|
||||
return returnObj;
|
||||
|
|
|
@ -70,9 +70,7 @@ class ViewsMenuLink extends MenuLinkBase implements ContainerFactoryPluginInterf
|
|||
* The view executable factory
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, ViewExecutableFactory $view_executable_factory) {
|
||||
$this->configuration = $configuration;
|
||||
$this->pluginId = $plugin_id;
|
||||
$this->pluginDefinition = $plugin_definition;
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
|
||||
$this->entityManager = $entity_manager;
|
||||
$this->viewExecutableFactory = $view_executable_factory;
|
||||
|
|
|
@ -250,7 +250,7 @@ abstract class PluginBase extends ComponentPluginBase implements ContainerFactor
|
|||
|
||||
$this->unpackOptions($storage[$key], $value, isset($definition[$key]['contains']) ? $definition[$key]['contains'] : array(), $all, FALSE);
|
||||
}
|
||||
else if ($all || !empty($definition[$key])) {
|
||||
elseif ($all || !empty($definition[$key])) {
|
||||
$storage[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ class EntityReference extends DisplayPluginBase {
|
|||
|
||||
// Add an IN condition for validation.
|
||||
if (!empty($options['ids'])) {
|
||||
$this->view->query->addWhere(0, $id_field, $options['ids']);
|
||||
$this->view->query->addWhere(0, $id_field, $options['ids'], 'IN');
|
||||
}
|
||||
|
||||
$this->view->setItemsPerPage($options['limit']);
|
||||
|
|
|
@ -1248,10 +1248,7 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf
|
|||
if ($alter['phase'] == static::RENDER_TEXT_PHASE_EMPTY && $no_rewrite_for_empty) {
|
||||
// If we got here then $alter contains the value of "No results text"
|
||||
// and so there is nothing left to do.
|
||||
if ($value_is_safe) {
|
||||
$value = ViewsRenderPipelineMarkup::create($value);
|
||||
}
|
||||
return $value;
|
||||
return ViewsRenderPipelineMarkup::create($value);
|
||||
}
|
||||
|
||||
if (!empty($alter['strip_tags'])) {
|
||||
|
|
|
@ -349,7 +349,7 @@ class InOperator extends FilterPluginBase {
|
|||
if (count($this->value) == 0) {
|
||||
$values = $this->t('Unknown');
|
||||
}
|
||||
else if (count($this->value) == 1) {
|
||||
elseif (count($this->value) == 1) {
|
||||
// If any, use the 'single' short name of the operator instead.
|
||||
if (isset($info[$this->operator]['short_single'])) {
|
||||
$operator = $info[$this->operator]['short_single'];
|
||||
|
|
|
@ -805,9 +805,9 @@ class Sql extends QueryPluginBase {
|
|||
* complex options, it is an array. The meaning of each element in the array is
|
||||
* dependent on the $operator.
|
||||
* @param $operator
|
||||
* The comparison operator, such as =, <, or >=. It also accepts more complex
|
||||
* options such as IN, LIKE, or BETWEEN. Defaults to IN if $value is an array
|
||||
* = otherwise. If $field is a string you have to use 'formula' here.
|
||||
* The comparison operator, such as =, <, or >=. It also accepts more
|
||||
* 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:
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Drupal\views\Tests;
|
|||
use Drupal\views\Plugin\views\filter\Standard;
|
||||
use Drupal\views\Views;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Render\FormattableMarkup;
|
||||
|
||||
class ModuleTest extends ViewKernelTestBase {
|
||||
|
||||
|
@ -54,7 +55,7 @@ class ModuleTest extends ViewKernelTestBase {
|
|||
'field' => $this->randomMachineName(),
|
||||
);
|
||||
$handler = $this->container->get('plugin.manager.views.' . $type)->getHandler($item);
|
||||
$this->assertEqual('Drupal\views\Plugin\views\\' . $type . '\Broken', get_class($handler), t('Make sure that a broken handler of type: @type are created', array('@type' => $type)));
|
||||
$this->assertEqual('Drupal\views\Plugin\views\\' . $type . '\Broken', get_class($handler), new FormattableMarkup('Make sure that a broken handler of type: @type is created.', ['@type' => $type]));
|
||||
}
|
||||
|
||||
$views_data = $this->viewsData();
|
||||
|
|
|
@ -19,7 +19,7 @@ class ViewsEscapingTest extends ViewTestBase {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $testViews = array('test_page_display');
|
||||
public static $testViews = array('test_page_display', 'test_field_header');
|
||||
|
||||
/**
|
||||
* Used by WebTestBase::setup()
|
||||
|
@ -69,4 +69,21 @@ class ViewsEscapingTest extends ViewTestBase {
|
|||
$this->assertNoEscaped('<');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for incorrectly escaped markup in a header label on a display table.
|
||||
*/
|
||||
public function testViewsFieldHeaderEscaping() {
|
||||
// Test with a field header label having an html element wrapper.
|
||||
$this->drupalGet('test_field_header');
|
||||
|
||||
// Assert that there are no escaped '<'s characters.
|
||||
$this->assertNoEscaped('<');
|
||||
|
||||
// Test with a field header label having a XSS test as a wrapper.
|
||||
$this->drupalGet('test_field_header_xss');
|
||||
|
||||
// Assert that XSS test is escaped.
|
||||
$this->assertNoRaw('<script>alert("XSS")</script>', 'Harmful tags are escaped in header label.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -614,10 +614,10 @@ class ViewExecutable implements \Serializable {
|
|||
/**
|
||||
* Sets whether or not AJAX should be used.
|
||||
*
|
||||
* If AJAX is used, paging, tablesorting and exposed filters will be fetched
|
||||
* If AJAX is used, paging, table sorting, and exposed filters will be fetched
|
||||
* via an AJAX call rather than a page refresh.
|
||||
*
|
||||
* @param bool $use_ajax
|
||||
* @param bool $ajax_enabled
|
||||
* TRUE if AJAX should be used, FALSE otherwise.
|
||||
*/
|
||||
public function setAjaxEnabled($ajax_enabled) {
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies: { }
|
||||
id: test_field_header
|
||||
label: null
|
||||
module: views
|
||||
description: ''
|
||||
tag: ''
|
||||
base_table: views_test_data
|
||||
base_field: nid
|
||||
core: '8'
|
||||
display:
|
||||
default:
|
||||
display_options:
|
||||
fields:
|
||||
name:
|
||||
id: name
|
||||
table: views_test_data
|
||||
field: name
|
||||
plugin_id: string
|
||||
element_label_type: h2
|
||||
style:
|
||||
type: table
|
||||
display_extenders: { }
|
||||
display_plugin: default
|
||||
display_title: Master
|
||||
id: default
|
||||
position: 0
|
||||
cache_metadata:
|
||||
max-age: 0
|
||||
contexts:
|
||||
- 'languages:language_interface'
|
||||
- url.query_args
|
||||
tags: { }
|
||||
page_1:
|
||||
display_options:
|
||||
path: test_field_header
|
||||
display_extenders: { }
|
||||
display_plugin: page
|
||||
display_title: Page
|
||||
id: page_1
|
||||
position: 1
|
||||
cache_metadata:
|
||||
max-age: 0
|
||||
contexts:
|
||||
- 'languages:language_interface'
|
||||
- url.query_args
|
||||
tags: { }
|
||||
page_2:
|
||||
display_options:
|
||||
path: test_field_header_xss
|
||||
defaults:
|
||||
fields: false
|
||||
fields:
|
||||
name:
|
||||
id: name
|
||||
table: views_test_data
|
||||
field: name
|
||||
plugin_id: string
|
||||
element_label_type: 'script>alert("XSS")</script'
|
||||
display_extenders: { }
|
||||
display_plugin: page
|
||||
display_title: 'Page 2'
|
||||
id: page_2
|
||||
position: 2
|
||||
cache_metadata:
|
||||
max-age: 0
|
||||
contexts:
|
||||
- 'languages:language_interface'
|
||||
- url.query_args
|
||||
tags: { }
|
|
@ -258,6 +258,23 @@ class FieldPluginBaseTest extends UnitTestCase {
|
|||
$this->assertEquals($expected_result, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the "No results text" rendering.
|
||||
*
|
||||
* @covers ::renderText
|
||||
*/
|
||||
public function testRenderNoResult() {
|
||||
$this->setupDisplayWithEmptyArgumentsAndFields();
|
||||
$field = $this->setupTestField(['empty' => 'This <strong>should work</strong>.']);
|
||||
$field->field_alias = 'key';
|
||||
$row = new ResultRow(['key' => '']);
|
||||
|
||||
$expected_result = 'This <strong>should work</strong>.';
|
||||
$result = $field->advancedRender($row);
|
||||
$this->assertEquals($expected_result, $result);
|
||||
$this->assertInstanceOf('\Drupal\views\Render\ViewsRenderPipelineMarkup', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test rendering of a link with a path and options.
|
||||
*
|
||||
|
|
|
@ -3,10 +3,6 @@
|
|||
/**
|
||||
* @file
|
||||
* Primarily Drupal hooks and global API functions to manipulate views.
|
||||
*
|
||||
* This is the main module file for Views. The main entry points into
|
||||
* this module are views_page() and views_block(), where it handles
|
||||
* incoming page and block requests.
|
||||
*/
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
|
|
|
@ -34,6 +34,15 @@ function views_post_update_update_cacheability_metadata() {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-8.0.0-beta".
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup updates-8.0.0-rc
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Update some views fields that were previously duplicated.
|
||||
*/
|
||||
|
@ -128,5 +137,5 @@ function views_post_update_cleanup_duplicate_views_data() {
|
|||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup updates-8.0.0-beta".
|
||||
* @} End of "addtogroup updates-8.0.0-rc".
|
||||
*/
|
||||
|
|
|
@ -740,8 +740,7 @@ function template_preprocess_views_view_unformatted(&$variables) {
|
|||
foreach ($rows as $id => $row) {
|
||||
$variables['rows'][$id] = array();
|
||||
$variables['rows'][$id]['content'] = $row;
|
||||
$variables['rows'][$id]['attributes'] = array();
|
||||
$variables['rows'][$id]['attributes'] = new Attribute($variables['rows'][$id]['attributes']);
|
||||
$variables['rows'][$id]['attributes'] = new Attribute();
|
||||
if ($row_class = $view->style_plugin->getRowClass($id)) {
|
||||
$variables['rows'][$id]['attributes']->addClass($row_class);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
* - attributes: HTML attributes to apply to the container element.
|
||||
* - children: The remaining elements such as dropbuttons and tabs.
|
||||
*
|
||||
* @see template_preprocess_views_ui_container()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
|
|
Reference in a new issue