You are here

function _slick_get_paragraphs_fields_options in Slick Carousel 7.2

Helper function to get list of supported field base on field_types.

1 call to _slick_get_paragraphs_fields_options()
slick_get_paragraphs_fields in includes/slick.admin.inc
Gets a list of fields in the Paragraphs item.

File

includes/slick.admin.inc, line 427
Contains optional functions called only if needed by admin pages.

Code

function _slick_get_paragraphs_fields_options($allowed_bundles, $entity_type, $field_types) {
  $options = array();
  foreach ($allowed_bundles as $bundle_name => $bundle) {
    if ($bundle !== -1) {
      $fields = field_info_instances($entity_type, $bundle_name);
      foreach ($fields as $name => $field) {
        $info = field_info_field($name);
        if ($field_types == '_all') {
          $options[$name] = $field['label'];
        }
        else {
          if (in_array($entity_type, array_keys($info['bundles'])) && in_array($info['type'], $field_types)) {
            $options[$name] = $field['label'];
          }
        }
      }
    }
  }
  return $options;
}