Same filename in other branches
Main module file for Field States UI.
Fichier
View source
<?php
/**
* @file
* Main module file for Field States UI.
*/
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Field\WidgetInterface;
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_field_widget_third_party_settings_form().
*/
function field_states_ui_field_widget_third_party_settings_form(WidgetInterface $plugin, FieldDefinitionInterface $field_definition, $form_mode, $form, FormStateInterface $form_state) {
return \Drupal::service('plugin.manager.field_states_ui.fieldstate')->settingsForm($plugin, $field_definition, $form_mode, $form, $form_state);
}
/**
* Implements hook_field_widget_settings_summary_alter().
*/
function field_states_ui_field_widget_settings_summary_alter(&$summary, $context) {
$field_states = $context['widget']->getThirdPartySettings('field_states_ui');
if (!empty($field_states['field_states'])) {
$summary[] = t('Field States applied.');
}
}
/**
* Implements hook_field_widget_multivalue_form_alter().
*/
function field_states_ui_field_widget_multivalue_form_alter(&$elements, FormStateInterface $form_state, $context) {
// Don't show on default value forms.
if ($context['default']) {
return;
}
\Drupal::service('plugin.manager.field_states_ui.fieldstate')->apply($elements, $form_state, $context);
}
/**
* Implements hook_theme().
*/
function field_states_ui_theme() {
return [
'field_states_ui_summary' => [
'variables' => [
'data' => [],
],
],
];
}
Functions
Titre | Deprecated | Résumé |
---|---|---|
field_states_ui_field_widget_multivalue_form_alter | Implements hook_field_widget_multivalue_form_alter(). | |
field_states_ui_field_widget_settings_summary_alter | Implements hook_field_widget_settings_summary_alter(). | |
field_states_ui_field_widget_third_party_settings_form | Implements hook_field_widget_third_party_settings_form(). | |
field_states_ui_theme | Implements hook_theme(). |