Ferreteria/v0.4/class/fcMenuOptionLink: Difference between revisions

From Woozle Writes Code
< 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>

Revision as of 22:35, 12 January 2020

Template:Page/code/class

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);