Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/field_ui/field_ui.api.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
15 * | 15 * |
16 * @param \Drupal\Core\Field\FormatterInterface $plugin | 16 * @param \Drupal\Core\Field\FormatterInterface $plugin |
17 * The instantiated field formatter plugin. | 17 * The instantiated field formatter plugin. |
18 * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition | 18 * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition |
19 * The field definition. | 19 * The field definition. |
20 * @param $view_mode | 20 * @param string $view_mode |
21 * The entity view mode. | 21 * The entity view mode. |
22 * @param array $form | 22 * @param array $form |
23 * The (entire) configuration form array. | 23 * The (entire) configuration form array. |
24 * @param \Drupal\Core\Form\FormStateInterface $form_state | 24 * @param \Drupal\Core\Form\FormStateInterface $form_state |
25 * The form state. | 25 * The form state. |
26 * | 26 * |
27 * @return array | 27 * @return array |
28 * Returns the form array to be built. | 28 * Returns the form array to be built. |
29 * | 29 * |
30 * @see \Drupal\field_ui\DisplayOverView | 30 * @see \Drupal\field_ui\Form\EntityViewDisplayEditForm::thirdPartySettingsForm() |
31 */ | 31 */ |
32 function hook_field_formatter_third_party_settings_form(\Drupal\Core\Field\FormatterInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $view_mode, $form, \Drupal\Core\Form\FormStateInterface $form_state) { | 32 function hook_field_formatter_third_party_settings_form(\Drupal\Core\Field\FormatterInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $view_mode, array $form, \Drupal\Core\Form\FormStateInterface $form_state) { |
33 $element = []; | 33 $element = []; |
34 // Add a 'my_setting' checkbox to the settings form for 'foo_formatter' field | 34 // Add a 'my_setting' checkbox to the settings form for 'foo_formatter' field |
35 // formatters. | 35 // formatters. |
36 if ($plugin->getPluginId() == 'foo_formatter') { | 36 if ($plugin->getPluginId() == 'foo_formatter') { |
37 $element['my_setting'] = [ | 37 $element['my_setting'] = [ |
48 * | 48 * |
49 * @param \Drupal\Core\Field\WidgetInterface $plugin | 49 * @param \Drupal\Core\Field\WidgetInterface $plugin |
50 * The instantiated field widget plugin. | 50 * The instantiated field widget plugin. |
51 * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition | 51 * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition |
52 * The field definition. | 52 * The field definition. |
53 * @param $form_mode | 53 * @param string $form_mode |
54 * The entity form mode. | 54 * The entity form mode. |
55 * @param array $form | 55 * @param array $form |
56 * The (entire) configuration form array. | 56 * The (entire) configuration form array. |
57 * @param \Drupal\Core\Form\FormStateInterface $form_state | 57 * @param \Drupal\Core\Form\FormStateInterface $form_state |
58 * The form state. | 58 * The form state. |
59 * | 59 * |
60 * @return array | 60 * @return array |
61 * Returns the form array to be built. | 61 * Returns the form array to be built. |
62 * | 62 * |
63 * @see \Drupal\field_ui\FormDisplayOverView | 63 * @see \Drupal\field_ui\Form\EntityFormDisplayEditForm::thirdPartySettingsForm() |
64 */ | 64 */ |
65 function hook_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $form_mode, $form, \Drupal\Core\Form\FormStateInterface $form_state) { | 65 function hook_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $form_mode, array $form, \Drupal\Core\Form\FormStateInterface $form_state) { |
66 $element = []; | 66 $element = []; |
67 // Add a 'my_setting' checkbox to the settings form for 'foo_widget' field | 67 // Add a 'my_setting' checkbox to the settings form for 'foo_widget' field |
68 // widgets. | 68 // widgets. |
69 if ($plugin->getPluginId() == 'foo_widget') { | 69 if ($plugin->getPluginId() == 'foo_widget') { |
70 $element['my_setting'] = [ | 70 $element['my_setting'] = [ |
79 /** | 79 /** |
80 * Alters the field formatter settings summary. | 80 * Alters the field formatter settings summary. |
81 * | 81 * |
82 * @param array $summary | 82 * @param array $summary |
83 * An array of summary messages. | 83 * An array of summary messages. |
84 * @param $context | 84 * @param array $context |
85 * An associative array with the following elements: | 85 * An associative array with the following elements: |
86 * - formatter: The formatter object. | 86 * - formatter: The formatter plugin. |
87 * - field_definition: The field definition. | 87 * - field_definition: The field definition. |
88 * - view_mode: The view mode being configured. | 88 * - view_mode: The view mode being configured. |
89 * | 89 * |
90 * @see \Drupal\field_ui\DisplayOverView | 90 * @see \Drupal\field_ui\Form\EntityViewDisplayEditForm::alterSettingsSummary() |
91 */ | 91 */ |
92 function hook_field_formatter_settings_summary_alter(&$summary, $context) { | 92 function hook_field_formatter_settings_summary_alter(array &$summary, array $context) { |
93 // Append a message to the summary when an instance of foo_formatter has | 93 // Append a message to the summary when an instance of foo_formatter has |
94 // mysetting set to TRUE for the current view mode. | 94 // mysetting set to TRUE for the current view mode. |
95 if ($context['formatter']->getPluginId() == 'foo_formatter') { | 95 if ($context['formatter']->getPluginId() == 'foo_formatter') { |
96 if ($context['formatter']->getThirdPartySetting('my_module', 'my_setting')) { | 96 if ($context['formatter']->getThirdPartySetting('my_module', 'my_setting')) { |
97 $summary[] = t('My setting enabled.'); | 97 $summary[] = t('My setting enabled.'); |
108 * An associative array with the following elements: | 108 * An associative array with the following elements: |
109 * - widget: The widget object. | 109 * - widget: The widget object. |
110 * - field_definition: The field definition. | 110 * - field_definition: The field definition. |
111 * - form_mode: The form mode being configured. | 111 * - form_mode: The form mode being configured. |
112 * | 112 * |
113 * @see \Drupal\field_ui\FormDisplayOverView | 113 * @see \Drupal\field_ui\Form\EntityFormDisplayEditForm::alterSettingsSummary() |
114 */ | 114 */ |
115 function hook_field_widget_settings_summary_alter(&$summary, $context) { | 115 function hook_field_widget_settings_summary_alter(array &$summary, array $context) { |
116 // Append a message to the summary when an instance of foo_widget has | 116 // Append a message to the summary when an instance of foo_widget has |
117 // mysetting set to TRUE for the current view mode. | 117 // mysetting set to TRUE for the current view mode. |
118 if ($context['widget']->getPluginId() == 'foo_widget') { | 118 if ($context['widget']->getPluginId() == 'foo_widget') { |
119 if ($context['widget']->getThirdPartySetting('my_module', 'my_setting')) { | 119 if ($context['widget']->getThirdPartySetting('my_module', 'my_setting')) { |
120 $summary[] = t('My setting enabled.'); | 120 $summary[] = t('My setting enabled.'); |