buildFormStyle example

    $form['displays']['page']['options']['style']['style_plugin'] = [
      '#title' => $this->t('Display format'),
      '#type' => 'select',
      '#options' => $style_options,
    ];
    $style_form = &$form['displays']['page']['options']['style'];
    $style_form['style_plugin']['#default_value'] = static::getSelected($form_state['page', 'style', 'style_plugin'], 'default', $style_form['style_plugin']);
    // Changing this dropdown updates $form['displays']['page']['options'] via     // AJAX.     views_ui_add_ajax_trigger($style_form, 'style_plugin', ['displays', 'page', 'options']);

    $this->buildFormStyle($form$form_state, 'page');
    $form['displays']['page']['options']['items_per_page'] = [
      '#title' => $this->t('Items to display'),
      '#type' => 'number',
      '#default_value' => 10,
      '#min' => 0,
    ];
    $form['displays']['page']['options']['pager'] = [
      '#title' => $this->t('Use a pager'),
      '#type' => 'checkbox',
      '#default_value' => TRUE,
    ];
    
Home | Imprint | This part of the site doesn't use cookies.