public function TestFieldsSelectionBehavior::buildConfigurationForm

Overrides ParagraphsBehaviorBase::buildConfigurationForm

File

paragraphs/tests/modules/paragraphs_test/src/Plugin/paragraphs/Behavior/TestFieldsSelectionBehavior.php, line 24

Class

TestFieldsSelectionBehavior
Test plugin with field selection.

Namespace

Drupal\paragraphs_test\Plugin\paragraphs\Behavior

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $form['field_selection_filter'] = [
    '#type' => 'select',
    '#options' => $this
      ->getFieldNameOptions($form_state
      ->getFormObject()
      ->getEntity(), 'image'),
    '#title' => $this
      ->t('Paragraph fields'),
    '#default_value' => $this->configuration['field_selection_filter'],
    '#description' => $this
      ->t("Choose filtered paragraph field to be applied."),
  ];
  $form['field_selection'] = [
    '#type' => 'select',
    '#options' => $this
      ->getFieldNameOptions($form_state
      ->getFormObject()
      ->getEntity()),
    '#title' => $this
      ->t('Paragraph fields'),
    '#default_value' => $this->configuration['field_selection'],
    '#description' => $this
      ->t("Choose paragraph field to be applied."),
  ];
  return $form;
}