You are here

public function LayoutParagraphsBehavior::buildConfigurationForm in Layout Paragraphs 2.0.x

File

src/Plugin/paragraphs/Behavior/LayoutParagraphsBehavior.php, line 223

Class

LayoutParagraphsBehavior
Provides a way to define grid based layouts.

Namespace

Drupal\layout_paragraphs\Plugin\paragraphs\Behavior

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $options = $this->layoutPluginManager
    ->getLayoutOptions();
  $available_layouts = $this->configuration['available_layouts'];
  $form['available_layouts'] = [
    '#title' => $this
      ->t('Available Layouts'),
    '#type' => 'select',
    '#multiple' => TRUE,
    '#options' => $options,
    '#default_value' => array_keys($available_layouts),
    '#size' => count($options) < 8 ? count($options) * 2 : 10,
    '#required' => FALSE,
  ];
  return $form;
}