You are here

protected function WebformResultsCustomForm::buildRow in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Form/WebformResultsCustomForm.php \Drupal\webform\Form\WebformResultsCustomForm::buildRow()

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/WebformResultsCustomForm.php, line 364

Class

WebformResultsCustomForm
Webform for webform results custom(ize) webform.

Namespace

Drupal\webform\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,
    ],
  ];
}