abstract class InlineEntityFormBase in Inline Entity Form 8
Inline entity form widget base class.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\Core\Field\PluginSettingsBase implements DependentPluginInterface, PluginSettingsInterface
- class \Drupal\Core\Field\WidgetBase implements WidgetInterface, ContainerFactoryPluginInterface uses AllowedTagsXssTrait
- class \Drupal\inline_entity_form\Plugin\Field\FieldWidget\InlineEntityFormBase implements ContainerFactoryPluginInterface
- class \Drupal\Core\Field\WidgetBase implements WidgetInterface, ContainerFactoryPluginInterface uses AllowedTagsXssTrait
- class \Drupal\Core\Field\PluginSettingsBase implements DependentPluginInterface, PluginSettingsInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of InlineEntityFormBase
File
- src/
Plugin/ Field/ FieldWidget/ InlineEntityFormBase.php, line 20
Namespace
Drupal\inline_entity_form\Plugin\Field\FieldWidgetView source
abstract class InlineEntityFormBase extends WidgetBase implements ContainerFactoryPluginInterface {
/**
* The inline entity form id.
*
* @var string
*/
protected $iefId;
/**
* The entity type bundle info.
*
* @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface
*/
protected $entityTypeBundleInfo;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* The inline entity from handler.
*
* @var \Drupal\inline_entity_form\InlineFormInterface
*/
protected $inlineFormHandler;
/**
* The entity display repository.
*
* @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface
*/
protected $entityDisplayRepository;
/**
* Constructs an InlineEntityFormBase object.
*
* @param string $plugin_id
* The plugin_id for the widget.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
* The definition of the field to which the widget is associated.
* @param array $settings
* The widget settings.
* @param array $third_party_settings
* Any third party settings.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
* The entity type bundle info.
* @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, array $third_party_settings, EntityTypeBundleInfoInterface $entity_type_bundle_info, EntityTypeManagerInterface $entity_type_manager, EntityDisplayRepositoryInterface $entity_display_repository) {
parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
$this->entityTypeBundleInfo = $entity_type_bundle_info;
$this->entityTypeManager = $entity_type_manager;
$this->entityDisplayRepository = $entity_display_repository;
$this
->createInlineFormHandler();
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($plugin_id, $plugin_definition, $configuration['field_definition'], $configuration['settings'], $configuration['third_party_settings'], $container
->get('entity_type.bundle.info'), $container
->get('entity_type.manager'), $container
->get('entity_display.repository'));
}
/**
* Creates an instance of the inline form handler for the current entity type.
*/
protected function createInlineFormHandler() {
if (!isset($this->inlineFormHandler)) {
$target_type = $this
->getFieldSetting('target_type');
$this->inlineFormHandler = $this->entityTypeManager
->getHandler($target_type, 'inline_form');
}
}
/**
* {@inheritdoc}
*/
public function __sleep() {
$keys = array_diff(parent::__sleep(), [
'inlineFormHandler',
]);
return $keys;
}
/**
* {@inheritdoc}
*/
public function __wakeup() {
parent::__wakeup();
$this
->createInlineFormHandler();
}
/**
* Sets inline entity form ID.
*
* @see ::makeIefId
*
* @param string $ief_id
* The inline entity form ID.
*/
protected function setIefId($ief_id) {
$this->iefId = $ief_id;
}
/**
* Gets inline entity form ID.
*
* @return string
* Inline entity form ID.
*/
protected function getIefId() {
return $this->iefId;
}
/**
* Makes an IEF ID from array parents.
*
* IEF ID is used a) for element ID, b) for form state keys.
* We need the IEF form ID to reflect the tree structure of IEFs, so that
* the form state keys can be sorted to ensure inside-out saving of entities.
*
* Also, "add" and "edit" IEFs have different array parents, which messes up
* form state, so we fixup this here with a, errrm, pragmatic hack.
*
* @see \Drupal\inline_entity_form\WidgetSubmit::doSubmit
*
* @param string[] $parents
* The array parents.
* @return string
* The resulting inline entity form ID.
*/
protected function makeIefId(array $parents) {
$iefId = implode('-', $parents);
$iefId = preg_replace('#-inline_entity_form-entities-([0-9]+)-form-#', '-$1-', $iefId);
return $iefId;
}
/**
* Gets the target bundles for the current field.
*
* @return string[]
* A list of bundles.
*/
protected function getTargetBundles() {
$settings = $this
->getFieldSettings();
if (!empty($settings['handler_settings']['target_bundles'])) {
$target_bundles = array_values($settings['handler_settings']['target_bundles']);
// Filter out target bundles which no longer exist.
$existing_bundles = array_keys($this->entityTypeBundleInfo
->getBundleInfo($settings['target_type']));
$target_bundles = array_intersect($target_bundles, $existing_bundles);
}
else {
// If no target bundles have been specified then all are available.
$target_bundles = array_keys($this->entityTypeBundleInfo
->getBundleInfo($settings['target_type']));
}
return $target_bundles;
}
/**
* Gets the bundles for which the current user has create access.
*
* @return string[]
* The list of bundles.
*/
protected function getCreateBundles() {
$create_bundles = [];
foreach ($this
->getTargetBundles() as $bundle) {
if ($this
->getAccessHandler()
->createAccess($bundle)) {
$create_bundles[] = $bundle;
}
}
return $create_bundles;
}
/**
* {@inheritdoc}
*/
public static function defaultSettings() {
return [
'form_mode' => 'default',
'revision' => FALSE,
'override_labels' => FALSE,
'label_singular' => '',
'label_plural' => '',
'collapsible' => FALSE,
'collapsed' => FALSE,
];
}
/**
* {@inheritdoc}
*/
public function settingsForm(array $form, FormStateInterface $form_state) {
$entity_type_id = $this
->getFieldSetting('target_type');
$states_prefix = 'fields[' . $this->fieldDefinition
->getName() . '][settings_edit_form][settings]';
$element = [];
$element['form_mode'] = [
'#type' => 'select',
'#title' => $this
->t('Form mode'),
'#default_value' => $this
->getSetting('form_mode'),
'#options' => $this->entityDisplayRepository
->getFormModeOptions($entity_type_id),
'#required' => TRUE,
];
$element['revision'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Create new revision'),
'#default_value' => $this
->getSetting('revision'),
];
$element['override_labels'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Override labels'),
'#default_value' => $this
->getSetting('override_labels'),
];
$element['label_singular'] = [
'#type' => 'textfield',
'#title' => $this
->t('Singular label'),
'#default_value' => $this
->getSetting('label_singular'),
'#states' => [
'visible' => [
':input[name="' . $states_prefix . '[override_labels]"]' => [
'checked' => TRUE,
],
],
],
];
$element['label_plural'] = [
'#type' => 'textfield',
'#title' => $this
->t('Plural label'),
'#default_value' => $this
->getSetting('label_plural'),
'#states' => [
'visible' => [
':input[name="' . $states_prefix . '[override_labels]"]' => [
'checked' => TRUE,
],
],
],
];
$element['collapsible'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Collapsible'),
'#default_value' => $this
->getSetting('collapsible'),
];
$element['collapsed'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Collapsed by default'),
'#default_value' => $this
->getSetting('collapsed'),
'#states' => [
'visible' => [
':input[name="' . $states_prefix . '[collapsible]"]' => [
'checked' => TRUE,
],
],
],
];
return $element;
}
/**
* {@inheritdoc}
*/
public function settingsSummary() {
$summary = [];
if ($entity_form_mode = $this
->getEntityFormMode()) {
$form_mode_label = $entity_form_mode
->label();
}
else {
$form_mode_label = $this
->t('Default');
}
$summary[] = $this
->t('Form mode: @mode', [
'@mode' => $form_mode_label,
]);
if ($this
->getSetting('override_labels')) {
$summary[] = $this
->t('Overriden labels are used: %singular and %plural', [
'%singular' => $this
->getSetting('label_singular'),
'%plural' => $this
->getSetting('label_plural'),
]);
}
else {
$summary[] = $this
->t('Default labels are used.');
}
if ($this
->getSetting('revision')) {
$summary[] = $this
->t('Create new revision');
}
if ($this
->getSetting('collapsible')) {
$summary[] = $this
->t($this
->getSetting('collapsed') ? 'Collapsible, collapsed by default' : 'Collapsible');
}
return $summary;
}
/**
* Gets the entity type managed by this handler.
*
* @return \Drupal\Core\Entity\EntityTypeInterface
* The entity type.
*/
protected function getEntityTypeLabels() {
// The admin has specified the exact labels that should be used.
if ($this
->getSetting('override_labels')) {
return [
'singular' => $this
->getSetting('label_singular'),
'plural' => $this
->getSetting('label_plural'),
];
}
else {
$this
->createInlineFormHandler();
return $this->inlineFormHandler
->getEntityTypeLabels();
}
}
/**
* Checks whether we can build entity form at all.
*
* - Is IEF handler loaded?
* - Are we on a "real" entity form and not on default value widget?
*
* @param \Drupal\Core\Form\FormStateInterface $form_state
* Form state.
*
* @return bool
* TRUE if we are able to proceed with form build and FALSE if not.
*/
protected function canBuildForm(FormStateInterface $form_state) {
if ($this
->isDefaultValueWidget($form_state)) {
return FALSE;
}
if (!$this->inlineFormHandler) {
return FALSE;
}
return TRUE;
}
/**
* Prepares the form state for the current widget.
*
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
* @param \Drupal\Core\Field\FieldItemListInterface $items
* The field values.
* @param bool $translating
* Whether there's a translation in progress.
*/
protected function prepareFormState(FormStateInterface $form_state, FieldItemListInterface $items, $translating = FALSE) {
$widget_state = $form_state
->get([
'inline_entity_form',
$this->iefId,
]);
if (empty($widget_state)) {
$widget_state = [
'instance' => $this->fieldDefinition,
'form' => NULL,
'delete' => [],
'entities' => [],
];
// Store the $items entities in the widget state, for further manipulation.
foreach ($items
->referencedEntities() as $delta => $entity) {
// Display the entity in the correct translation.
if ($translating) {
$entity = TranslationHelper::prepareEntity($entity, $form_state);
}
$widget_state['entities'][$delta] = [
'entity' => $entity,
'weight' => $delta,
'form' => NULL,
'needs_save' => $entity
->isNew(),
];
}
$form_state
->set([
'inline_entity_form',
$this->iefId,
], $widget_state);
}
}
/**
* Gets inline entity form element.
*
* @param string $operation
* The operation (i.e. 'add' or 'edit').
* @param string $bundle
* Entity bundle.
* @param string $langcode
* Entity langcode.
* @param array $parents
* Array of parent element names.
* @param \Drupal\Core\Entity\EntityInterface $entity
* Optional entity object.
*
* @return array
* IEF form element structure.
*/
protected function getInlineEntityForm($operation, $bundle, $langcode, $delta, array $parents, EntityInterface $entity = NULL) {
$element = [
'#type' => 'inline_entity_form',
'#entity_type' => $this
->getFieldSetting('target_type'),
'#bundle' => $bundle,
'#langcode' => $langcode,
'#default_value' => $entity,
'#op' => $operation,
'#form_mode' => $this
->getSetting('form_mode'),
'#revision' => $this
->getSetting('revision'),
'#save_entity' => FALSE,
'#ief_row_delta' => $delta,
// Used by Field API and controller methods to find the relevant
// values in $form_state.
'#parents' => $parents,
// Labels could be overridden in field widget settings. We won't have
// access to those in static callbacks (#process, ...) so let's add
// them here.
'#ief_labels' => $this
->getEntityTypeLabels(),
// Identifies the IEF widget to which the form belongs.
'#ief_id' => $this
->getIefId(),
];
return $element;
}
/**
* Determines whether there's a translation in progress.
*
* Ensures that at least one target bundle has translations enabled.
* Otherwise the widget will skip translation even if it's happening
* on the parent form itself.
*
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*
* @return bool
* TRUE if translating is in progress, FALSE otherwise.
*
* @see \Drupal\inline_entity_form\TranslationHelper::initFormLangcodes()
*/
protected function isTranslating(FormStateInterface $form_state) {
if (TranslationHelper::isTranslating($form_state)) {
$translation_manager = \Drupal::service('content_translation.manager');
$target_type = $this
->getFieldSetting('target_type');
foreach ($this
->getTargetBundles() as $bundle) {
if ($translation_manager
->isEnabled($target_type, $bundle)) {
return TRUE;
}
}
}
return FALSE;
}
/**
* After-build callback for removing the translatability clue from the widget.
*
* IEF expects the entity reference field to not be translatable, to avoid
* different translations having different references.
* However, that causes ContentTranslationHandler::addTranslatabilityClue()
* to add an "(all languages)" suffix to the widget title. That suffix is
* incorrect, since IEF does ensure that specific entity translations are
* being edited.
*/
public static function removeTranslatabilityClue(array $element, FormStateInterface $form_state) {
$element['#title'] = $element['#field_title'];
return $element;
}
/**
* Adds submit callbacks to the inline entity form.
*
* @param array $element
* Form array structure.
*/
public static function addIefSubmitCallbacks($element) {
$element['#ief_element_submit'][] = [
get_called_class(),
'submitSaveEntity',
];
return $element;
}
/**
* Marks created/edited entity with "needs save" flag.
*
* Note that at this point the entity is not yet saved, since the user might
* still decide to cancel the parent form.
*
* @param $entity_form
* The form of the entity being managed inline.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state of the parent form.
*/
public static function submitSaveEntity($entity_form, FormStateInterface $form_state) {
$ief_id = $entity_form['#ief_id'];
/** @var \Drupal\Core\Entity\EntityInterface $entity */
$entity = $entity_form['#entity'];
if (in_array($entity_form['#op'], [
'add',
'duplicate',
])) {
// Determine the correct weight of the new element.
$weight = 0;
$entities = $form_state
->get([
'inline_entity_form',
$ief_id,
'entities',
]);
if (!empty($entities)) {
$weight = max(array_keys($entities)) + 1;
}
// Add the entity to form state, mark it for saving, and close the form.
$entities[] = [
'entity' => $entity,
'weight' => $weight,
'form' => NULL,
'needs_save' => TRUE,
];
$form_state
->set([
'inline_entity_form',
$ief_id,
'entities',
], $entities);
}
else {
$delta = $entity_form['#ief_row_delta'];
$entities = $form_state
->get([
'inline_entity_form',
$ief_id,
'entities',
]);
$entities[$delta]['entity'] = $entity;
$entities[$delta]['needs_save'] = TRUE;
$form_state
->set([
'inline_entity_form',
$ief_id,
'entities',
], $entities);
}
}
/**
* {@inheritdoc}
*/
public function calculateDependencies() {
$dependencies = parent::calculateDependencies();
if ($entity_form_mode = $this
->getEntityFormMode()) {
$dependencies['config'][] = $entity_form_mode
->getConfigDependencyName();
}
return $dependencies;
}
/**
* Gets the entity form mode instance for this widget.
*
* @return \Drupal\Core\Entity\EntityFormModeInterface|null
* The form mode instance, or NULL if the default one is used.
*/
protected function getEntityFormMode() {
$form_mode = $this
->getSetting('form_mode');
if ($form_mode != 'default') {
$entity_type_id = $this
->getFieldSetting('target_type');
return $this->entityTypeManager
->getStorage('entity_form_mode')
->load($entity_type_id . '.' . $form_mode);
}
return NULL;
}
/**
* Gets the access handler for the target entity type.
*
* @return \Drupal\Core\Entity\EntityAccessControlHandlerInterface
* The access handler.
*/
protected function getAccessHandler() {
$entity_type_id = $this
->getFieldSetting('target_type');
return $this->entityTypeManager
->getAccessControlHandler($entity_type_id);
}
/**
* {@inheritdoc}
*/
public function form(FieldItemListInterface $items, array &$form, FormStateInterface $form_state, $get_delta = NULL) {
if ($this
->canBuildForm($form_state)) {
return parent::form($items, $form, $form_state, $get_delta);
}
return [];
}
/**
* Determines if the current user can add any new entities.
*
* @return bool
*/
protected function canAddNew() {
$create_bundles = $this
->getCreateBundles();
return !empty($create_bundles);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AllowedTagsXssTrait:: |
public | function | Returns a list of tags allowed by AllowedTagsXssTrait::fieldFilterXss(). | |
AllowedTagsXssTrait:: |
public | function | Returns a human-readable list of allowed tags for display in help texts. | |
AllowedTagsXssTrait:: |
public | function | Filters an HTML string to prevent XSS vulnerabilities. | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
InlineEntityFormBase:: |
protected | property | The entity display repository. | |
InlineEntityFormBase:: |
protected | property | The entity type bundle info. | |
InlineEntityFormBase:: |
protected | property | The entity type manager. | |
InlineEntityFormBase:: |
protected | property | The inline entity form id. | |
InlineEntityFormBase:: |
protected | property | The inline entity from handler. | |
InlineEntityFormBase:: |
public static | function | Adds submit callbacks to the inline entity form. | |
InlineEntityFormBase:: |
public | function |
Calculates dependencies for the configured plugin. Overrides PluginSettingsBase:: |
|
InlineEntityFormBase:: |
protected | function | Determines if the current user can add any new entities. | |
InlineEntityFormBase:: |
protected | function | Checks whether we can build entity form at all. | |
InlineEntityFormBase:: |
public static | function |
Creates an instance of the plugin. Overrides WidgetBase:: |
1 |
InlineEntityFormBase:: |
protected | function | Creates an instance of the inline form handler for the current entity type. | |
InlineEntityFormBase:: |
public static | function |
Defines the default settings for this plugin. Overrides PluginSettingsBase:: |
1 |
InlineEntityFormBase:: |
public | function |
Creates a form element for a field. Overrides WidgetBase:: |
|
InlineEntityFormBase:: |
protected | function | Gets the access handler for the target entity type. | |
InlineEntityFormBase:: |
protected | function | Gets the bundles for which the current user has create access. | |
InlineEntityFormBase:: |
protected | function | Gets the entity form mode instance for this widget. | |
InlineEntityFormBase:: |
protected | function | Gets the entity type managed by this handler. | |
InlineEntityFormBase:: |
protected | function | Gets inline entity form ID. | |
InlineEntityFormBase:: |
protected | function | Gets inline entity form element. | |
InlineEntityFormBase:: |
protected | function | Gets the target bundles for the current field. | |
InlineEntityFormBase:: |
protected | function | Determines whether there's a translation in progress. | |
InlineEntityFormBase:: |
protected | function | Makes an IEF ID from array parents. | |
InlineEntityFormBase:: |
protected | function | Prepares the form state for the current widget. | |
InlineEntityFormBase:: |
public static | function | After-build callback for removing the translatability clue from the widget. | |
InlineEntityFormBase:: |
protected | function | Sets inline entity form ID. | |
InlineEntityFormBase:: |
public | function |
Returns a form to configure settings for the widget. Overrides WidgetBase:: |
1 |
InlineEntityFormBase:: |
public | function |
Returns a short summary for the current widget settings. Overrides WidgetBase:: |
1 |
InlineEntityFormBase:: |
public static | function | Marks created/edited entity with "needs save" flag. | |
InlineEntityFormBase:: |
public | function |
Constructs an InlineEntityFormBase object. Overrides WidgetBase:: |
1 |
InlineEntityFormBase:: |
public | function |
Overrides DependencySerializationTrait:: |
|
InlineEntityFormBase:: |
public | function |
Overrides DependencySerializationTrait:: |
|
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginSettingsBase:: |
protected | property | Whether default settings have been merged into the current $settings. | |
PluginSettingsBase:: |
protected | property | The plugin settings injected by third party modules. | |
PluginSettingsBase:: |
public | function |
Returns the value of a setting, or its default value if absent. Overrides PluginSettingsInterface:: |
|
PluginSettingsBase:: |
public | function |
Returns the array of settings, including defaults for missing settings. Overrides PluginSettingsInterface:: |
|
PluginSettingsBase:: |
public | function |
Gets the list of third parties that store information. Overrides ThirdPartySettingsInterface:: |
|
PluginSettingsBase:: |
public | function |
Gets the value of a third-party setting. Overrides ThirdPartySettingsInterface:: |
|
PluginSettingsBase:: |
public | function |
Gets all third-party settings of a given module. Overrides ThirdPartySettingsInterface:: |
|
PluginSettingsBase:: |
protected | function | Merges default settings values into $settings. | |
PluginSettingsBase:: |
public | function |
Informs the plugin that some configuration it depends on will be deleted. Overrides PluginSettingsInterface:: |
3 |
PluginSettingsBase:: |
public | function |
Sets the value of a setting for the plugin. Overrides PluginSettingsInterface:: |
|
PluginSettingsBase:: |
public | function |
Sets the settings for the plugin. Overrides PluginSettingsInterface:: |
|
PluginSettingsBase:: |
public | function |
Sets the value of a third-party setting. Overrides ThirdPartySettingsInterface:: |
|
PluginSettingsBase:: |
public | function |
Unsets a third-party setting. Overrides ThirdPartySettingsInterface:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
WidgetBase:: |
protected | property | The field definition. | |
WidgetBase:: |
protected | property |
The widget settings. Overrides PluginSettingsBase:: |
|
WidgetBase:: |
public static | function | Ajax callback for the "Add another item" button. | |
WidgetBase:: |
public static | function | Submission handler for the "Add another item" button. | |
WidgetBase:: |
public static | function | After-build handler for field elements in a form. | |
WidgetBase:: |
public | function |
Assigns a field-level validation error to the right widget sub-element. Overrides WidgetInterface:: |
8 |
WidgetBase:: |
public | function |
Extracts field values from submitted form values. Overrides WidgetBaseInterface:: |
2 |
WidgetBase:: |
public | function |
Reports field-level validation errors against actual form elements. Overrides WidgetBaseInterface:: |
2 |
WidgetBase:: |
protected | function | Special handling to create form elements for multiple values. | 1 |
WidgetBase:: |
protected | function | Generates the form element for a single copy of the widget. | |
WidgetBase:: |
protected | function | Returns the value of a field setting. | |
WidgetBase:: |
protected | function | Returns the array of field settings. | |
WidgetBase:: |
protected | function | Returns the filtered field description. | |
WidgetBase:: |
public static | function |
Retrieves processing information about the widget from $form_state. Overrides WidgetBaseInterface:: |
|
WidgetBase:: |
protected static | function | Returns the location of processing information within $form_state. | |
WidgetBase:: |
protected | function | Returns whether the widget handles multiple values. | |
WidgetBase:: |
public static | function |
Returns if the widget can be used for the provided field. Overrides WidgetInterface:: |
4 |
WidgetBase:: |
protected | function | Returns whether the widget used for default value form. | |
WidgetBase:: |
public | function |
Massages the form values into the format expected for field values. Overrides WidgetInterface:: |
7 |
WidgetBase:: |
public static | function |
Stores processing information about the widget in $form_state. Overrides WidgetBaseInterface:: |
|
WidgetInterface:: |
public | function | Returns the form for a single field widget. | 22 |