Skip to content

Commit

Permalink
add ability to disable links in path using node id or object id
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael committed May 2, 2011
1 parent c6a5b9e commit 2dcccab
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
19 changes: 16 additions & 3 deletions classes/sitelink.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,27 @@ function path(){
$SiteLinkOperator=new SiteLinkOperator();
$namedParameters = array('parameters'=>false,'absolute'=>$this->parameters['absolute']);
$operatorName='sitelink';
$DisabledNodeID=(self::configSetting('SiteLinkPathSettings','DisableNodeID')=='enabled')?self::configSetting('SiteLinkPathSettings','NodeIDList'):array();
$DisabledObjectID=(self::configSetting('SiteLinkPathSettings','DisableObjectID')=='enabled')?self::configSetting('SiteLinkPathSettings','ObjectIDList'):array();
if(count($DisabledObjectID)){
foreach($DisabledObjectID as $ObjectID){
foreach(eZContentObject::fetch($ObjectID)->assignedNodes() as $Node){
if(!in_array($NodeID=$Node->NodeID,$DisabledNodeID)){
$DisabledNodeID[]=$NodeID;
}
}
}
}
foreach(array_reverse($PathArray) as $key=>$value){
$NodeObject = eZContentObjectTreeNode::fetch($value);
$operatorValue=$NodeObject;
$SiteLinkOperator->modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, $operatorValue, $namedParameters);
if($hasLink=!in_array($value,$DisabledNodeID)){
$operatorValue=$NodeObject;
$SiteLinkOperator->modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, $operatorValue, $namedParameters);
}
$PathArray[$key]=array(
'node_id'=>$NodeObject->NodeID,
'text'=>$NodeObject->Name,
'url_alias'=>$operatorValue,
'url_alias'=>$hasLink?$operatorValue:false,
'current'=>$this->objectNode->NodeID==$value
);
if($this->rootNodeID==$value){
Expand Down
11 changes: 11 additions & 0 deletions settings/sitelink.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ RoleOverride=disabled
RoleList[]
#RoleList[role_id]=siteaccess

[SiteLinkPathSettings]
# Prevents the node in the generated path from being a link
DisableNodeID=disabled
# The list of node ids to disable
#NodeIDList[]

# Prevents all node instances of the object in the generated path from being a link
DisableObjectID=disabled
# The list of object ids to disable
#ObjectIDList[]

[DataTypeSettings]
ClassList[]
ClassList[ezbinaryfile]=SiteLinkBinaryFile
Expand Down

0 comments on commit 2dcccab

Please sign in to comment.