Skip to content
Snippets Groups Projects
Uw5ColumnLayout.php 1.31 KiB
<?php

namespace Drupal\uw_cfg_common\Plugin\Layout;

use Drupal\Core\Form\FormStateInterface;

/**
 * A UW four column layout.
 */
class Uw5ColumnLayout extends UwColumnLayoutBase {

  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {

    // Get the config for this layout.
    $configuration = $this->getConfiguration();

    // The options for the column widths.
    $options = [
      'even-split' => $this->t('Even split (20%, 20%, 20%, 20%, 20%)'),
      'larger-left' => $this->t('Larger left (40%, 15%, 15%, 15%, 15%)'),
      'larger-second' => $this->t('Larger second (15%, 40%, 15%, 15%, 15%)'),
      'larger-third' => $this->t('Larger third (15%, 15%, 40%, 15%, 15%)'),
      'larger-fourth' => $this->t('Larger fourth (15%, 15%, 15%, 40%, 15%)'),
      'larger-right' => $this->t('Larger right (15%, 15%, 15%, 15%, 40%)'),
      'legacy-23-19-19-19-20' => $this->t('Legacy (23%, 19%, 19%, 19%, 20%)'),
    ];

    // The form element for the column widths.
    $form['layout_settings']['column_class'] = [
      '#type' => 'select',
      '#title' => $this->t('Column widths'),
      '#default_value' => !empty($configuration['column_class']) ? $configuration['column_class'] : 'even-split',
      '#options' => $options,
    ];

    return $form;
  }

}