function TestProcessor::buildConfigurationForm

Same name and namespace in other branches
  1. 8.9.x core/modules/aggregator/tests/modules/aggregator_test/src/Plugin/aggregator/processor/TestProcessor.php \Drupal\aggregator_test\Plugin\aggregator\processor\TestProcessor::buildConfigurationForm()

Overrides PluginFormInterface::buildConfigurationForm

File

core/modules/aggregator/tests/modules/aggregator_test/src/Plugin/aggregator/processor/TestProcessor.php, line 74

Class

TestProcessor
Defines a default processor implementation.

Namespace

Drupal\aggregator_test\Plugin\aggregator\processor

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $processors = $this->config('aggregator.settings')
        ->get('processors');
    $info = $this->getPluginDefinition();
    $form['processors'][$info['id']] = [
        '#type' => 'details',
        '#title' => $this->t('Test processor settings'),
        '#description' => $info['description'],
        '#open' => in_array($info['id'], $processors),
    ];
    // Add some dummy settings to verify settingsForm is called.
    $form['processors'][$info['id']]['dummy_length'] = [
        '#title' => $this->t('Dummy length setting'),
        '#type' => 'number',
        '#min' => 1,
        '#max' => 1000,
        '#default_value' => $this->configuration['items']['dummy_length'],
    ];
    return $form;
}

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