You are here

field_third_party_test.module in Zircon Profile 8.0

File

core/modules/field/tests/modules/field_third_party_test/field_third_party_test.module
View source
<?php

use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_field_widget_third_party_settings_form().
 */
function field_third_party_test_field_widget_third_party_settings_form(\Drupal\Core\Field\WidgetInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $form_mode, $form, FormStateInterface $form_state) {
  $element['field_test_widget_third_party_settings_form'] = array(
    '#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().
 */
function field_third_party_test_field_widget_settings_summary_alter(&$summary, $context) {
  $summary[] = 'field_test_field_widget_settings_summary_alter';
  return $summary;
}

/**
 * Implements hook_field_formatter_third_party_settings_form().
 */
function field_third_party_test_field_formatter_third_party_settings_form(\Drupal\Core\Field\FormatterInterface $plugin, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, $view_mode, $form, FormStateInterface $form_state) {
  $element['field_test_field_formatter_third_party_settings_form'] = array(
    '#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().
 */
function field_third_party_test_field_formatter_settings_summary_alter(&$summary, $context) {
  $summary[] = 'field_test_field_formatter_settings_summary_alter';
  return $summary;
}