Difference between revisions of "Ferreteria/v2/class/fcNavLink"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Ferreteria‎ | v2‎ | class
Jump to navigation Jump to search
(Created page with "{{page/code/class}} <source lang=php> /*:::: PURPOSE: a navigation link * permission-aware (from base) * defaults to having permission (from base) * does not def...")
 
 
Line 1: Line 1:
 
{{page/code/class}}
 
{{page/code/class}}
 +
* '''file''': {{l/ferreteria/file|menu/nav.php}}
 +
* '''extends''': {{l/version|class|fcNavBase}}
 +
* '''extender''': {{l/version|class|fcMenuLink}}
 
<source lang=php>
 
<source lang=php>
 
/*::::
 
/*::::
Line 38: Line 41:
 
     // -- OUTPUT -- //
 
     // -- OUTPUT -- //
 
}</source>
 
}</source>
* '''file''': {{l/ferreteria/file|menu/nav.php}}
 
* '''extends''': {{l/version|class|fcNavBase}}
 
* '''extender''': {{l/version|class|fcMenuLink}}
 

Latest revision as of 17:11, 19 January 2019

/*::::
  PURPOSE: a navigation link
    * permission-aware (from base)
    * defaults to having permission (from base)
    * does not define URL
  NOTE: It's tempting to make this a fcHypertextTag because that adds executableTree and renderableTree,
    but it also assumes an opening and closing tag.
*/
abstract class fcNavLink extends fcNavBase {

    // ++ PROPERTY VALUES ++ //

    abstract protected function GetLinkURL();
    protected function GetStyleName() {
	return 'menu-link';
    }

    // -- SETUP -- //
    // ++ OUTPUT ++ //
    
    protected function RenderContent() {
	return $this->RenderLink();
    }
    /*----
      PURPOSE: renders just the link, no before/after decoration
      TAGS: NEW
    */
    protected function RenderLink() {
	$sLinkURL = $this->GetLinkURL();
	$htLinkText = htmlspecialchars($this->GetLinkText(),ENT_QUOTES);
	$htLinkPopup = htmlspecialchars($this->GetPopup(),ENT_QUOTES);
	$htStyleName = $this->GetStyleName();
	return "<a href='$sLinkURL' title='$htLinkPopup' class='$htStyleName'>$htLinkText</a>";
    }

    // -- OUTPUT -- //
}