Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
action_link Class Reference

Data structure describing html link with special action attached. More...

Inheritance diagram for action_link:
renderable action_menu_filler action_menu_link action_menu_link_primary action_menu_link_secondary

Public Member Functions

 __construct (moodle_url $url, $text, component_action $action=null, array $attributes=null, pix_icon $icon=null)
 Constructor.
 
 add_action (component_action $action)
 Add action to the link.
 
 add_class ($class)
 Adds a CSS class to this action link object.
 
 export_for_template (renderer_base $output)
 Export for template.
 
 get_icon_html ()
 Return the rendered HTML for the icon.
 
 has_class ($class)
 Returns true if the specified class has been added to this link.
 

Public Attributes

array $actions
 List of actions attached to link.
 
array $attributes
 HTML attributes.
 
pix_icon $icon
 Optional pix icon to render with the link.
 
string $text
 Link text HTML fragment.
 
moodle_url $url
 Href url.
 

Detailed Description

Data structure describing html link with special action attached.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Since
Moodle 2.0

Constructor & Destructor Documentation

◆ __construct()

action_link::__construct ( moodle_url $url,
$text,
component_action $action = null,
array $attributes = null,
pix_icon $icon = null )

Constructor.

Parameters
moodle_url$url
string$textHTML fragment
component_action$action
array$attributesassociative array of html link attributes + disabled
pix_icon$iconoptional pix_icon to render with the link text

Member Function Documentation

◆ add_action()

action_link::add_action ( component_action $action)

Add action to the link.

Parameters
component_action$action

◆ add_class()

action_link::add_class ( $class)

Adds a CSS class to this action link object.

Parameters
string$class

◆ export_for_template()

action_link::export_for_template ( renderer_base $output)

Export for template.

Parameters
renderer_base$outputThe renderer.
Return values
stdClass

Reimplemented in action_menu_link.

◆ get_icon_html()

action_link::get_icon_html ( )

Return the rendered HTML for the icon.

Useful for rendering action links in a template.

Return values
string

◆ has_class()

action_link::has_class ( $class)

Returns true if the specified class has been added to this link.

Parameters
string$class
Return values
bool

The documentation for this class was generated from the following file: