interface EditPluginInterface

Defines an interface for in-place editors (Create.js PropertyEditor widgets).

A PropertyEditor widget is a user-facing interface to edit an entity property through Create.js.

Hierarchy

Expanded class hierarchy of EditPluginInterface

All classes that implement EditPluginInterface

2 files declare their use of EditPluginInterface
Editor.php in drupal/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php
Contains \Drupal\editor\Plugin\InPlaceEditor\Editor.
EditorBase.php in drupal/core/modules/edit/lib/Drupal/edit/EditorBase.php
Contains \Drupal\edit\EditorBase.

File

drupal/core/modules/edit/lib/Drupal/edit/EditPluginInterface.php, line 19
Contains \Drupal\edit\EditPluginInterface.

Namespace

Drupal\edit
View source
interface EditPluginInterface extends PluginInspectionInterface {

  /**
   * Checks whether this editor is compatible with a given field instance.
   *
   * @param \Drupal\field\Plugin\Core\Entity\FieldInstance $instance
   *   The field instance of the field being edited.
   * @param array $items
   *   The field's item values.
   *
   * @return bool
   *   TRUE if it is compatible, FALSE otherwise.
   */
  public function isCompatible(FieldInstance $instance, array $items);

  /**
   * Generates metadata that is needed specifically for this editor.
   *
   * Will only be called by \Drupal\edit\MetadataGeneratorInterface::generate()
   * when the passed in field instance & item values will use this editor.
   *
   * @param \Drupal\field\Plugin\Core\Entity\FieldInstance $instance
   *   The field instance of the field being edited.
   * @param array $items
   *   The field's item values.
   *
   * @return array
   *   A keyed array with metadata. Each key should be prefixed with the plugin
   *   ID of the editor.
   */
  public function getMetadata(FieldInstance $instance, array $items);

  /**
   * Returns the attachments for this editor.
   *
   * @return array
   *   An array of attachments, for use with #attached.
   *
   * @see drupal_process_attached()
   */
  public function getAttachments();

}

Members

Namesort descending Modifiers Type Description Overrides
EditPluginInterface::getAttachments public function Returns the attachments for this editor. 4
EditPluginInterface::getMetadata public function Generates metadata that is needed specifically for this editor. 2
EditPluginInterface::isCompatible public function Checks whether this editor is compatible with a given field instance. 4
PluginInspectionInterface::getPluginDefinition public function Returns the definition of the plugin implementation. 1
PluginInspectionInterface::getPluginId public function Returns the plugin_id of the plugin instance. 1