You are here

function _field_paragraphs_table_get_title in Paragraphs table 7

Helps find the title of the field, as it could be in several places.

1 call to _field_paragraphs_table_get_title()
theme_paragraphs_table_multiple_value_fields in theme/theme.inc
Replacement for theme_field_multiple_value_form().

File

theme/theme.inc, line 174
Theme defined for Paragraph table module.

Code

function _field_paragraphs_table_get_title($field) {
  $title = '';
  $required = FALSE;
  if (isset($field['#language']) && isset($field[$field['#language']])) {
    $language = $field['#language'];
    if (isset($field[$language]['#title'])) {
      $title = $field[$language]['#title'];
      $required = !empty($field[$language]['#required']);
    }
    elseif (isset($field[$language][0]['#title'])) {
      $title = $field[$language][0]['#title'];
      $required = !empty($field[$language][0]['#required']);
    }
    if (empty($title) && !empty($field[$language]['select']['#title'])) {
      $title = $field[$language]['select']['#title'];
    }
  }
  elseif (isset($field['#title'])) {
    $title = empty($field['#is_weight']) ? $field['#title'] : t('Order');
    $required = !empty($field['#required']);
  }
  elseif (isset($field['#value'])) {
    $title = $field['#value'];
    $required = !empty($field['#required']);
  }
  $required = $required ? theme('form_required_marker', array(
    'element' => $field,
  )) : '';
  return t('!title !required', array(
    '!title' => $title,
    '!required' => $required,
  ));
}