3 namespace Drupal\entity_browser;
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;
12 * Defines the interface for entity browser field widget display plugins.
14 interface FieldWidgetDisplayInterface extends PluginInspectionInterface, ConfigurablePluginInterface {
17 * Builds and gets render array for the entity.
19 * @param EntityInterface $entity
20 * Entity to be displayed.
23 * Render array that is to be used to display the entity in field widget.
25 public function view(EntityInterface $entity);
28 * Returns a form to configure settings for the plugin.
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.
36 * The form definition for the widget settings.
38 public function settingsForm(array $form, FormStateInterface $form_state);
41 * Returns if the FieldWidgetDisplay can be used for the provided field.
43 * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
44 * The entity type that should be checked.
47 * TRUE if the FieldWidgetDisplay can be used, FALSE otherwise.
49 public function isApplicable(EntityTypeInterface $entity_type);