public function action_icon($url, pix_icon $pixicon, component_action $action = null,
                                array $attributes = null, $linktext = false) {
        if (!($url instanceof moodle_url)) {
            $url = new moodle_url($url);
        }
        $attributes = (array)$attributes;

        if (empty($attributes['class'])) {
            // Let devs override the class via $attributes.
            $attributes['class'] = 'action-icon';
        }

        $icon = $this->render($pixicon);

        if ($linktext) {
            $text = $pixicon->attributes['alt'];
        } else {
            $text = '';
        }

        return $this->action_link($url, $icon.$text, $action, $attributes);
    }
public function action_icon($url, pix_icon $pixicon, component_action $action = null,
                                array $attributes = null, $linktext = false) {
        if (!($url instanceof moodle_url)) {
            $url = new moodle_url($url);
        }
        $attributes = (array)$attributes;

        if (empty($attributes['class'])) {
            // Let devs override the class via $attributes.
            $attributes['class'] = 'action-icon';
        }

        $icon = $this->render($pixicon);

        if ($linktext) {
            $text = $pixicon->attributes['alt'];
        } else {
            $text = '';
        }

        return $this->action_link($url, $icon.$text, $action, $attributes);
    }
public function action_icon ( $ url , pix_icon $ pixicon , component_action $ action = null , array $ attributes = null , $ linktext = false ) { if ( ! ( $ url instanceof moodle_url ) ) { $ url = new moodle_url ( $ url ) ; } $ attributes = ( array ) $ attributes ; if ( empty ( $ attributes [ 'class' ] ) ) { // Let devs override the class via $attributes. $ attributes [ 'class' ] = 'action-icon' ; } $ icon = $ this -> render ( $ pixicon ) ; if ( $ linktext ) { $ text = $ pixicon -> attributes [ 'alt' ] ; } else { $ text = '' ; } return $ this -> action_link ( $ url , $ icon . $ text , $ action , $ attributes ) ; }
Renders an action_icon.

This function uses the {@link core_renderer::action_link()} method for the
most part. What it does different is prepare the icon as HTML and use it
as the link text.

@param string|moodle_url $url A string URL or moodel_url
@param pix_icon $pixicon
@param component_action $action
@param array $attributes associative array of html link attributes + disabled
@param bool $linktext show title next to image in link
@return string HTML fragment
Renders an action_icon .