3 namespace Drupal\quickedit\Plugin;
5 use Drupal\Component\Plugin\PluginInspectionInterface;
6 use Drupal\Core\Field\FieldItemListInterface;
9 * Defines an interface for in-place editors plugins.
11 * @see \Drupal\quickedit\Annotation\InPlaceEditor
12 * @see \Drupal\quickedit\Plugin\InPlaceEditorBase
13 * @see \Drupal\quickedit\Plugin\InPlaceEditorManager
16 interface InPlaceEditorInterface extends PluginInspectionInterface {
19 * Checks whether this in-place editor is compatible with a given field.
21 * @param \Drupal\Core\Field\FieldItemListInterface $items
22 * The field values to be in-place edited.
25 * TRUE if it is compatible, FALSE otherwise.
27 public function isCompatible(FieldItemListInterface $items);
30 * Generates metadata that is needed specifically for this editor.
32 * Will only be called by \Drupal\quickedit\MetadataGeneratorInterface::generate()
33 * when the passed in field & item values will use this editor.
35 * @param \Drupal\Core\Field\FieldItemListInterface $items
36 * The field values to be in-place edited.
39 * A keyed array with metadata. Each key should be prefixed with the plugin
42 public function getMetadata(FieldItemListInterface $items);
45 * Returns the attachments for this editor.
48 * An array of attachments, for use with #attached.
50 * @see \Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments()
52 public function getAttachments();