public function PagerTestWidget::getForm in Entity Browser 8
Same name and namespace in other branches
- 8.2 tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/PagerTestWidget.php \Drupal\entity_browser_test\Plugin\EntityBrowser\Widget\PagerTestWidget::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/ PagerTestWidget.php, line 31
Class
- PagerTestWidget
- Pager test widget implementation for test purposes.
Namespace
Drupal\entity_browser_test\Plugin\EntityBrowser\WidgetCode
public function getForm(array &$original_form, FormStateInterface $form_state, array $additional_widget_parameters) {
$form = parent::getForm($original_form, $form_state, $additional_widget_parameters);
$form['message'] = [
'#markup' => $this
->t('Current page reported by the element is: @page.', [
'@page' => EntityBrowserPagerElement::getCurrentPage($form_state),
]),
];
$form['first'] = [
'#type' => 'submit',
'#value' => $this
->t('First page'),
'#submit' => [
[
static::class,
'submitFirst',
],
],
];
$form['last'] = [
'#type' => 'submit',
'#value' => $this
->t('Last page'),
'#submit' => [
[
static::class,
'submitLast',
],
],
];
$form['pager_eb'] = [
'#type' => 'entity_browser_pager',
'#total_pages' => 4,
];
return $form;
}