PMA\libraries\Util::getIcon PHP Method

getIcon() public static method

This function takes into account the ActionLinksMode configuration setting and wraps the image tag in a span tag.
public static getIcon ( string $icon, string $alternate = '', boolean $force_text = false, boolean $menu_icon = false, string $control_param = 'ActionLinksMode' ) : string
$icon string name of icon file
$alternate string alternate text
$force_text boolean whether to force alternate text to be displayed
$menu_icon boolean whether this icon is for the menu bar or not
$control_param string which directive controls the display
return string an html snippet
    public static function getIcon($icon, $alternate = '', $force_text = false, $menu_icon = false, $control_param = 'ActionLinksMode')
    {
        $include_icon = $include_text = false;
        if (self::showIcons($control_param)) {
            $include_icon = true;
        }
        if ($force_text || self::showText($control_param)) {
            $include_text = true;
        }
        // Sometimes use a span (we rely on this in js/sql.js). But for menu bar
        // we don't need a span
        $button = $menu_icon ? '' : '<span class="nowrap">';
        if ($include_icon) {
            $button .= self::getImage($icon, $alternate);
        }
        if ($include_icon && $include_text) {
            $button .= '&nbsp;';
        }
        if ($include_text) {
            $button .= $alternate;
        }
        $button .= $menu_icon ? '' : '</span>';
        return $button;
    }

Usage Example

 /**
  * Provides a column's type, collation, operators list, and criteria value
  * to display in table search form
  *
  * @param integer $search_index Row number in table search form
  * @param integer $column_index Column index in ColumnNames array
  *
  * @return array Array containing column's properties
  */
 public function getColumnProperties($search_index, $column_index)
 {
     $selected_operator = isset($_POST['criteriaColumnOperators']) ? $_POST['criteriaColumnOperators'][$search_index] : '';
     $entered_value = isset($_POST['criteriaValues']) ? $_POST['criteriaValues'] : '';
     $titles = array('Browse' => Util::getIcon('b_browse.png', __('Browse foreign values')));
     //Gets column's type and collation
     $type = $this->_columnTypes[$column_index];
     $collation = $this->_columnCollations[$column_index];
     //Gets column's comparison operators depending on column type
     $func = Template::get('table/search/column_comparison_operators')->render(array('search_index' => $search_index, 'columnTypes' => $this->_columnTypes, 'column_index' => $column_index, 'columnNullFlags' => $this->_columnNullFlags, 'selected_operator' => $selected_operator));
     //Gets link to browse foreign data(if any) and criteria inputbox
     $foreignData = PMA_getForeignData($this->_foreigners, $this->_columnNames[$column_index], false, '', '');
     $value = Template::get('table/search/input_box')->render(array('str' => '', 'column_type' => (string) $type, 'column_id' => 'fieldID_', 'in_zoom_search_edit' => false, '_foreigners' => $this->_foreigners, 'column_name' => $this->_columnNames[$column_index], 'foreignData' => $foreignData, 'table' => $this->table, 'column_index' => $search_index, 'foreignMaxLimit' => $GLOBALS['cfg']['ForeignKeyMaxLimit'], 'criteriaValues' => $entered_value, 'db' => $this->db, 'titles' => $titles, 'in_fbs' => true));
     return array('type' => $type, 'collation' => $collation, 'func' => $func, 'value' => $value);
 }
All Usage Examples Of PMA\libraries\Util::getIcon
Util