You are here

function _assets_get_overridable_fields in Asset 7

Helper function to check the asset field. Can we provide an override for its value or not.

1 call to _assets_get_overridable_fields()
assets_pre_render_text_format in ./asset.module
This function adds a settings required by assets

File

./asset.module, line 600
Asset module.

Code

function _assets_get_overridable_fields($asset_type) {
  $cache = drupal_static(__FUNCTION__, array());
  if (!isset($cache[$asset_type])) {
    $types = _assets_get_overridable_field_types();
    $cache[$asset_type] = array();
    $fields_info = field_info_instances('asset', $asset_type);
    foreach ($fields_info as $field_info) {
      if (!$field_info['required']) {
        $field_name = $field_info['field_name'];
        $label = $field_info['label'];
        $info = field_info_field($field_name);
        if ($info && isset($types[$info['type']])) {
          $cache[$asset_type][$field_name] = array(
            'type' => $info['type'],
            'label' => $label,
          );
        }
      }
    }
  }
  return $cache[$asset_type];
}