You are here

function hook_custom_formatters_defaults in Custom Formatters 7.2

Same name and namespace in other branches
  1. 6 custom_formatters.api.php \hook_custom_formatters_defaults()

Implements hook_custom_formatters_defaults().

2 functions implement hook_custom_formatters_defaults()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

custom_formatters_custom_formatters_defaults in includes/custom_formatters.inc
Implements hook_custom_formatters_defaults().
custom_formatters_test_custom_formatters_defaults in tests/custom_formatters_test.module
Implements hook_custom_formatters_defaults().

File

./custom_formatters.api.php, line 28
Hooks provided by the Custom Formatters module.

Code

function hook_custom_formatters_defaults() {
  $formatter = new stdClass();
  $formatter->disabled = FALSE;

  /* Edit this to true to make a default formatter disabled initially */
  $formatter->api_version = 2;
  $formatter->name = 'MYMODULE';
  $formatter->label = 'MYMODULE';
  $formatter->description = 'A PHP example formatter; Display a Thumbnail image linked to a Large image.';
  $formatter->mode = 'php';
  $formatter->field_types = 'image';
  $formatter->code = 'foreach (element_children($variables[\'#items\']) as $delta) {
  $item = $variables[\'#items\'][$delta];
  $thumbnail = theme(\'image_style\', array(\'style_name\' => \'thumbnail\', \'path\' => $item[\'uri\']));
  $large = image_style_path(\'large\', $item[\'uri\']);

  print l($thumbnail, file_create_url($large), array(\'html\' => TRUE));
}';
  $formatters['example_php_image'] = $formatter;
  return $formatters;
}