function fe_paths_get_available_fields in File Entity Paths 7.2
Helper function to get, which fields can be choosen in a configuration.
Parameters
$entity_type:
$bundle:
Return value
array The available fields for an entity bundle, keyed by the field's machine name.
2 calls to fe_paths_get_available_fields()
- fe_paths_entity_edit_form in ./
fe_paths.admin.inc - Form builder for File Entity Paths configuration add/edit form.
- fe_paths_update_7002 in ./
fe_paths.install - Implements hook_update_7002();
File
- ./
fe_paths.module, line 882 - Contains functions for the File Entity Paths module.
Code
function fe_paths_get_available_fields($entity_type = NULL, $bundle = NULL) {
$instances = field_info_instances();
$allowed_types = fe_paths_get_allowed_widget_types();
$return = array();
foreach ($instances as $entity_name => $type_bundles) {
if (is_null($entity_type) || $entity_name == $entity_type) {
foreach ($type_bundles as $bundle_name => $bundle_instances) {
if (is_null($bundle) || $bundle_name == $bundle) {
foreach ($bundle_instances as $field_name => $instance) {
if (in_array($instance['widget']['type'], $allowed_types) || !empty($instance['settings']['text_processing'])) {
$return[$field_name] = $instance['label'] . ' (' . $field_name . ')';
}
}
}
}
}
}
return $return;
}