Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -19,11 +19,11 @@ function options_help($route_name, RouteMatchInterface $route_match) {
|
|||
case 'help.page.options':
|
||||
$output = '';
|
||||
$output .= '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('The Options module allows you to create fields where data values are selected from a fixed list of options. Usually these items are entered through a select list, checkboxes, or radio buttons. See the <a href="!field">Field module help</a> and the <a href="!field_ui">Field UI help</a> pages for general information on fields and how to create and manage them. For more information, see the <a href="!options_do">online documentation for the Options module</a>.', array('!field' => \Drupal::url('help.page', array('name' => 'field')), '!field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#', '!options_do' => 'https://www.drupal.org/documentation/modules/options')) . '</p>';
|
||||
$output .= '<p>' . t('The Options module allows you to create fields where data values are selected from a fixed list of options. Usually these items are entered through a select list, checkboxes, or radio buttons. See the <a href=":field">Field module help</a> and the <a href=":field_ui">Field UI help</a> pages for general information on fields and how to create and manage them. For more information, see the <a href=":options_do">online documentation for the Options module</a>.', array(':field' => \Drupal::url('help.page', array('name' => 'field')), ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#', ':options_do' => 'https://www.drupal.org/documentation/modules/options')) . '</p>';
|
||||
$output .= '<h3>' . t('Uses') . '</h3>';
|
||||
$output .= '<dl>';
|
||||
$output .= '<dt>' . t('Managing and displaying list fields') . '</dt>';
|
||||
$output .= '<dd>' . t('The <em>settings</em> and the <em>display</em> of the list fields 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::moduleHandler()->moduleExists('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 list fields 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::moduleHandler()->moduleExists('field_ui')) ? \Drupal::url('help.page', array('name' => 'field_ui')) : '#')) . '</dd>';
|
||||
$output .= '<dt>' . t('Defining option keys and labels') . '</dt>';
|
||||
$output .= '<dd>' . t('When you define the list options you can define a key and a label for each option in the list. The label will be shown to the users while the key gets stored in the database.') . '</dd>';
|
||||
$output .= '<dt>' . t('Choosing list field type') . '</dt>';
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\options\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\AllowedTagsXssTrait;
|
||||
use Drupal\Core\Field\FieldFilteredString;
|
||||
use Drupal\Core\Field\FieldFilteredMarkup;
|
||||
use Drupal\Core\Field\FormatterBase;
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
use Drupal\Core\Form\OptGroup;
|
||||
|
@ -33,7 +33,7 @@ class OptionsDefaultFormatter extends FormatterBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function viewElements(FieldItemListInterface $items) {
|
||||
public function viewElements(FieldItemListInterface $items, $langcode) {
|
||||
$elements = array();
|
||||
|
||||
// Only collect allowed options if there are actually items to display.
|
||||
|
@ -51,7 +51,7 @@ class OptionsDefaultFormatter extends FormatterBase {
|
|||
$output = isset($options[$value]) ? $options[$value] : $value;
|
||||
$elements[$delta] = array(
|
||||
'#markup' => $output,
|
||||
'#allowed_tags' => FieldFilteredString::allowedTags(),
|
||||
'#allowed_tags' => FieldFilteredMarkup::allowedTags(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\options\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\AllowedTagsXssTrait;
|
||||
use Drupal\Core\Field\FieldFilteredString;
|
||||
use Drupal\Core\Field\FieldFilteredMarkup;
|
||||
use Drupal\Core\Field\FormatterBase;
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
||||
|
@ -32,13 +32,13 @@ class OptionsKeyFormatter extends FormatterBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function viewElements(FieldItemListInterface $items) {
|
||||
public function viewElements(FieldItemListInterface $items, $langcode) {
|
||||
$elements = array();
|
||||
|
||||
foreach ($items as $delta => $item) {
|
||||
$elements[$delta] = array(
|
||||
'#markup' => $item->value,
|
||||
'#allowed_tags' => FieldFilteredString::allowedTags(),
|
||||
'#allowed_tags' => FieldFilteredMarkup::allowedTags(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
|
||||
namespace Drupal\options\Plugin\views\argument;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Field\AllowedTagsXssTrait;
|
||||
use Drupal\Core\Field\FieldFilteredString;
|
||||
use Drupal\Core\Field\FieldFilteredMarkup;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\views\FieldAPIHandlerTrait;
|
||||
use Drupal\views\ViewExecutable;
|
||||
|
@ -81,11 +80,11 @@ class NumberListField extends NumericArgument {
|
|||
$value = $data->{$this->name_alias};
|
||||
// If the list element has a human readable name show it.
|
||||
if (isset($this->allowedValues[$value]) && !empty($this->options['summary']['human'])) {
|
||||
return FieldFilteredString::create($this->allowedValues[$value]);
|
||||
return FieldFilteredMarkup::create($this->allowedValues[$value]);
|
||||
}
|
||||
// Else, fallback to the key.
|
||||
else {
|
||||
return SafeMarkup::checkPlain($value);
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Drupal\options\Plugin\views\argument;
|
||||
|
||||
use Drupal\Core\Field\AllowedTagsXssTrait;
|
||||
use Drupal\Core\Field\FieldFilteredString;
|
||||
use Drupal\Core\Field\FieldFilteredMarkup;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\views\FieldAPIHandlerTrait;
|
||||
use Drupal\views\ViewExecutable;
|
||||
|
@ -83,7 +83,7 @@ class StringListField extends StringArgument {
|
|||
if (isset($this->allowedValues[$value]) && !empty($this->options['summary']['human'])) {
|
||||
$value = $this->allowedValues[$value];
|
||||
}
|
||||
return FieldFilteredString::create($this->caseTransform($value, $this->options['case']));
|
||||
return FieldFilteredMarkup::create($this->caseTransform($value, $this->options['case']));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -326,7 +326,7 @@ class OptionsFieldUITest extends FieldTestBase {
|
|||
);
|
||||
|
||||
$this->drupalPostForm($this->adminPath, $edit, t('Save field settings'));
|
||||
$this->assertText(format_string('Updated field !field_name field settings.', array('!field_name' => $this->fieldName)), "The 'On' and 'Off' form fields work for boolean fields.");
|
||||
$this->assertText(format_string('Updated field @field_name field settings.', array('@field_name' => $this->fieldName)), "The 'On' and 'Off' form fields work for boolean fields.");
|
||||
|
||||
// Select a default value.
|
||||
$edit = array(
|
||||
|
|
|
@ -48,8 +48,8 @@ class OptionsFloatFieldImportTest extends FieldTestBase {
|
|||
|
||||
$admin_path = 'admin/structure/types/manage/' . $type . '/fields/node.' . $type . '.' . $field_name . '/storage';
|
||||
|
||||
// Export active config to staging
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.staging'));
|
||||
// Export active config to sync.
|
||||
$this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync'));
|
||||
|
||||
// Set the active to not use dots in the allowed values key names.
|
||||
$edit = array('settings[allowed_values]' => "0|Zero\n1|One");
|
||||
|
|
|
@ -11,8 +11,8 @@ namespace Drupal\options\Tests;
|
|||
* Tests the Options field type formatters.
|
||||
*
|
||||
* @group options
|
||||
* @see \Drupal\options\Plugin\field\formatter\OptionsDefaultFormatter
|
||||
* @see \Drupal\options\Plugin\field\formatter\OptionsKeyFormatter
|
||||
* @see \Drupal\options\Plugin\Field\FieldFormatter\OptionsDefaultFormatter
|
||||
* @see \Drupal\options\Plugin\Field\FieldFormatter\OptionsKeyFormatter
|
||||
*/
|
||||
class OptionsFormattersTest extends OptionsFieldUnitTestBase {
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ class OptionsWidgetsTest extends FieldTestBase {
|
|||
// Submit form: select invalid 'none' option.
|
||||
$edit = array('card_1' => '_none');
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('!title field is required.', array('!title' => $field->getName())), 'Cannot save a required field when selecting "none" from the select list.');
|
||||
$this->assertRaw(t('@title field is required.', array('@title' => $field->getName())), 'Cannot save a required field when selecting "none" from the select list.');
|
||||
|
||||
// Submit form: select first option.
|
||||
$edit = array('card_1' => 0);
|
||||
|
|
|
@ -5,7 +5,6 @@ dependencies:
|
|||
- field.field.node.options_install_test.body
|
||||
- node.type.options_install_test
|
||||
module:
|
||||
- entity_reference
|
||||
- text
|
||||
id: node.options_install_test.default
|
||||
targetEntityType: node
|
||||
|
|
|
@ -23,3 +23,4 @@ cardinality: 1
|
|||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
||||
|
|
Reference in a new issue