function _media_gallery_ensure_field in Media Gallery 7
Same name and namespace in other branches
- 7.2 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.
4 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_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 737 - 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);
}
}