Difference between revisions of "Ferreteria/v0.4/class/fcMenuOptionLink"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< Ferreteria‎ | v0.4‎ | class
Jump to navigation Jump to search
(Created page with "{{page/code/class}} * '''file''': {{l/ferreteria/file|menu/hdr.php}} * '''extends''': {{l/version|class|fcToggleLink}} * '''extender''': {{l/version|class|fcHeaderChoice}} ==U...")
 
(example)
 
Line 21: Line 21:
 
| array['popup'] || = (optional) hover-over text
 
| array['popup'] || = (optional) hover-over text
 
|}
 
|}
 +
Example - simple <code>[edit]</code> link in a linkable row:
 +
<source lang=php>
 +
$oMenu = fcApp::Me()->GetHeaderMenu();
 +
  $ol = new fcMenuOptionLink(
 +
    array(
 +
      'base' => $this->SelfURL(), // base URL to prefix all output URLs
 +
      'kname' => 'do', // name of option group to which this option belongs
 +
      'kval' => 'edit', // value of unique key
 +
      'value' => 'edit', // default for [text-on] and [text-off]
 +
      'text-on' => 'edit', // (optional) text to display when toggle is on; defaults to [text-off]
 +
      'text-off' => 'edit', // (optional) text to display when toggle is off; defaults to [value]
 +
      'popup' => 'edit this account' // (optional) hover-over text
 +
    )
 +
  );
 +
  $oMenu->SetNode($ol);
 +
</source>

Latest revision as of 22:35, 12 January 2020

Usage

Objects are constructed with a single array argument:

array['base'] = base URL to prefix all output URLs
array['kname'] = name of option group to which this option belongs
array['kval'] (NEW) = value of unique key
array['value'] = default for [text-on] and [text-off]
array['text-on'] = (optional) text to display when toggle is on; defaults to [text-off]
array['text-off'] = (optional) text to display when toggle is off; defaults to [value]
array['popup'] = (optional) hover-over text

Example - simple [edit] link in a linkable row:

	$oMenu = fcApp::Me()->GetHeaderMenu();
	  $ol = new fcMenuOptionLink(
	    array(
	      'base' 		=> $this->SelfURL(),	// base URL to prefix all output URLs
	      'kname' 		=> 'do',		// name of option group to which this option belongs
	      'kval' 		=> 'edit',		// value of unique key
	      'value' 		=> 'edit',		// default for [text-on] and [text-off]
	      'text-on' 	=> 'edit',		// (optional) text to display when toggle is on; defaults to [text-off]
	      'text-off' 	=> 'edit',		// (optional) text to display when toggle is off; defaults to [value]
	      'popup' 		=> 'edit this account'	// (optional) hover-over text 	
	    )
	  );
	  $oMenu->SetNode($ol);