function nice_imagefield_widget_test_install in Nice ImageField Widget 7
Same name and namespace in other branches
- 7.2 nice_imagefield_widget_example/nice_imagefield_widget_example.install \nice_imagefield_widget_test_install()
Implements hook_install().
File
- nice_imagefield_widget_example/
nice_imagefield_widget_example.install, line 11 - Contains install and update functions for Nice ImageField Widget Example.
Code
function nice_imagefield_widget_test_install() {
$types = array(
array(
'type' => 'nice_gallery',
'name' => st('Nice Gallery'),
'base' => 'node_content',
'description' => st('Use <em>gallery</em> for content like posts with multiple images.'),
'custom' => 1,
'modified' => 1,
'locked' => 0,
),
);
foreach ($types as $type) {
$type = node_type_set_defaults($type);
node_type_save($type);
}
// Create an image field named "Images", enabled for the 'nice_gallery' content type.
$field = array(
'field_name' => 'field_nice_images',
'type' => 'image',
'cardinality' => -1,
'locked' => FALSE,
'indexes' => array(
'fid' => array(
'fid',
),
),
'settings' => array(
'uri_scheme' => 'public',
'default_image' => FALSE,
),
'storage' => array(
'type' => 'field_sql_storage',
'settings' => array(),
),
);
field_create_field($field);
$instance = array(
'field_name' => 'field_nice_images',
'entity_type' => 'node',
'label' => 'Images',
'bundle' => 'nice_gallery',
'required' => TRUE,
'settings' => array(
'file_directory' => 'galleries',
'file_extensions' => 'png gif jpg jpeg',
'max_filesize' => '',
'max_resolution' => '',
'min_resolution' => '',
'alt_field' => TRUE,
'title_field' => TRUE,
),
'widget' => array(
'type' => 'image_nice',
'settings' => array(
'progress_indicator' => 'throbber',
'preview_image_style' => 'nice_image',
),
'weight' => -1,
),
'display' => array(
'default' => array(
'label' => 'hidden',
'type' => 'image',
'settings' => array(
'image_style' => 'nice_image',
'image_link' => '',
),
'weight' => -1,
),
'teaser' => array(
'label' => 'hidden',
'type' => 'image',
'settings' => array(
'image_style' => 'nice_image',
'image_link' => 'content',
),
'weight' => -1,
),
),
);
field_create_instance($instance);
}