function flexiform_get_element_info in Flexiform 7
Get information about flexiform elements.
5 calls to flexiform_get_element_info()
- FlexiformElement::createElement in includes/
flexiform.element.inc - Create an element object.
- FlexiformElement::getElement in includes/
flexiform.element.inc - Get an element object.
- FlexiformElement::__construct in includes/
flexiform.element.inc - Construct the class.
- flexiform_field_create_instance in ./
flexiform.module - Implements hook_field_create_instance().
- flexiform_field_element_options in ./
flexiform.admin.inc - Get all available elements for a given entity
File
- ./
flexiform.module, line 629 - Module for the Flexiform system.
Code
function flexiform_get_element_info($entity_type = '', $bundle = '', $name = '', $reset = FALSE) {
$elements =& drupal_static(__FUNCTION__);
if (!isset($elements) || $reset) {
if (($cache = cache_get('flexiform:element_info', 'cache')) && !$reset) {
$elements = $cache->data;
}
else {
$elements = array();
$elements = module_invoke_all('flexiform_element_info');
// Make sure the entity_type, bundle and name are set.
foreach ($elements as $entity_type_ => $elems) {
foreach ($elems as $bundle_ => $els) {
foreach ($els as $name_ => $element) {
$elements[$entity_type_][$bundle_][$name_] += array(
'entity_type' => $entity_type_,
'bundle' => $bundle_,
'name' => $name_,
'group' => 'Other',
);
}
}
}
// Alter the data sets with hook_party_data_set_info_alter().
drupal_alter('flexiform_element_info', $elements);
cache_set('flexiform:element_info', $elements);
}
}
if (!empty($entity_type)) {
if (!empty($bundle)) {
if (!empty($name)) {
return isset($elements[$entity_type][$bundle][$name]) ? $elements[$entity_type][$bundle][$name] : FALSE;
}
return isset($elements[$entity_type][$bundle]) ? $elements[$entity_type][$bundle] : FALSE;
}
return isset($elements[$entity_type]) ? $elements[$entity_type] : FALSE;
}
return $elements;
}