function synonyms_behavior_get_all_enabled in Synonyms 7
Load all enabled behavior implementations on an entity_type and a bundle.
This is useful when you want to do some operation on all enabled behavior implementations for a specific entity_type and a bundle.
Parameters
string $entity_type: Optionally filter by entity type whose enabled behavior implementations should be loaded
string|array $bundle: Optionally filter by bundle whose enabled behavior implementations should be loaded. You can supply here string - single bundle name or an array of bundle names. Empty array implies all existing bundle names for a provided $entity_type
string $provider: Optional filter to only return enabled synonyms behavior implementations of a specific provider
string $behavior: Optional filter to only return enabled synonyms behavior implementations of a specific behavior
Return value
array Array of enabled behavior implementations for a provided entity type and a bundle. Return structure of this function is identical to the return structure of synonyms_behavior_get()
10 calls to synonyms_behavior_get_all_enabled()
- synonyms_add_entity_as_synonym in ./
synonyms.module - Allow to merge $synonym_entity as a synonym into $trunk_entity.
- synonyms_features_export in ./
synonyms.features.inc - Implements hook_features_export().
- synonyms_features_export_options in ./
synonyms.features.inc - Implements hook_features_export_options().
- synonyms_features_export_render in ./
synonyms.features.inc - Implements hook_features_export_render().
- synonyms_get_raw in ./
synonyms.module - Retrieve list of raw synonyms of an entity.
File
- ./
synonyms.module, line 997 - Provide synonyms feature for Drupal entities.
Code
function synonyms_behavior_get_all_enabled($entity_type = NULL, $bundle = array(), $provider = NULL, $behavior = NULL) {
$query = db_select('synonyms_settings', 's');
$query
->fields('s');
if ($entity_type) {
$query
->condition('entity_type', $entity_type);
$query
->condition('bundle', synonyms_bundle_normalize($entity_type, $bundle));
}
if ($provider) {
$query
->condition('provider', $provider);
}
if ($behavior) {
$query
->condition('behavior', $behavior);
}
$result = $query
->execute();
$behavior_implementations = array();
foreach ($result as $row) {
$behavior_implementations[] = (array) $row;
}
return synonyms_behavior_settings_unpack($behavior_implementations);
}