You are here

function picture_link_types in Picture 7

Same name and namespace in other branches
  1. 7.2 picture.module \picture_link_types()

Helper function to compute the list of possible link types.

2 calls to picture_link_types()
picture_field_formatter_settings_form in ./picture.module
Implements hook_field_formatter_settings_form().
picture_field_formatter_settings_summary in ./picture.module
Implements hook_field_formatter_settings_summary().

File

./picture.module, line 1534
Picture formatter.

Code

function picture_link_types($instance) {
  $link_types = array(
    'content' => t('Content'),
    'file' => t('File'),
  );
  if (module_exists('colorbox')) {
    $link_types['colorbox'] = t('Colorbox');
  }

  // If the link module is installed, also allow any link fields to be used.
  foreach (field_info_fields() as $field_key => $field_info) {
    if ($field_info['type'] == 'link_field') {
      $field_instance = field_info_instance($instance['entity_type'], $field_info['field_name'], $instance['bundle']);
      if ($field_instance) {
        $link_types[$field_key] = "{$field_instance['label']} ({$field_info['field_name']})";
      }
    }
  }
  return $link_types;
}