You are here

function ImageFieldTestCase::createImageField in ImageField 6.3

Create a new image field.

Parameters

$name: The name of the new field (all lowercase), exclude the "field_" prefix.

$type: The node type that this field will be added to.

$field_options: A list of field options that will be added to the defaults.

$widget_options: A list of widget options that will be added to the widget defaults.

2 calls to ImageFieldTestCase::createImageField()
ImageFieldDisplayTestCase::testDefaultImage in tests/imagefield.test
Test normal formatter display on node display.
ImageFieldDisplayTestCase::testNodeDisplay in tests/imagefield.test
Test normal formatter display on node display.

File

tests/imagefield.test, line 26

Class

ImageFieldTestCase

Code

function createImageField($name, $type, $field_options = array(), $widget_options = array()) {
  $display_options = array(
    'label' => array(
      'format' => 'above',
    ),
    'teaser' => array(
      'format' => 'image_plain',
      'exclude' => 0,
    ),
    'full' => array(
      'format' => 'image_plain',
      'exclude' => 0,
    ),
  );
  $field_options = array_merge(array(
    'widget_type' => 'imagefield_widget',
    'display_settings' => $display_options,
  ), $field_options);
  $widget_options = array_merge(array(
    'type' => 'imagefield_widget',
    'file_extensions' => 'jpg jpeg png gif',
    'custom_alt' => '1',
    'custom_title' => '1',
    'max_resolution' => '',
    'min_resolution' => '',
  ), $widget_options);
  return parent::createFileField($name, $type, $field_options, $widget_options);
}