class entityreference_prepopulate_CrumbsMonoPlugin_node in Crumbs, the Breadcrumbs suite 7.2
Hierarchy
Expanded class hierarchy of entityreference_prepopulate_CrumbsMonoPlugin_node
File
- plugins/
crumbs.entityreference_prepopulate.inc, line 37
View source
class entityreference_prepopulate_CrumbsMonoPlugin_node implements crumbs_MonoPlugin_FindParentInterface {
/**
* @var string
* The node type, e.g. 'article'.
*/
protected $nodeType;
/**
* @var string
* Field name of the entityreference field.
*/
protected $fieldName;
/**
* @var string
* The target entity type for the entityreference field.
*/
protected $targetType;
/**
* @param string $node_type
* @param string $field_name
* @param string $target_type
*/
function __construct($node_type, $field_name, $target_type) {
$this->nodeType = $node_type;
$this->fieldName = $field_name;
$this->targetType = $target_type;
}
/**
* {@inheritdoc}
*/
function describe($api) {
$api
->titleWithLabel(t('!field_name from request', array(
'!field_name' => '<code>?' . $this->fieldName . '=*</code>',
)), t('Parent'));
}
/**
* {@inheritdoc}
*/
function findParent($path, $item) {
if (empty($_GET[$this->fieldName])) {
return NULL;
}
$v = $_GET[$this->fieldName];
if (!($v > 0)) {
return NULL;
}
$target_entities = entity_load($this->targetType, array(
$v,
));
if (empty($target_entities[$v])) {
return NULL;
}
$uri = entity_uri($this->targetType, $target_entities[$v]);
if (empty($uri['path'])) {
return NULL;
}
return $uri['path'];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
entityreference_prepopulate_CrumbsMonoPlugin_node:: |
protected | property | Field name of the entityreference field. | |
entityreference_prepopulate_CrumbsMonoPlugin_node:: |
protected | property | The node type, e.g. 'article'. | |
entityreference_prepopulate_CrumbsMonoPlugin_node:: |
protected | property | The target entity type for the entityreference field. | |
entityreference_prepopulate_CrumbsMonoPlugin_node:: |
function |
Overrides crumbs_MonoPlugin:: |
||
entityreference_prepopulate_CrumbsMonoPlugin_node:: |
function |
Find candidates for the parent path. Overrides crumbs_MonoPlugin_FindParentInterface:: |
||
entityreference_prepopulate_CrumbsMonoPlugin_node:: |
function |