Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -1,8 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\AllowedTagsXssTrait.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Annotation\FieldFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Annotation;
|
||||
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Annotation\FieldType.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Annotation;
|
||||
|
||||
use Drupal\Core\TypedData\Annotation\DataType;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Annotation\FieldWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Annotation;
|
||||
|
||||
use Drupal\Component\Annotation\Plugin;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\BaseFieldDefinition.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Cache\UnchangingCacheableDependencyTrait;
|
||||
|
@ -271,7 +266,7 @@ class BaseFieldDefinition extends ListDataDefinition implements FieldDefinitionI
|
|||
* FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED.
|
||||
*
|
||||
* @param int $cardinality
|
||||
* The field cardinality.
|
||||
* The field cardinality.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
@ -515,7 +510,7 @@ class BaseFieldDefinition extends ListDataDefinition implements FieldDefinitionI
|
|||
// If the field item class implements the interface, create an orphaned
|
||||
// runtime item object, so that it can be used as the options provider
|
||||
// without modifying the entity being worked on.
|
||||
if (is_subclass_of($this->getFieldItemClass(), '\Drupal\Core\TypedData\OptionsProviderInterface')) {
|
||||
if (is_subclass_of($this->getFieldItemClass(), OptionsProviderInterface::class)) {
|
||||
$items = $entity->get($this->getName());
|
||||
return \Drupal::service('plugin.manager.field.field_type')->createFieldItem($items, 0);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\BaseFieldOverrideStorage.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\ChangedFieldItemList.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Entity\BaseFieldOverride.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Entity;
|
||||
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\EntityReferenceFieldItemList.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Entity\FieldableEntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\EntityReferenceFieldItemListInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldConfigBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldConfigInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldConfigStorageBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Config\Entity\ConfigEntityStorage;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldDefinitionInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Cache\CacheableDependencyInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldDefinitionListener.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Cache\CacheBackendInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldDefinitionListenerInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldException.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldFilteredMarkup.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldItemBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldItemInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldItemList.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Access\AccessResult;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldItemListInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Entity\FieldableEntityInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldModuleUninstallValidator.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldStorageDefinitionEvent.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldStorageDefinitionEventSubscriberTrait.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldStorageDefinitionEvents.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldStorageDefinitionInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Cache\CacheableDependencyInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldStorageDefinitionListener.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldStorageDefinitionListenerInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldTypePluginManager.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FieldTypePluginManagerInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Component\Plugin\CategorizingPluginManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FormatterBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FormatterInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\FormatterPluginManager.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\DataType\Deriver\FieldItemDeriver.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\DataType\Deriver;
|
||||
|
||||
use Drupal\Core\Field\FieldTypePluginManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\DataType\FieldItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\DataType;
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\BasicStringFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\FormatterBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\BooleanFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\FormatterBase;
|
||||
|
@ -114,6 +109,30 @@ class BooleanFormatter extends FormatterBase {
|
|||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function settingsSummary() {
|
||||
$summary = [];
|
||||
$setting = $this->getSetting('format');
|
||||
|
||||
if ($setting == 'custom') {
|
||||
$summary[] = $this->t('Custom text: @true_label / @false_label', [
|
||||
'@true_label' => $this->getSetting('format_custom_true'),
|
||||
'@false_label' => $this->getSetting('format_custom_false'),
|
||||
]);
|
||||
}
|
||||
else {
|
||||
$formats = $this->getOutputFormats();
|
||||
$summary[] = $this->t('Display: @true_label / @false_label', [
|
||||
'@true_label' => $formats[$setting][0],
|
||||
'@false_label' => $formats[$setting][1],
|
||||
]);
|
||||
}
|
||||
|
||||
return $summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\DecimalFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
@ -52,11 +47,11 @@ class DecimalFormatter extends NumericFormatterBase {
|
|||
'#default_value' => $this->getSetting('decimal_separator'),
|
||||
'#weight' => 5,
|
||||
);
|
||||
$range = range(0, 10);
|
||||
$elements['scale'] = array(
|
||||
'#type' => 'select',
|
||||
'#type' => 'number',
|
||||
'#title' => t('Scale', array(), array('context' => 'decimal places')),
|
||||
'#options' => array_combine($range, $range),
|
||||
'#min' => 0,
|
||||
'#max' => 10,
|
||||
'#default_value' => $this->getSetting('scale'),
|
||||
'#description' => t('The number of digits to the right of the decimal.'),
|
||||
'#weight' => 6,
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Entity\EntityDisplayRepositoryInterface;
|
||||
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
@ -35,6 +32,20 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implem
|
|||
*/
|
||||
protected $loggerFactory;
|
||||
|
||||
/**
|
||||
* The entity type manager.
|
||||
*
|
||||
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
|
||||
*/
|
||||
protected $entityTypeManager;
|
||||
|
||||
/**
|
||||
* The entity type manager.
|
||||
*
|
||||
* @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface
|
||||
*/
|
||||
protected $entityDisplayRepository;
|
||||
|
||||
/**
|
||||
* Constructs a StringFormatter instance.
|
||||
*
|
||||
|
@ -54,10 +65,16 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implem
|
|||
* Any third party settings settings.
|
||||
* @param LoggerChannelFactoryInterface $logger_factory
|
||||
* The logger factory.
|
||||
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
|
||||
* The entity type manager.
|
||||
* @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $entity_display_repository
|
||||
* The entity display repository.
|
||||
*/
|
||||
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, LoggerChannelFactoryInterface $logger_factory) {
|
||||
public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, LoggerChannelFactoryInterface $logger_factory, EntityTypeManagerInterface $entity_type_manager, EntityDisplayRepositoryInterface $entity_display_repository) {
|
||||
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
|
||||
$this->loggerFactory = $logger_factory;
|
||||
$this->entityTypeManager = $entity_type_manager;
|
||||
$this->entityDisplayRepository = $entity_display_repository;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,7 +89,9 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implem
|
|||
$configuration['label'],
|
||||
$configuration['view_mode'],
|
||||
$configuration['third_party_settings'],
|
||||
$container->get('logger.factory')
|
||||
$container->get('logger.factory'),
|
||||
$container->get('entity_type.manager'),
|
||||
$container->get('entity_display.repository')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -92,7 +111,7 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implem
|
|||
public function settingsForm(array $form, FormStateInterface $form_state) {
|
||||
$elements['view_mode'] = array(
|
||||
'#type' => 'select',
|
||||
'#options' => \Drupal::entityManager()->getViewModeOptions($this->getFieldSetting('target_type')),
|
||||
'#options' => $this->entityDisplayRepository->getViewModeOptions($this->getFieldSetting('target_type')),
|
||||
'#title' => t('View mode'),
|
||||
'#default_value' => $this->getSetting('view_mode'),
|
||||
'#required' => TRUE,
|
||||
|
@ -107,7 +126,7 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implem
|
|||
public function settingsSummary() {
|
||||
$summary = array();
|
||||
|
||||
$view_modes = \Drupal::entityManager()->getViewModeOptions($this->getFieldSetting('target_type'));
|
||||
$view_modes = $this->entityDisplayRepository->getViewModeOptions($this->getFieldSetting('target_type'));
|
||||
$view_mode = $this->getSetting('view_mode');
|
||||
$summary[] = t('Rendered as @mode', array('@mode' => isset($view_modes[$view_mode]) ? $view_modes[$view_mode] : $view_mode));
|
||||
|
||||
|
@ -131,7 +150,8 @@ class EntityReferenceEntityFormatter extends EntityReferenceFormatterBase implem
|
|||
}
|
||||
|
||||
if ($entity->id()) {
|
||||
$elements[$delta] = entity_view($entity, $view_mode, $entity->language()->getId());
|
||||
$view_builder = $this->entityTypeManager->getViewBuilder($entity->getEntityTypeId());
|
||||
$elements[$delta] = $view_builder->view($entity, $view_mode, $entity->language()->getId());
|
||||
|
||||
// Add a resource attribute to set the mapping property's value to the
|
||||
// entity's url. Since we don't know what the markup of the entity will
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Cache\CacheableMetadata;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceIdFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceLabelFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\IntegerFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\LanguageFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\MailToFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\FormatterBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumericFormatterBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\AllowedTagsXssTrait;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumericUnformattedFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\FormatterBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\StringFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampAgoFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Cache\CacheableMetadata;
|
||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
@ -161,10 +157,12 @@ class TimestampAgoFormatter extends FormatterBase implements ContainerFactoryPlu
|
|||
$updated = $this->formatTimestamp($item->value);
|
||||
}
|
||||
else {
|
||||
$updated = $this->t('never');
|
||||
$updated = [
|
||||
'#markup' => $this->t('never'),
|
||||
];
|
||||
}
|
||||
|
||||
$elements[$delta] = array('#markup' => $updated);
|
||||
$elements[$delta] = $updated;
|
||||
}
|
||||
|
||||
return $elements;
|
||||
|
@ -176,19 +174,30 @@ class TimestampAgoFormatter extends FormatterBase implements ContainerFactoryPlu
|
|||
* @param int $timestamp
|
||||
* A UNIX timestamp to format.
|
||||
*
|
||||
* @return string
|
||||
* @return array
|
||||
* The formatted timestamp string using the past or future format setting.
|
||||
*/
|
||||
protected function formatTimestamp($timestamp) {
|
||||
$granularity = $this->getSetting('granularity');
|
||||
$options = ['granularity' => $granularity];
|
||||
$options = [
|
||||
'granularity' => $granularity,
|
||||
'return_as_object' => TRUE,
|
||||
];
|
||||
|
||||
if ($this->request->server->get('REQUEST_TIME') > $timestamp) {
|
||||
return SafeMarkup::format($this->getSetting('past_format'), ['@interval' => $this->dateFormatter->formatTimeDiffSince($timestamp, $options)]);
|
||||
$result = $this->dateFormatter->formatTimeDiffSince($timestamp, $options);
|
||||
$build = [
|
||||
'#markup' => SafeMarkup::format($this->getSetting('past_format'), ['@interval' => $result->getString()]),
|
||||
];
|
||||
}
|
||||
else {
|
||||
return SafeMarkup::format($this->getSetting('future_format'), ['@interval' => $this->dateFormatter->formatTimeDiffUntil($timestamp, $options)]);
|
||||
$result = $this->dateFormatter->formatTimeDiffUntil($timestamp, $options);
|
||||
$build = [
|
||||
'#markup' => SafeMarkup::format($this->getSetting('future_format'), ['@interval' => $result->getString()]),
|
||||
];
|
||||
}
|
||||
CacheableMetadata::createFromObject($result)->applyTo($build);
|
||||
return $build;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\TimestampFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Datetime\DateFormatterInterface;
|
||||
|
@ -126,7 +121,7 @@ class TimestampFormatter extends FormatterBase implements ContainerFactoryPlugin
|
|||
$elements['custom_date_format'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => $this->t('Custom date format'),
|
||||
'#description' => $this->t('See <a href=":url" target="_blank">the documentation for PHP date formats</a>.', [':url' => 'http://php.net/manual/function.date.php']),
|
||||
'#description' => $this->t('See <a href="http://php.net/manual/function.date.php" target="_blank">the documentation for PHP date formats</a>.'),
|
||||
'#default_value' => $this->getSetting('custom_date_format') ?: '',
|
||||
);
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldFormatter\UriLinkFormatter.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
|
||||
|
||||
use Drupal\Core\Field\FormatterBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\BooleanItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\ChangedItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\CreatedItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\DecimalItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
|
@ -69,20 +64,21 @@ class DecimalItem extends NumericItemBase {
|
|||
$element = array();
|
||||
$settings = $this->getSettings();
|
||||
|
||||
$range = range(10, 32);
|
||||
$element['precision'] = array(
|
||||
'#type' => 'select',
|
||||
'#type' => 'number',
|
||||
'#title' => t('Precision'),
|
||||
'#options' => array_combine($range, $range),
|
||||
'#min' => 10,
|
||||
'#max' => 32,
|
||||
'#default_value' => $settings['precision'],
|
||||
'#description' => t('The total number of digits to store in the database, including those to the right of the decimal.'),
|
||||
'#disabled' => $has_data,
|
||||
);
|
||||
$range = range(0, 10);
|
||||
|
||||
$element['scale'] = array(
|
||||
'#type' => 'select',
|
||||
'#type' => 'number',
|
||||
'#title' => t('Scale', array(), array('context' => 'decimal places')),
|
||||
'#options' => array_combine($range, $range),
|
||||
'#min' => 0,
|
||||
'#max' => 10,
|
||||
'#default_value' => $settings['scale'],
|
||||
'#description' => t('The number of digits to the right of the decimal.'),
|
||||
'#disabled' => $has_data,
|
||||
|
@ -152,7 +148,7 @@ class DecimalItem extends NumericItemBase {
|
|||
$scale = rand($decimal_digits, $scale);
|
||||
|
||||
// @see "Example #1 Calculate a random floating-point number" in
|
||||
// http://php.net/manual/en/function.mt-getrandmax.php
|
||||
// http://php.net/manual/function.mt-getrandmax.php
|
||||
$random_decimal = $min + mt_rand() / mt_getrandmax() * ($max - $min);
|
||||
$values['value'] = self::truncateDecimal($random_decimal, $scale);
|
||||
return $values;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\EmailItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Component\Utility\Random;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
|
@ -413,7 +408,9 @@ class EntityReferenceItem extends FieldItemBase implements OptionsProviderInterf
|
|||
}
|
||||
}
|
||||
|
||||
// Depend on target bundle configurations.
|
||||
// Depend on target bundle configurations. Dependencies for 'target_bundles'
|
||||
// also covers the 'auto_create_bundle' setting, if any, because its value
|
||||
// is included in the 'target_bundles' list.
|
||||
$handler = $field_definition->getSetting('handler_settings');
|
||||
if (!empty($handler['target_bundles'])) {
|
||||
if ($bundle_entity_type_id = $target_entity_type->getBundleEntityType()) {
|
||||
|
@ -473,10 +470,19 @@ class EntityReferenceItem extends FieldItemBase implements OptionsProviderInterf
|
|||
foreach ($storage->loadMultiple($handler_settings['target_bundles']) as $bundle) {
|
||||
if (isset($dependencies[$bundle->getConfigDependencyKey()][$bundle->getConfigDependencyName()])) {
|
||||
unset($handler_settings['target_bundles'][$bundle->id()]);
|
||||
|
||||
// If this bundle is also used in the 'auto_create_bundle'
|
||||
// setting, disable the auto-creation feature completely.
|
||||
$auto_create_bundle = !empty($handler_settings['auto_create_bundle']) ? $handler_settings['auto_create_bundle'] : FALSE;
|
||||
if ($auto_create_bundle && $auto_create_bundle == $bundle->id()) {
|
||||
$handler_settings['auto_create'] = NULL;
|
||||
$handler_settings['auto_create_bundle'] = NULL;
|
||||
}
|
||||
|
||||
$bundles_changed = TRUE;
|
||||
|
||||
// In case we deleted the only target bundle allowed by the field
|
||||
// we have to log a warning message because the field will not
|
||||
// we have to log a critical message because the field will not
|
||||
// function correctly anymore.
|
||||
if ($handler_settings['target_bundles'] === []) {
|
||||
\Drupal::logger('entity_reference')->critical('The %target_bundle bundle (entity type: %target_entity_type) was deleted. As a result, the %field_name entity reference field (entity_type: %entity_type, bundle: %bundle) no longer has any valid bundle it can reference. The field is not working correctly anymore and has to be adjusted.', [
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\FloatItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
|
@ -72,7 +67,7 @@ class FloatItem extends NumericItemBase {
|
|||
$max = is_numeric($settings['max']) ?: pow(10, ($precision - $scale)) - 1;
|
||||
$min = is_numeric($settings['min']) ?: -pow(10, ($precision - $scale)) + 1;
|
||||
// @see "Example #1 Calculate a random floating-point number" in
|
||||
// http://php.net/manual/en/function.mt-getrandmax.php
|
||||
// http://php.net/manual/function.mt-getrandmax.php
|
||||
$random_decimal = $min + mt_rand() / mt_getrandmax() * ($max - $min);
|
||||
$values['value'] = self::truncateDecimal($random_decimal, $scale);
|
||||
return $values;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\IntegerItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Core\Field\FieldDefinitionInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\LanguageItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\MapItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\NumericItemBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Core\Field\FieldItemBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\PasswordItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Core\Entity\EntityMalformedException;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\StringItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Component\Utility\Random;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\StringItemBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Core\Field\FieldItemBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\StringLongItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Component\Utility\Random;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\TimestampItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\UriItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldType\UuidItem.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldType;
|
||||
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\BooleanCheckboxWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\EmailDefaultWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteTagsWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
@ -106,9 +101,9 @@ class EntityReferenceAutocompleteWidget extends WidgetBase {
|
|||
'#placeholder' => $this->getSetting('placeholder'),
|
||||
);
|
||||
|
||||
if ($this->getSelectionHandlerSetting('auto_create')) {
|
||||
if ($this->getSelectionHandlerSetting('auto_create') && ($bundle = $this->getAutocreateBundle())) {
|
||||
$element['#autocreate'] = array(
|
||||
'bundle' => $this->getAutocreateBundle(),
|
||||
'bundle' => $bundle,
|
||||
'uid' => ($entity instanceof EntityOwnerInterface) ? $entity->getOwnerId() : \Drupal::currentUser()->id()
|
||||
);
|
||||
}
|
||||
|
@ -147,18 +142,20 @@ class EntityReferenceAutocompleteWidget extends WidgetBase {
|
|||
*/
|
||||
protected function getAutocreateBundle() {
|
||||
$bundle = NULL;
|
||||
if ($this->getSelectionHandlerSetting('auto_create')) {
|
||||
// If the 'target_bundles' setting is restricted to a single choice, we
|
||||
// can use that.
|
||||
if (($target_bundles = $this->getSelectionHandlerSetting('target_bundles')) && count($target_bundles) == 1) {
|
||||
if ($this->getSelectionHandlerSetting('auto_create') && $target_bundles = $this->getSelectionHandlerSetting('target_bundles')) {
|
||||
// If there's only one target bundle, use it.
|
||||
if (count($target_bundles) == 1) {
|
||||
$bundle = reset($target_bundles);
|
||||
}
|
||||
// Otherwise use the first bundle as a fallback.
|
||||
else {
|
||||
// @todo Expose a proper UI for choosing the bundle for autocreated
|
||||
// entities in https://www.drupal.org/node/2412569.
|
||||
$bundles = entity_get_bundles($this->getFieldSetting('target_type'));
|
||||
$bundle = key($bundles);
|
||||
// Otherwise use the target bundle stored in selection handler settings.
|
||||
elseif (!$bundle = $this->getSelectionHandlerSetting('auto_create_bundle')) {
|
||||
// If no bundle has been set as auto create target means that there is
|
||||
// an inconsistency in entity reference field settings.
|
||||
trigger_error(sprintf(
|
||||
"The 'Create referenced entities if they don't already exist' option is enabled but a specific destination bundle is not set. You should re-visit and fix the settings of the '%s' (%s) field.",
|
||||
$this->fieldDefinition->getLabel(),
|
||||
$this->fieldDefinition->getName()
|
||||
), E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\LanguageSelectWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\NumberWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Core\Field\FieldFilteredMarkup;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsButtonsWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsSelectWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
|
@ -37,7 +32,7 @@ class OptionsSelectWidget extends OptionsWidgetBase {
|
|||
$element += array(
|
||||
'#type' => 'select',
|
||||
'#options' => $this->getOptions($items->getEntity()),
|
||||
'#default_value' => $this->getSelectedOptions($items, $delta),
|
||||
'#default_value' => $this->getSelectedOptions($items),
|
||||
// Do not display a 'multiple' select box if there is only one option.
|
||||
'#multiple' => $this->multiple && count($this->options) > 1,
|
||||
);
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsWidgetBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Core\Entity\FieldableEntityInterface;
|
||||
|
@ -150,13 +145,11 @@ abstract class OptionsWidgetBase extends WidgetBase {
|
|||
*
|
||||
* @param \Drupal\Core\Field\FieldItemListInterface $items
|
||||
* The field values.
|
||||
* @param int $delta
|
||||
* (optional) The delta of the item to get options for. Defaults to 0.
|
||||
*
|
||||
* @return array
|
||||
* The array of corresponding selected options.
|
||||
*/
|
||||
protected function getSelectedOptions(FieldItemListInterface $items, $delta = 0) {
|
||||
protected function getSelectedOptions(FieldItemListInterface $items) {
|
||||
// We need to check against a flat list of options.
|
||||
$flat_options = OptGroup::flattenOptions($this->getOptions($items->getEntity()));
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\StringTextareaWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\StringTextfieldWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\Plugin\Field\FieldWidget\UriWidget.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\Plugin\Field\FieldWidget;
|
||||
|
||||
use Drupal\Core\Field\FieldItemListInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\PluginSettingsBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Component\Plugin\DependentPluginInterface;
|
||||
|
@ -99,7 +94,7 @@ abstract class PluginSettingsBase extends PluginBase implements PluginSettingsIn
|
|||
*/
|
||||
public function getThirdPartySettings($module = NULL) {
|
||||
if ($module) {
|
||||
return isset($this->thirdPartySettings[$module]) ? $this->thirdPartySettings[$module] : NULL;
|
||||
return isset($this->thirdPartySettings[$module]) ? $this->thirdPartySettings[$module] : [];
|
||||
}
|
||||
return $this->thirdPartySettings;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\PluginSettingsInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Component\Plugin\PluginInspectionInterface;
|
||||
|
@ -12,6 +7,9 @@ use Drupal\Core\Config\Entity\ThirdPartySettingsInterface;
|
|||
|
||||
/**
|
||||
* Interface definition for plugin with settings.
|
||||
*
|
||||
* @deprecated in Drupal 8.1.0 and will be removed before Drupal 9.0.0. Use
|
||||
* \Drupal\Component\Plugin\ConfigurablePluginInterface instead.
|
||||
*/
|
||||
interface PluginSettingsInterface extends PluginInspectionInterface, ThirdPartySettingsInterface {
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\PreconfiguredFieldUiOptionsInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\TypedData\FieldItemDataDefinition.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field\TypedData;
|
||||
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\WidgetBase.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
|
@ -567,4 +562,14 @@ abstract class WidgetBase extends PluginSettingsBase implements WidgetInterface
|
|||
return (bool) $form_state->get('default_value_widget');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filtered field description.
|
||||
*
|
||||
* @return \Drupal\Core\Field\FieldFilteredMarkup
|
||||
* The filtered field description, with tokens replaced.
|
||||
*/
|
||||
protected function getFilteredDescription() {
|
||||
return FieldFilteredMarkup::create(\Drupal::token()->replace($this->fieldDefinition->getDescription()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\WidgetBaseInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\WidgetInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Core\Field\WidgetPluginManager.
|
||||
*/
|
||||
|
||||
namespace Drupal\Core\Field;
|
||||
|
||||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
|
|
Reference in a new issue