function rb_misc_entity_keys in Rules Bonus Pack 7
Helper function to build a simple array of all Rules-supported entity types.
Acutally, this list is built based on which entity types are recognized by Entity API. Since Rules relies on Entity API for entity metadata, this should be perfectly allright.
@staticvar <array> $rb_misc_entity_keys An array with keys and values both set to the entity name, as declared to Entity API.
Parameters
<boolean> $reset: Parameter that may be used to force reloading of the list, rather than fetching the static result.
Return value
<array> The array of entity names (being the static variable described above).
2 calls to rb_misc_entity_keys()
- rb_misc_list_variant_context_entities in ./
rb_misc.module - Helper function to get a list of all configured context objects in variant.
- rb_misc_load_variant_context_entities in ./
rb_misc.module - Helper function to fetch fully loaded context objects from a PM variant.
File
- ./
rb_misc.module, line 66 - A necessary file for letting Drupal know this is a module. All functionality goes into rb_misc.rules.inc.
Code
function rb_misc_entity_keys($reset = FALSE) {
static $rb_misc_entity_keys;
// Build the list of entity keys only if necessary.
if (!is_array($rb_misc_entity_keys || $reset)) {
$rb_misc_entity_keys = array();
foreach (entity_get_info() as $name => $entity) {
$rb_misc_entity_keys[$name] = $name;
}
}
return $rb_misc_entity_keys;
}