array( 'title' => t('view full materiau description'), 'description' => t('view full materiau description'), ), ); } /** * Implements hook_preprocess(). */ function materio_display_preprocess_field(&$vars, $hook) { // dsm($vars); $element = $vars['element']; if($element['#field_name'] == 'field_description'){ // dsm($vars); if(!user_access('view full materiau description')){ $value = $element['#items'][0]['value']; switch ($element['#view_mode']) { case 'cardbig': case 'cardfull': $limit = 210; break; default: $limit = 130; break; } $summary = truncate_utf8($value, $limit, TRUE, TRUE); $summary .= '

' . t("In order to access full description, information about manufacturers and more, you need to upgrade your account.") . l(t("Pricing"), 'node/11187') . '

'; // dsm($summary); $vars['items'][0]['#markup'] = $summary; } } } /** * Implements hook_entity_info_alter(). */ function materio_display_entity_info_alter(&$entity_info) { $entity_info['node']['view modes']['homeblock'] = array( 'label' => t('Home block'), 'custom settings' => TRUE, ); }