You are here

function _paragraphs_table_row in Paragraphs table 8

Generate table row.

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

File

./paragraphs_table.module, line 204
Contains paragraphs_table.module.

Code

function _paragraphs_table_row($fields, $rows_data, $show_all = FALSE) {
  if (empty($show_all)) {
    $row[] = $rows_data[0];
  }
  if (isset($rows_data[1]["data"]["#access"]) && $rows_data[1]["data"]["#access"] === FALSE) {
    return FALSE;
  }
  if (!empty($rows_data[1]["data"]["subform"])) {
    $subform = $rows_data[1]["data"]["subform"];
  }
  else {
    return FALSE;
  }
  foreach ($fields as $field_name => $field) {
    if (!empty($subform[$field_name])) {
      $field_form = $subform[$field_name];
      if (!empty($field_form['widget'])) {
        _paragraphs_table_hidden_label($field_form['widget']);
      }
      $row[$field_name] = [
        'data' => $field_form,
        'class' => $field_name,
      ];
      unset($subform[$field_name]);
    }
  }
  if (empty($show_all)) {
    $actions = !empty($rows_data[1]["data"]["top"]["actions"]) ? $rows_data[1]["data"]["top"]["actions"] : '';
    if (!empty($actions["actions"]["collapse_button"])) {
      unset($actions["actions"]["collapse_button"]);
    }
    $row[] = [
      'data' => $actions,
      'class' => [
        'action',
      ],
    ];
  }
  $row[] = $rows_data[2];
  return $row;
}