function _paragraphs_table_get_field_value in Paragraphs table 7
Custom function to get field value.
File
- ./
paragraphs_table.module, line 404 - Module file for Paragraph table module.
Code
function _paragraphs_table_get_field_value($paragraph, $field_name, $field_type) {
$items = field_get_items('paragraphs_item', $paragraph, $field_name);
$field_value = '';
if (is_array($items)) {
switch ($field_type) {
case 'taxonomy_term_reference':
foreach ($items as $item) {
$field_view = field_view_value('paragraphs_item', $paragraph, $field_name, $item);
$field_value .= $field_view['#title'] . ' ';
}
break;
case 'list_boolean':
foreach ($items as $item) {
$field_value = $item['value'];
}
break;
default:
foreach ($items as $item) {
$field_view = field_view_value('paragraphs_item', $paragraph, $field_name, $item);
$field_value .= $field_view['#markup'] . ' ';
}
break;
}
return $field_value;
}
}