You are here

function flexiform_builder_info in Flexiform 7

Get info about all available builders.

2 calls to flexiform_builder_info()
Flexiform::getBuilder in ./flexiform.entity.inc
flexiform_entity_type_get_builders in ./flexiform.module
Get the builders available for a particular base entity type.

File

./flexiform.module, line 483
Module for the Flexiform system.

Code

function flexiform_builder_info($builder = NULL) {
  $builders =& drupal_static(__FUNCTION__, array());
  if (empty($builders)) {
    if ($cache = cache_get('flexiform:builder_info', 'cache')) {
      $builders = $cache->data;
    }
    else {
      $builders = array();
      foreach (module_implements('flexiform_builder_info') as $module) {

        // Due to http://drupal.org/node/890660 we can't use module_invoke_all()
        // because we need to know the provenance of each set.
        $builders_module = module_invoke($module, 'flexiform_builder_info');
        foreach ($builders_module as $builder_name => $builder_info) {
          $builder_info += array(
            'class' => $builder_name,
            'label' => $builder_name,
            'module' => $module,
            'entity_types' => array(),
          );
          $builders[$builder_name] = $builder_info;
        }
      }

      // Alter the data sets with hook_party_data_set_info_alter().
      drupal_alter('flexiform_builder_info', $builders);
      cache_set('flexiform:builder_info', $builders);
    }
  }
  if (!empty($builder)) {
    return $builders[$builder];
  }
  return $builders;
}