You are here

function _image_replace_image_instances in Image Replace 7

Collect info for all image field instances on a given entity_type/bundle.

Parameters

string $entity_type: The entity type, e.g. node, for which the info shall be returned.

string $bundle: The bundle name for which to return instances.

Return value

array An associative array of instance arrays keyed by the field name.

2 calls to _image_replace_image_instances()
image_replace_field_attach_presave in ./image_replace.module
Implements hook_field_attach_presave().
image_replace_form_field_ui_field_edit_form_alter in ./image_replace.module
Implements hook_form_FORM_ID_alter().

File

./image_replace.module, line 282
Provides an image style effect replacing the whole image with another one.

Code

function _image_replace_image_instances($entity_type, $bundle) {
  $image_instances = array();
  foreach (field_info_field_map() as $field_name => $info) {
    if ($info['type'] == 'image' && !empty($info['bundles'][$entity_type]) && in_array($bundle, $info['bundles'][$entity_type])) {
      $instance_info = field_info_instance($entity_type, $field_name, $bundle);
      $image_instances[$field_name] = $instance_info;
    }
  }
  return $image_instances;
}