function AjaxTestImageEffect::buildConfigurationForm

Same name in other branches
  1. 9 core/modules/image/tests/modules/image_module_test/src/Plugin/ImageEffect/AjaxTestImageEffect.php \Drupal\image_module_test\Plugin\ImageEffect\AjaxTestImageEffect::buildConfigurationForm()
  2. 8.9.x core/modules/image/tests/modules/image_module_test/src/Plugin/ImageEffect/AjaxTestImageEffect.php \Drupal\image_module_test\Plugin\ImageEffect\AjaxTestImageEffect::buildConfigurationForm()
  3. 11.x core/modules/image/tests/modules/image_module_test/src/Plugin/ImageEffect/AjaxTestImageEffect.php \Drupal\image_module_test\Plugin\ImageEffect\AjaxTestImageEffect::buildConfigurationForm()

File

core/modules/image/tests/modules/image_module_test/src/Plugin/ImageEffect/AjaxTestImageEffect.php, line 34

Class

AjaxTestImageEffect
Provides a test effect using Ajax in the configuration form.

Namespace

Drupal\image_module_test\Plugin\ImageEffect

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form['test_parameter'] = [
        '#type' => 'number',
        '#title' => $this->t('Test parameter'),
        '#default_value' => $this->configuration['test_parameter'],
        '#min' => 0,
    ];
    $form['ajax_refresh'] = [
        '#type' => 'button',
        '#value' => $this->t('Ajax refresh'),
        '#ajax' => [
            'callback' => [
                $this,
                'ajaxCallback',
            ],
        ],
    ];
    $form['ajax_value'] = [
        '#id' => 'ajax-value',
        '#type' => 'item',
        '#title' => $this->t('Ajax value'),
        '#markup' => 'bar',
    ];
    return $form;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.