class AbstractPropertySynonymsBehavior in Synonyms 7
Definition of AbstractPropertySynonymsBehavior class.
Hierarchy
- class \AbstractSynonymsBehavior implements SynonymsBehavior
- class \AbstractPropertySynonymsBehavior implements AutocompleteSynonymsBehavior, SelectSynonymsBehavior
Expanded class hierarchy of AbstractPropertySynonymsBehavior
File
- synonyms_provider_property/
includes/ AbstractPropertySynonymsBehavior.class.inc, line 11 - Abstract class for enabling entity properties to be source of synonyms.
View source
class AbstractPropertySynonymsBehavior extends AbstractSynonymsBehavior implements AutocompleteSynonymsBehavior, SelectSynonymsBehavior {
/**
* Name of the property on which this provider was initialized.
*
* @var string
*/
protected $property;
/**
* Entity info of the entity type on which this provider was initialized.
*
* @var array
*/
protected $entity_info;
public function __construct($behavior_implementation) {
parent::__construct($behavior_implementation);
$this->property = synonyms_provider_property_name($this->behavior_implementation['provider']);
$this->entity_info = entity_get_info($this->behavior_implementation['entity_type']);
}
public function extractSynonyms($entity, $langcode = NULL) {
$synonyms = array();
if (isset($entity->{$this->property}) && $entity->{$this->property}) {
$synonyms[] = $entity->{$this->property};
}
return $synonyms;
}
public function mergeEntityAsSynonym($trunk_entity, $synonym_entity, $synonym_entity_type) {
// TODO: what to do ???
}
public function synonymsFind(QueryConditionInterface $condition) {
$query = db_select($this->entity_info['base table'], 'base');
$query
->addField('base', $this->entity_info['entity keys']['id'], 'entity_id');
$query
->addField('base', $this->property, 'synonym');
$this
->synonymsFindProcessCondition($condition, 'base.' . $this->property, 'base.' . $this->entity_info['entity keys']['id']);
$query
->condition($condition);
return $query
->execute();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AbstractPropertySynonymsBehavior:: |
protected | property | Entity info of the entity type on which this provider was initialized. | |
AbstractPropertySynonymsBehavior:: |
protected | property | Name of the property on which this provider was initialized. | |
AbstractPropertySynonymsBehavior:: |
public | function |
Extract synonyms from an entity within a specific behavior implementation. Overrides SynonymsBehavior:: |
|
AbstractPropertySynonymsBehavior:: |
public | function |
Add an entity as a synonym into another entity. Overrides SynonymsBehavior:: |
|
AbstractPropertySynonymsBehavior:: |
public | function |
Look up entities by their synonyms within a behavior implementation. Overrides SynonymsBehavior:: |
|
AbstractPropertySynonymsBehavior:: |
public | function |
Overrides AbstractSynonymsBehavior:: |
|
AbstractSynonymsBehavior:: |
protected | property | Behavior implementation on which this class was initialized. | |
AbstractSynonymsBehavior:: |
constant | Constant which denotes placeholder of an entity ID column. | ||
AbstractSynonymsBehavior:: |
constant | Constant which denotes placeholder of a synonym column. | ||
AbstractSynonymsBehavior:: |
public | function |
Collect info on features pipe during invocation of hook_features_export(). Overrides SynonymsBehavior:: |
2 |
AbstractSynonymsBehavior:: |
protected | function | Process condition in 'synonymsFind' method. |