You are here

function organigrams_metadata_organigrams_item_setter in Organigrams 7

Entity API property setter callback organigrams item.

Parameters

object $organigrams_item: An organigrams item entity.

string $name: A string containing the property name.

mixed $value: A string or integer to set as property value.

Return value

mixed An organigrams ID.

1 string reference to 'organigrams_metadata_organigrams_item_setter'
organigrams_entity_property_info in ./organigrams.module
Implements hook_entity_property_info().

File

./organigrams.module, line 1098
Defines the organigrams functions and entity types.

Code

function organigrams_metadata_organigrams_item_setter($organigrams_item, $name, $value) {

  // Evaluate the property name.
  switch ($name) {
    case 'organigram':

      // Make sure to also update the organigrams bundle key.
      $organigrams = organigrams_load($value);
      $organigrams_item->organigrams_machine_name = $organigrams->machine_name;
      return $organigrams_item->oid = $value;
    case 'parent':
      return $organigrams_item->parent = $value;
  }
}