You are here

function _relation_entity_collector_get_entity in Relation 7

Same name and namespace in other branches
  1. 8.2 relation_entity_collector/relation_entity_collector.module \_relation_entity_collector_get_entity()
  2. 8 relation_entity_collector/relation_entity_collector.module \_relation_entity_collector_get_entity()

Retrieves the relation being edited or picked.

2 calls to _relation_entity_collector_get_entity()
relation_entity_collector_save in relation_entity_collector/relation_entity_collector.module
Submit handler for the save button.
relation_entity_collector_validate in relation_entity_collector/relation_entity_collector.module
Validate form submission for the entity_collector.

File

relation_entity_collector/relation_entity_collector.module, line 390
Relation Entity Collector Block.

Code

function _relation_entity_collector_get_entity($relation_type = NULL, $endpoints = NULL) {
  if (!isset($relation_type) && isset($_SESSION['relation_type'])) {
    $relation_type = $_SESSION['relation_type'];
  }
  if (!isset($endpoints) && isset($_SESSION['relation_entity_keys'])) {
    $endpoints = $_SESSION['relation_entity_keys'];
  }
  if (isset($_SESSION['relation_edit'])) {
    $relation = $_SESSION['relation_edit'];
    if (isset($endpoints)) {
      $relation->endpoints[LANGUAGE_NONE] = $endpoints;
    }
    return $relation;
  }
  if (isset($relation_type)) {
    return relation_create($relation_type, $endpoints);
  }
}