function _relation_entity_collector_get_entity in Relation 8.2
Same name and namespace in other branches
- 8 relation_entity_collector/relation_entity_collector.module \_relation_entity_collector_get_entity()
- 7 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()
- EntityCollector::submitForm in relation_entity_collector/
src/ Form/ EntityCollector.php - Form submission handler.
- EntityCollector::validateForm in relation_entity_collector/
src/ Form/ EntityCollector.php - Form validation handler.
File
- relation_entity_collector/
relation_entity_collector.module, line 69 - 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::LANGCODE_NOT_SPECIFIED] = $endpoints;
}
return $relation;
}
if (isset($relation_type)) {
return relation_create($relation_type, $endpoints);
}
}