class RulesTaxonomyVocabularyWrapper

A custom wrapper class for vocabularies.

This class is capable of loading vocabularies by machine name.

Hierarchy

Expanded class hierarchy of RulesTaxonomyVocabularyWrapper

Related topics

1 string reference to 'RulesTaxonomyVocabularyWrapper'
rules_rules_core_data_info in modules/rules_core.rules.inc
Implements hook_rules_data_info() on behalf of the pseudo rules_core module.

File

modules/rules_core.eval.inc, line 253

View source
class RulesTaxonomyVocabularyWrapper extends EntityDrupalWrapper {
    
    /**
     * Overridden to support identifying vocabularies by machine names.
     */
    protected function setEntity($data) {
        if (isset($data) && $data !== FALSE && !is_object($data) && !is_numeric($data)) {
            // The vocabulary name has been passed.
            parent::setEntity(taxonomy_vocabulary_machine_name_load($data));
        }
        else {
            parent::setEntity($data);
        }
    }
    
    /**
     * Overridden to permit machine names as values.
     */
    public function validate($value) {
        if (isset($value) && is_string($value)) {
            return TRUE;
        }
        return parent::validate($value);
    }

}

Members

Title Sort descending Modifiers Object type Summary
RulesTaxonomyVocabularyWrapper::setEntity protected function Overridden to support identifying vocabularies by machine names.
RulesTaxonomyVocabularyWrapper::validate public function Overridden to permit machine names as values.