You are here

function _media_gallery_ensure_instance in Media Gallery 7

Same name and namespace in other branches
  1. 7.2 media_gallery.install \_media_gallery_ensure_instance()
4 calls to _media_gallery_ensure_instance()
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_media_instances in ./media_gallery.install
Makes sure media entities have the fields media gallery requires.

File

./media_gallery.install, line 744
Install file for media_gallery. Includes field and instance definitions.

Code

function _media_gallery_ensure_instance($instance) {
  $existing_instance = field_info_instance($instance['entity_type'], $instance['field_name'], $instance['bundle']);
  if (empty($existing_instance)) {
    field_create_instance($instance);
  }
}