function _media_gallery_ensure_field in Media Gallery 7.2
Same name and namespace in other branches
- 7 media_gallery.install \_media_gallery_ensure_field()
Create a field, unless it exists already.
Note that it's not necessary to check field type here, as that's done in the requirements step.
Parameters
$field: The field definition.
5 calls to _media_gallery_ensure_field()
- media_gallery_install in ./
media_gallery.install - Implements hook_install().
- media_gallery_update_7000 in ./
media_gallery.install - Set the default value of media_gallery_expose_block to zero In order to have the expose block checkbox appear above the column and row number dropdowns it was necessary to update those field instances with their initial values, essentially refreshing…
- media_gallery_update_7006 in ./
media_gallery.install - Make sure the gallery node form includes the media_gallery_lightbox_extras checkbox.
- media_gallery_update_7200 in ./
media_gallery.install - Converts old media_gallery_media field to media_gallery_file field.
- _media_gallery_ensure_field_tags in ./
media_gallery.install - Make sure the field_tags field exists and is of the right type.
File
- ./
media_gallery.install, line 736 - Install file for media_gallery. Includes field and instance definitions.
Code
function _media_gallery_ensure_field($field) {
$existing_field = field_read_field($field['field_name'], array(
'include_inactive' => TRUE,
));
if (empty($existing_field)) {
field_create_field($field);
}
}