You are here

public function MultipleSubmitTestWidget::getForm in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/MultipleSubmitTestWidget.php \Drupal\entity_browser_test\Plugin\EntityBrowser\Widget\MultipleSubmitTestWidget::getForm()

Returns widget form.

Parameters

array $original_form: Entire form bult up to this point. Form elements for widget should generally not be added directly to it but returned from funciton as a separated unit.

\Drupal\Core\Form\FormStateInterface $form_state: Form state object.

array $additional_widget_parameters: Additional parameters that we want to pass to the widget.

Return value

array Form structure.

Overrides WidgetBase::getForm

File

tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/MultipleSubmitTestWidget.php, line 30

Class

MultipleSubmitTestWidget
Test widget with multiple submit buttons for test purposes.

Namespace

Drupal\entity_browser_test\Plugin\EntityBrowser\Widget

Code

public function getForm(array &$original_form, FormStateInterface $form_state, array $additional_widget_parameters) {
  $form = parent::getForm($original_form, $form_state, $additional_widget_parameters);
  $form['submit_second'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Second submit button'),
  ];
  return $form;
}