You are here

class RulesOrganigramsWrapper in Organigrams 7

Custom wrapper class for organigrams for loading organigrams by machine name.

Hierarchy

Expanded class hierarchy of RulesOrganigramsWrapper

1 string reference to 'RulesOrganigramsWrapper'
organigrams_rules_data_info_alter in ./organigrams.rules.inc
Implements hook_rules_data_info_alter().

File

./organigrams.rules.inc, line 183
Rules integration for the organigrams module.

View source
class RulesOrganigramsWrapper extends EntityDrupalWrapper {

  /**
   * Overridden to support identifying organigrams by machine names.
   *
   * @param string $data
   *   Contains a machine name.
   */
  protected function setEntity($data) {
    if (isset($data) && $data !== FALSE && !is_object($data) && !is_numeric($data)) {

      // The organigrams name has been passed.
      parent::setEntity(organigrams_machine_name_load($data));
    }
    else {
      parent::setEntity($data);
    }
  }

  /**
   * Overridden to permit machine names as values.
   *
   * @param string $value
   *   String to validate.
   *
   * @return bool
   *   TRUE is $value is a string, otherwise FALSE.
   */
  public function validate($value) {
    if (isset($value) && is_string($value)) {
      return TRUE;
    }
    return parent::validate($value);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityDrupalWrapper::$bundle protected property
EntityDrupalWrapper::$entityInfo protected property
EntityDrupalWrapper::$id protected property Contains the entity id.
EntityDrupalWrapper::access public function Note that this method checks property access, but can be used for checking entity access *only* if the wrapper is not a property (i.e. has no parent wrapper). To be safe, better use EntityDrupalWrapper::entityAccess() for checking entity access. Overrides EntityMetadataWrapper::access
EntityDrupalWrapper::clear public function Overridden. Overrides EntityStructureWrapper::clear
EntityDrupalWrapper::debugIdentifierLocation public function Returns a string to use to identify this wrapper in error messages. Overrides EntityMetadataWrapper::debugIdentifierLocation
EntityDrupalWrapper::delete public function Permanently delete the wrapped entity.
EntityDrupalWrapper::entityAccess public function Checks whether the operation $op is allowed on the entity.
EntityDrupalWrapper::entityInfo public function Gets the info about the wrapped entity.
EntityDrupalWrapper::entityKey public function Returns the name of the key used by the entity for given entity key.
EntityDrupalWrapper::getBundle public function Returns the bundle of an entity, or FALSE if it has no bundles.
EntityDrupalWrapper::getIdentifier public function Returns the identifier of the wrapped entity. Overrides EntityStructureWrapper::getIdentifier
EntityDrupalWrapper::label public function Returns the entity label. Overrides EntityMetadataWrapper::label
EntityDrupalWrapper::save public function Permanently save the wrapped entity.
EntityDrupalWrapper::set public function Overridden to support setting the entity by either the object or the id. Overrides EntityMetadataWrapper::set
EntityDrupalWrapper::setUp protected function
EntityDrupalWrapper::spotBundleInfo protected function Tries to determine the bundle and adds in the according property info.
EntityDrupalWrapper::spotInfo protected function Used to lazy-load bundle info. So the wrapper can be loaded e.g. just for setting without the data being loaded. Overrides EntityStructureWrapper::spotInfo
EntityDrupalWrapper::type public function Overridden. Overrides EntityMetadataWrapper::type
EntityDrupalWrapper::value public function Overridden. Overrides EntityMetadataWrapper::value
EntityDrupalWrapper::view public function Returns the entity prepared for rendering.
EntityDrupalWrapper::__construct public function Construct a new EntityDrupalWrapper object. Overrides EntityStructureWrapper::__construct
EntityDrupalWrapper::__sleep public function Prepare for serializiation. Overrides EntityStructureWrapper::__sleep
EntityDrupalWrapper::__wakeup public function
EntityMetadataWrapper::$cache protected property
EntityMetadataWrapper::$data protected property
EntityMetadataWrapper::$info protected property
EntityMetadataWrapper::$type protected property 1
EntityMetadataWrapper::dataAvailable protected function Returns whether data is available to work with.
EntityMetadataWrapper::info public function Gets info about the wrapped data.
EntityMetadataWrapper::optionsList public function Returns the options list specifying possible values for the property, if defined.
EntityMetadataWrapper::raw public function Returns the raw, unprocessed data. Most times this is the same as returned by value(), however for already processed and sanitized textual data, this will return the unprocessed data in contrast to value().
EntityMetadataWrapper::updateParent protected function Updates the parent data structure of a data property with the latest data value.
EntityMetadataWrapper::__toString public function
EntityStructureWrapper::$langcode protected property
EntityStructureWrapper::$propertyInfo protected property
EntityStructureWrapper::$propertyInfoDefaults protected property
EntityStructureWrapper::get public function Get the wrapper for a property.
EntityStructureWrapper::getIterator public function
EntityStructureWrapper::getPropertyInfo public function Gets the info about the given property.
EntityStructureWrapper::getPropertyLanguage public function Gets the language used for retrieving properties.
EntityStructureWrapper::getPropertyRaw protected function Gets the raw value of a property.
EntityStructureWrapper::getPropertyValue protected function Gets the value of a property.
EntityStructureWrapper::language public function Sets a new language to use for retrieving properties.
EntityStructureWrapper::propertyAccess protected function
EntityStructureWrapper::refPropertyInfo public function Returns a reference on the property info.
EntityStructureWrapper::setProperty protected function Sets a property.
EntityStructureWrapper::__get public function Magic method: Get a wrapper for a property.
EntityStructureWrapper::__isset public function Magic method: Can be used to check if a property is known.
EntityStructureWrapper::__set public function Magic method: Set a property.
RulesOrganigramsWrapper::setEntity protected function Overridden to support identifying organigrams by machine names. Overrides EntityDrupalWrapper::setEntity
RulesOrganigramsWrapper::validate public function Overridden to permit machine names as values. Overrides EntityMetadataWrapper::validate