5 use Drupal\Core\Field\FieldItemListInterface;
6 use Drupal\Core\Field\FieldStorageDefinitionInterface;
7 use Drupal\Core\Plugin\PluginFormInterface;
8 use Drupal\Component\Plugin\ConfigurablePluginInterface;
11 * Builds a diff from field item list.
13 interface FieldDiffBuilderInterface extends PluginFormInterface, ConfigurablePluginInterface {
16 * Builds an array of strings.
18 * This method is responsible for transforming a FieldItemListInterface object
19 * into an array of strings. The resulted array of strings is then compared by
20 * the Diff component with another such array of strings and the result
21 * represents the difference between two entity fields.
23 * Example of FieldItemListInterface built into an array of strings:
26 * 0 => "This is an example string",
27 * 1 => "Field values or properties",
31 * @see \Drupal\diff\Plugin\diff\Field\TextFieldBuilder
33 * @param FieldItemListInterface $field_items
34 * Represents an entity field.
37 * An array of strings to be compared. If an empty array is returned it
38 * means that a field is either empty or no properties need to be compared
41 public function build(FieldItemListInterface $field_items);
44 * Returns if the plugin can be used for the provided field.
46 * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $field_definition
47 * The field definition that should be checked.
50 * TRUE if the plugin can be used, FALSE otherwise.
52 public static function isApplicable(FieldStorageDefinitionInterface $field_definition);