You are here

function _paragraphs_table_vertical in Paragraphs table 8

Make subform table vertical.

1 call to _paragraphs_table_vertical()
paragraphs_table_preprocess_field_multiple_value_form in ./paragraphs_table.module
Implements hook_preprocess_HOOK().

File

./paragraphs_table.module, line 248
Contains paragraphs_table.module.

Code

function _paragraphs_table_vertical($fields, $rows_data, $delta = 0) {
  $subform = [
    "#type" => 'table',
  ];
  $row_index = 0;
  foreach ($fields as $field_name => $field) {
    $subform[$row_index]['_name'] = [
      '#markup' => $field
        ->getLabel(),
    ];
    $field_form = $rows_data[$field_name];
    if (!empty($field_form['widget'])) {
      _paragraphs_table_hidden_label($field_form['widget']);
    }
    $subform[$row_index++][$field_name] = $field_form;
  }
  return $subform;
}