protected function AbstractSynonymsBehavior::synonymsFindProcessCondition in Synonyms 7
Process condition in 'synonymsFind' method.
Process condition in 'synonymsFind' method replacing all references of synonym and entity ID columns with the real names of those columns.
Parameters
QueryConditionInterface $condition: Condition that should be processed
string $column_synonym: Real name of the synonym column
string $column_entity_id: Real name of the entity ID column
7 calls to AbstractSynonymsBehavior::synonymsFindProcessCondition()
- AbstractPropertySynonymsBehavior::synonymsFind in synonyms_provider_property/
includes/ AbstractPropertySynonymsBehavior.class.inc - Look up entities by their synonyms within a behavior implementation.
- CommercePriceSynonymsBehavior::synonymsFind in synonyms_commerce/
includes/ CommercePriceSynonymsBehavior.class.inc - Look up entities by their synonyms within a behavior implementation.
- CommerceProductReferenceSynonymsBehavior::synonymsFind in synonyms_commerce/
includes/ CommerceProductReferenceSynonymsBehavior.class.inc - Look up entities by their synonyms within a behavior implementation.
- EntityReferenceSynonymsBehavior::synonymsFind in synonyms_provider_field/
includes/ EntityReferenceSynonymsBehavior.class.inc - Look up entities by their synonyms within a behavior implementation.
- MySynonymsSynonymsBehavior::synonymsFind in ./
synonyms.api.php - Look up entities by their synonyms within a behavior implementation.
File
- includes/
SynonymsBehavior.interface.inc, line 151 - Interfaces of synonyms behaviors that are shipped with Synonyms module.
Class
- AbstractSynonymsBehavior
- Starting point for implementing SynonymsBehavior interface.
Code
protected function synonymsFindProcessCondition(QueryConditionInterface $condition, $column_synonym, $column_entity_id) {
$condition_array =& $condition
->conditions();
foreach ($condition_array as &$v) {
if (is_array($v) && isset($v['field'])) {
if ($v['field'] instanceof QueryConditionInterface) {
// Recursively process this condition too.
$this
->synonymsFindProcessCondition($v['field'], $column_synonym, $column_entity_id);
}
else {
$replace = array(
self::COLUMN_SYNONYM_PLACEHOLDER => $column_synonym,
self::COLUMN_ENTITY_ID_PLACEHOLDER => $column_entity_id,
);
$v['field'] = str_replace(array_keys($replace), array_values($replace), $v['field']);
}
}
}
}