private function OgSubgroupsSelectionHandler::getGidsForCreate in Subgroups for Organic groups 7.2
Override EntityReferenceHandler::getGidsForCreate().
Overrides OgSelectionHandler::getGidsForCreate
1 call to OgSubgroupsSelectionHandler::getGidsForCreate()
- OgSubgroupsSelectionHandler::buildEntityFieldQuery in plugins/
entityreference/ selection/ OgSubgroupsSelectionHandler.class.php - Overrides OgSelectionHandler::buildEntityFieldQuery().
File
- plugins/
entityreference/ selection/ OgSubgroupsSelectionHandler.class.php, line 128 - OG example selection handler.
Class
- OgSubgroupsSelectionHandler
- @file OG example selection handler.
Code
private function getGidsForCreate() {
if ($this->instance['entity_type'] != 'node') {
return array();
}
if (!empty($this->entity->nid)) {
// Existing node.
return array();
}
if (!module_exists('entityreference_prepopulate') || empty($this->instance['settings']['behaviors']['prepopulate'])) {
return array();
}
// Don't try to validate the IDs.
if (!($ids = entityreference_prepopulate_get_values($this->field, $this->instance, FALSE))) {
return array();
}
$node_type = $this->instance['bundle'];
foreach ($ids as $delta => $id) {
if (!is_numeric($id) || !$id || !og_user_access($this->field['settings']['target_type'], $id, "create {$node_type} content")) {
unset($ids[$delta]);
}
}
return $ids;
}