contacts_events-8.x-1.x-dev/modules/villages/src/Plugin/VillageGroupTypeInterface.php
modules/villages/src/Plugin/VillageGroupTypeInterface.php
<?php namespace Drupal\contacts_events_villages\Plugin; use Drupal\contacts_events_villages\Entity\VillageGroupInterface; use Drupal\Core\Field\EntityReferenceFieldItemListInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\entity\BundlePlugin\BundlePluginInterface; /** * Defines an interface for Village group type plugins. */ interface VillageGroupTypeInterface extends BundlePluginInterface { /** * Is the Village Group type expanded into multiple options. * * @return bool * Whether the plugin type expands. */ public function isExpanded() : bool; /** * Build the group entity content subform. * * @param \Drupal\Core\Field\EntityReferenceFieldItemListInterface $items * The village group field items. * * @return array * The form array. */ public function form(EntityReferenceFieldItemListInterface $items); /** * Build entity data from form submission values. * * @param array $values * The values as submitted by the form. * @param \Drupal\contacts_events_villages\Entity\VillageGroupInterface $group * The group being built. * * @return \Drupal\contacts_events_villages\Entity\VillageGroupInterface * The fully built village group entity. */ public function buildFormEntity(array $values, VillageGroupInterface $group) : VillageGroupInterface; /** * Get an existing Village Group if one exists. * * @param \Drupal\contacts_events_villages\Entity\VillageGroupInterface $group * The village group to check for duplicates for. * * @return \Drupal\contacts_events_villages\Entity\VillageGroupInterface * Either the new village group or an existing replacement to prevent * duplicates. */ public function getExisting(VillageGroupInterface $group) : VillageGroupInterface; /** * Performs validation. * * @param array $element * Form element representing the subform generated by this plugin. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current form state. * @param array $complete_form * The complete form. */ public function validate(array &$element, FormStateInterface $form_state, array &$complete_form); /** * Allows pre-processing of the plugin's sub-form. * * @param array $subform * The element representing the sub-form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current form state. * @param array $complete_form * The complete form. * @param string $path_to_containing_widget * The path to the parent widget, in annotated format. * * @return array * The processed form element. */ public function process(array &$subform, FormStateInterface $form_state, array &$complete_form, $path_to_containing_widget); }