ConfigFieldItemInterface.php 1.69 KB
Newer Older
1 2 3 4
<?php

/**
 * @file
5
 * Contains \Drupal\Core\Field\ConfigFieldItemInterface.
6 7
 */

8
namespace Drupal\Core\Field;
9 10 11 12 13 14 15 16 17 18

/**
 * Interface definition for 'configurable field type' plugins.
 */
interface ConfigFieldItemInterface extends FieldItemInterface {

  /**
   * Returns a form for the field-level settings.
   *
   * Invoked from \Drupal\field_ui\Form\FieldEditForm to allow administrators to
19 20 21 22 23 24 25
   * configure field-level settings.
   *
   * Field storage might reject field definition changes that affect the field
   * storage schema if the field already has data. When the $has_data parameter
   * is TRUE, the form should not allow changing the settings that take part in
   * the schema() method. It is recommended to set #access to FALSE on the
   * corresponding elements.
26 27 28 29 30
   *
   * @param array $form
   *   The form where the settings form is being included in.
   * @param array $form_state
   *   The form state of the (entire) configuration form.
31 32
   * @param bool $has_data
   *   TRUE if the field already has data, FALSE if not.
33 34 35 36
   *
   * @return
   *   The form definition for the field settings.
   */
37
  public function settingsForm(array $form, array &$form_state, $has_data);
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

  /**
   * Returns a form for the instance-level settings.
   *
   * Invoked from \Drupal\field_ui\Form\FieldInstanceEditForm to allow
   * administrators to configure instance-level settings.
   *
   * @param array $form
   *   The form where the settings form is being included in.
   * @param array $form_state
   *   The form state of the (entire) configuration form.
   *
   * @return array
   *   The form definition for the field instance settings.
   */
  public function instanceSettingsForm(array $form, array &$form_state);

}