class FieldThirdPartyTestHooks

Hook implementations for field_third_party_test.

Hierarchy

Expanded class hierarchy of FieldThirdPartyTestHooks

File

core/modules/field/tests/modules/field_third_party_test/src/Hook/FieldThirdPartyTestHooks.php, line 16

Namespace

Drupal\field_third_party_test\Hook
View source
class FieldThirdPartyTestHooks {
    
    /**
     * Implements hook_field_widget_third_party_settings_form().
     */
    public function fieldWidgetThirdPartySettingsForm(WidgetInterface $plugin, FieldDefinitionInterface $field_definition, $form_mode, $form, FormStateInterface $form_state) {
        $element['field_test_widget_third_party_settings_form'] = [
            '#type' => 'textfield',
            '#title' => t('3rd party widget settings form'),
            '#default_value' => $plugin->getThirdPartySetting('field_third_party_test', 'field_test_widget_third_party_settings_form'),
        ];
        return $element;
    }
    
    /**
     * Implements hook_field_widget_settings_summary_alter().
     */
    public function fieldWidgetSettingsSummaryAlter(&$summary, $context) {
        $summary[] = 'field_test_field_widget_settings_summary_alter';
        return $summary;
    }
    
    /**
     * Implements hook_field_formatter_third_party_settings_form().
     */
    public function fieldFormatterThirdPartySettingsForm(FormatterInterface $plugin, FieldDefinitionInterface $field_definition, $view_mode, $form, FormStateInterface $form_state) {
        $element['field_test_field_formatter_third_party_settings_form'] = [
            '#type' => 'textfield',
            '#title' => t('3rd party formatter settings form'),
            '#default_value' => $plugin->getThirdPartySetting('field_third_party_test', 'field_test_field_formatter_third_party_settings_form'),
        ];
        return $element;
    }
    
    /**
     * Implements hook_field_formatter_settings_summary_alter().
     */
    public function fieldFormatterSettingsSummaryAlter(&$summary, $context) {
        $summary[] = 'field_test_field_formatter_settings_summary_alter';
        return $summary;
    }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.