To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Changeset 4511

Show
Ignore:
Timestamp:
01/25/12 12:39:19 (4 months ago)
Author:
tboutell
Message:

* a_button helper now accepts a single array of options as an alternative to the full list of parameters
* If you use the new syntax you can pass the new 'target' option

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • plugins/apostrophePlugin/branches/1.5/lib/helper/aHelper.php

    r4415 r4511  
    472472} 
    473473 
    474 function a_button($label, $url, $classes = array(), $id = null, $name = null, $title = null) 
    475 { 
     474/** 
     475 * Conveniently outputs a button, supplying the a-btn class and also supplying the 
     476 * "icon" span if 'icon' is in the $classes array. If a-link or a-arrow-btn is in the 
     477 * classes array then a-btn is not supplied.  
     478 * 
     479 * You can now pass all of these arguments, plus the new target option, as a single  
     480 * array parameter rather than passing a long list of parameters. None are mandatory. 
     481 */ 
     482function a_button($label, $url = '#', $classes = array(), $id = null, $name = null, $title = null, $options = array()) 
     483{ 
     484  if (is_array($label)) 
     485  { 
     486    $options = $label; 
     487    $label = a_get_option($options, 'label', null); 
     488    $url = a_get_option($options, 'url', '#'); 
     489    $classes = a_get_option($options, 'classes', array()); 
     490    $id = a_get_option($options, 'id', null); 
     491    $name = a_get_option($options, 'name', null); 
     492    $title = a_get_option($options, 'title', null); 
     493    $target = a_get_option($options, 'target', null); 
     494  } 
     495  else 
     496  { 
     497    $target = null; 
     498  } 
    476499  $hasIcon = in_array('icon', $classes); 
    477500        $aLink = in_array('a-link', $classes); 
     
    485508         
    486509  $s = '<a '; 
     510  if (!is_null($target)) 
     511  { 
     512    $s .= 'target="' . a_entities($target) . '" '; 
     513  } 
    487514  if (!is_null($name)) 
    488515  {