Ferreteria/v2/class/fcLink fromArray
< Ferreteria | v2 | class
Jump to navigation
Jump to search
- file: Template:L/ferreteria/file
- extends: Template:L/version
- extender: Template:L/version
class fcLink_fromArray extends fcMenuLink {
/*----
CEMENT
*/
protected function GetLinkURL() {
$arPath = $this->GetLinkArray();
$fpArgs = fcURL::FromArray($arPath);
return $this->MakeURL_fromPath($fpArgs);
}
/*----
NEW
PURPOSE: returns the array to use for calculating link URL
*/
protected function GetLinkArray() {
return array_merge(
$this->GetLinkArray_figured(),
$this->GetLinkArray_added()
);
}
private $arContext;
public function AddLinkArray(array $ar) {
$this->arContext = array_merge($this->GetLinkArray_added(),$ar);
}
protected function GetLinkArray_added() {
return isset($this->arContext) ? $this->arContext : array();
}
/*----
NEW
PURPOSE: calculates self-identifying array
*/
// PUBLIC for testing
public function GetLinkArray_self() {
$sValue = $this->GetKeyValue();
$sName = $this->GetKeyName();
return array($sName=>$sValue);
}
/*----
NEW
PURPOSE: gets the part of the link array which might change
NOTE: There originally was code to handle value-only paths --
$arPath = array($sValue=>(!$isSel));
-- but it's not clear that this is actually necessary.
Wait for a usage case, and then test.
*/
protected function GetLinkArray_figured() {
return $this->GetLinkArray_self();
}
}