function iss_image_field_name_options in Image Style Selector 7
Retrieves a list of image fields that are available for the entity's bundle.
Parameters
string $entity_type: The machine name of the entity type.
string $bundle: The machine name of the bundle.
Return value
string[] Returns machine names of all image fields that are available for the provided entity's bundle.
1 call to iss_image_field_name_options()
- iss_field_instance_settings_form in ./
iss.module - Implements hook_field_instance_settings_form().
File
- ./
iss.module, line 102 - Image Style Selector field.
Code
function iss_image_field_name_options($entity_type, $bundle) {
$image_field_names = array();
// Get all fields that are associated to this entity's bundle.
$fields = field_info_instances($entity_type, $bundle);
foreach ($fields as $field_name => $value) {
$field = field_info_field($field_name);
// When it is an image field add it to the array that will be returned.
if ($field['type'] == 'image') {
$image_field_names[$field_name] = $fields[$field_name]['label'];
}
}
return $image_field_names;
}