annotate core/modules/quickedit/src/Plugin/InPlaceEditorInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\quickedit\Plugin;
Chris@0 4
Chris@0 5 use Drupal\Component\Plugin\PluginInspectionInterface;
Chris@0 6 use Drupal\Core\Field\FieldItemListInterface;
Chris@0 7
Chris@0 8 /**
Chris@0 9 * Defines an interface for in-place editors plugins.
Chris@0 10 *
Chris@0 11 * @see \Drupal\quickedit\Annotation\InPlaceEditor
Chris@0 12 * @see \Drupal\quickedit\Plugin\InPlaceEditorBase
Chris@0 13 * @see \Drupal\quickedit\Plugin\InPlaceEditorManager
Chris@0 14 * @see plugin_api
Chris@0 15 */
Chris@0 16 interface InPlaceEditorInterface extends PluginInspectionInterface {
Chris@0 17
Chris@0 18 /**
Chris@0 19 * Checks whether this in-place editor is compatible with a given field.
Chris@0 20 *
Chris@0 21 * @param \Drupal\Core\Field\FieldItemListInterface $items
Chris@0 22 * The field values to be in-place edited.
Chris@0 23 *
Chris@0 24 * @return bool
Chris@0 25 * TRUE if it is compatible, FALSE otherwise.
Chris@0 26 */
Chris@0 27 public function isCompatible(FieldItemListInterface $items);
Chris@0 28
Chris@0 29 /**
Chris@0 30 * Generates metadata that is needed specifically for this editor.
Chris@0 31 *
Chris@0 32 * Will only be called by \Drupal\quickedit\MetadataGeneratorInterface::generate()
Chris@0 33 * when the passed in field & item values will use this editor.
Chris@0 34 *
Chris@0 35 * @param \Drupal\Core\Field\FieldItemListInterface $items
Chris@0 36 * The field values to be in-place edited.
Chris@0 37 *
Chris@0 38 * @return array
Chris@0 39 * A keyed array with metadata. Each key should be prefixed with the plugin
Chris@0 40 * ID of the editor.
Chris@0 41 */
Chris@0 42 public function getMetadata(FieldItemListInterface $items);
Chris@0 43
Chris@0 44 /**
Chris@0 45 * Returns the attachments for this editor.
Chris@0 46 *
Chris@0 47 * @return array
Chris@0 48 * An array of attachments, for use with #attached.
Chris@0 49 *
Chris@0 50 * @see \Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments()
Chris@0 51 */
Chris@0 52 public function getAttachments();
Chris@0 53
Chris@0 54 }