You are here

function acquia_lift_profiles_thumbnail_available_fields in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift_profiles/acquia_lift_profiles.admin.inc \acquia_lift_profiles_thumbnail_available_fields()

Given an entity type machine name, returns available image fields.

Parameters

$entity_type: Type of entity to load fields, e.g., 'node'.

$bundle: The name of the entity bundle for fields, e.g., 'article'

$limit_style_support: True if fields should be limited to those with image style support.

2 calls to acquia_lift_profiles_thumbnail_available_fields()
acquia_lift_profiles_thumbnail_entity_settings_form in acquia_lift_profiles/acquia_lift_profiles.admin.inc
Administrative form to select the thumbnail image to use per content type/ entity bundle.
acquia_lift_profiles_thumbnail_get_field in acquia_lift_profiles/acquia_lift_profiles.module
Given an entity type and bundle, get its content recommendation image or NULL.

File

acquia_lift_profiles/acquia_lift_profiles.admin.inc, line 376
acquia_lift_profiles.admin.inc Provides functions needed for the admin UI.

Code

function acquia_lift_profiles_thumbnail_available_fields($entity_type, $bundle, $limit_style_support = FALSE) {
  $fields = array();
  foreach (field_info_instances($entity_type, $bundle) as $name => $info) {
    $supported_widget_types = _acquia_lift_profiles_thumbnail_supported_widgets();
    if (isset($info['widget']['type']) && array_key_exists($info['widget']['type'], $supported_widget_types)) {
      $key = $name . ACQUIA_LIFT_PROFILES_THUMBNAIL_WIDGET_SEPARATOR . $info['widget']['type'];
      if (!$limit_style_support || $supported_widget_types[$info['widget']['type']]['use_styles']) {
        $fields[$key] = $info['label'] . ' (' . $name . ')';
      }
    }
  }
  return $fields;
}