include/Smarty/plugins/function.sugar_action_menu.php
Smarty plugin
- Package
- Smarty
- Subpackage
- plugins
Functions
implode_r(
$glue, $pieces, $extract_first_item
=
false
)
:
void
Parameters
Name | Type | Description |
---|---|---|
$glue | ||
$pieces | ||
$extract_first_item |
smarty_function_sugar_action_menu(
\$params $params, $smarty
)
:
string
Smarty plugin: This is a Smarty plugin to handle the creation of HTML List elements for Sugar Action Menus.
Based on the theme, the plugin generates a proper group of button lists.
Name | Type | Description |
---|---|---|
$params | \$params | array - its structure is 'buttons' => list of button htmls, such as ( html_element1, html_element2, ..., html_element_n), 'id' => id property for ul element 'class' => class property for ul element 'flat' => controls the display of the menu as a dropdown or flat buttons (if the value is assigned, it will be not affected by enable_action_menu setting.) |
$smarty |
Type | Description |
---|---|
string | - compatible sugarActionMenu structure, such as <ul> <li>html_element1 <ul> <li>html_element2</li> ... </li>html_element_n</li> </ul> </li> </ul> ,which is generated by @see function smarty_function_sugar_menu <pre> 1. SugarButton on smarty add appendTo to generate button lists {{sugar_button ... appendTo='buttons'}} ,and then create menu {{sugar_action_menu ... buttons=$buttons ...}} 2. Code generate in PHP <?php ... $buttons = array( '<input ...', '<a href ...', ... ); require_once('include/Smarty/plugins/function.sugar_action_menu.php'); $action_button = smarty_function_sugar_action_menu(array( 'id' => ..., 'buttons' => $buttons, ... ),$xtpl); $template->assign("ACTION_BUTTON", $action_button); ?> 3. Passing array to smarty in PHP $action_button = array( 'id' => 'id', 'buttons' => array( '<input ...', '<a href ...', ... ), ... ); $tpl->assign('action_button', $action_button); in the template file {sugar_action_menu params=$action_button} 4. Append button element in the Smarty {php} $this->append('buttons', "<a ..."); $this->append('buttons', "<input ..."); {/php} {{sugar_action_menu ... buttons=$buttons ...}} </pre> |
- Author
- Justin Park (jpark@sugarcrm.com)