You are here

interface FormatterTypeInterface in Custom Formatters 8.3

Interface FormatterInterface.

Hierarchy

Expanded class hierarchy of FormatterTypeInterface

All classes that implement FormatterTypeInterface

File

src/FormatterTypeInterface.php, line 12

Namespace

Drupal\custom_formatters
View source
interface FormatterTypeInterface extends PluginInspectionInterface {

  /**
   * Calculates dependencies and stores them in the dependency property.
   *
   * @return array
   *   A keyed array of dependencies.
   */
  public function calculateDependencies();

  /**
   * Builds a renderable array for a field value.
   *
   * @param \Drupal\Core\Field\FieldItemListInterface $items
   *   The field values to be rendered.
   * @param string $langcode
   *   The language that should be used to render the field.
   *
   * @return array
   *   A renderable array for $items, as an array of child elements keyed by
   *   consecutive numeric indexes starting from 0.
   */
  public function viewElements(FieldItemListInterface $items, $langcode);

  /**
   * Formatter type plugin settings form submit callback.
   *
   * @param array $form
   *   The Form API array.
   * @param FormStateInterface $form_state
   *   The Form state interface.
   */
  public function submitForm(array $form, FormStateInterface $form_state);

}

Members

Namesort descending Modifiers Type Description Overrides
FormatterTypeInterface::calculateDependencies public function Calculates dependencies and stores them in the dependency property. 1
FormatterTypeInterface::submitForm public function Formatter type plugin settings form submit callback. 1
FormatterTypeInterface::viewElements public function Builds a renderable array for a field value. 4
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2