1a1dbae6793dfa61b3cd7a3a2c6d4587e412be04
[yaffs-website] / Plugin / EntityBrowser / SelectionDisplay / NoDisplay.php
1 <?php
2
3 namespace Drupal\entity_browser\Plugin\EntityBrowser\SelectionDisplay;
4
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\entity_browser\SelectionDisplayBase;
7
8 /**
9  * Does not show current selection and immediately delivers selected entities.
10  *
11  * @EntityBrowserSelectionDisplay(
12  *   id = "no_display",
13  *   label = @Translation("No selection display"),
14  *   description = @Translation("Skips the current selection display and immediately delivers the entities selected."),
15  *   acceptPreselection = FALSE,
16  *   js_commands = FALSE
17  * )
18  */
19 class NoDisplay extends SelectionDisplayBase {
20
21   /**
22    * {@inheritdoc}
23    */
24   public function getForm(array &$original_form, FormStateInterface $form_state) {
25     return array();
26   }
27
28   /**
29    * {@inheritdoc}
30    */
31   public function submit(array &$form, FormStateInterface $form_state) {
32     // Only finish selection if the form was submitted using main submit
33     // element. This allows widgets to build multi-step workflows.
34     if (!empty($form_state->getTriggeringElement()['#eb_widget_main_submit'])) {
35       $this->selectionDone($form_state);
36     }
37   }
38
39 }