You are here

protected function YamlFormResultsCustomForm::buildRow in YAML Form 8

Build table row for a results columns.

Parameters

string $column_name: The column name.

array $column: The column.

bool $default_value: Whether the column should be checked.

int $weight: The columns weights.

int $delta: The max delta for the weight element.

Return value

array A renderable containing a table row for a results column.

File

src/Form/YamlFormResultsCustomForm.php, line 238

Class

YamlFormResultsCustomForm
Form for form results custom(ize) form.

Namespace

Drupal\yamlform\Form

Code

protected function buildRow($column_name, array $column, $default_value, $weight, $delta) {
  return [
    '#attributes' => [
      'class' => [
        'draggable',
      ],
    ],
    'name' => [
      '#type' => 'checkbox',
      '#default_value' => $default_value,
    ],
    'title' => [
      '#markup' => $column['title'],
    ],
    'key' => [
      '#markup' => isset($column['key']) ? $column['key'] : $column['name'],
    ],
    'weight' => [
      '#type' => 'weight',
      '#title' => $this
        ->t('Weight for @label', [
        '@label' => $column['title'],
      ]),
      '#title_display' => 'invisible',
      '#attributes' => [
        'class' => [
          'table-sort-weight',
        ],
      ],
      '#delta' => $delta,
      '#default_value' => $weight,
    ],
  ];
}