Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Implements hook_field_formatter_info().
- */
- function ft_continent_field_formatter_info() {
- return array(
- 'anchor_title' => array(
- 'label' => t('Anchor title'),
- 'field types' => array('text'),
- ),
- );
- }
- /**
- * Implements hook_field_formatter_view().
- */
- function ft_continent_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
- $element = array();
- switch ($display['type']) {
- // Formatter fo anchor title.
- case 'anchor_title':
- foreach ($items as $delta => $item) {
- $id = drupal_html_id($item['value']);
- $element[$delta] = array('#markup' => '<h3 id="' . $id . '">'. strip_tags($item['value'] . '</h3>'));
- }
- break;
- }
- return $element;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement