MetadataGeneratorInterface.php 1.24 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
<?php

/**
 * @file
 * Contains \Drupal\edit\MetadataGeneratorInterface.
 */

namespace Drupal\edit;

use Drupal\Core\Entity\EntityInterface;
11
use Drupal\field\Plugin\Core\Entity\FieldInstance;
12
13
14
15
16
17
18
19
20
21
22

/**
 * Interface for generating in-place editing metadata for an entity field.
 */
interface MetadataGeneratorInterface {

  /**
   * Generates in-place editing metadata for an entity field.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity being edited.
23
   * @param \Drupal\field\Plugin\Core\Entity\FieldInstance $instance
24
25
26
27
28
29
30
31
32
33
34
   *   The field instance of the field being edited.
   * @param string $langcode
   *   The name of the language for which the field is being edited.
   * @param string $view_mode
   *   The view mode the field should be rerendered in.
   * @return array
   *   An array containing metadata with the following keys:
   *   - label: the user-visible label for the field.
   *   - access: whether the current user may edit the field or not.
   *   - editor: which editor should be used for the field.
   *   - aria: the ARIA label.
35
   *   - custom: (optional) any additional metadata that the editor provides.
36
37
38
39
   */
  public function generate(EntityInterface $entity, FieldInstance $instance, $langcode, $view_mode);

}