e589fa3dce9b4efa0a489fba03636e9c395fa199
[yaffs-website] / web / modules / contrib / entity_browser / src / FieldWidgetDisplayInterface.php
1 <?php
2
3 namespace Drupal\entity_browser;
4
5 use Drupal\Component\Plugin\ConfigurablePluginInterface;
6 use Drupal\Component\Plugin\PluginInspectionInterface;
7 use Drupal\Core\Entity\EntityInterface;
8 use Drupal\Core\Entity\EntityTypeInterface;
9 use Drupal\Core\Form\FormStateInterface;
10
11 /**
12  * Defines the interface for entity browser field widget display plugins.
13  */
14 interface FieldWidgetDisplayInterface extends PluginInspectionInterface, ConfigurablePluginInterface {
15
16   /**
17    * Builds and gets render array for the entity.
18    *
19    * @param EntityInterface $entity
20    *   Entity to be displayed.
21    *
22    * @return array
23    *   Render array that is to be used to display the entity in field widget.
24    */
25   public function view(EntityInterface $entity);
26
27   /**
28    * Returns a form to configure settings for the plugin.
29    *
30    * @param array $form
31    *   The form where the settings form is being included in.
32    * @param \Drupal\Core\Form\FormStateInterface $form_state
33    *   The current state of the form.
34    *
35    * @return array
36    *   The form definition for the widget settings.
37    */
38   public function settingsForm(array $form, FormStateInterface $form_state);
39
40   /**
41    * Returns if the FieldWidgetDisplay can be used for the provided field.
42    *
43    * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
44    *   The entity type that should be checked.
45    *
46    * @return bool
47    *   TRUE if the FieldWidgetDisplay can be used, FALSE otherwise.
48    */
49   public function isApplicable(EntityTypeInterface $entity_type);
50
51 }