JAccess/getActions

From Joomla! Documentation

Jump to: navigation, search

Contents

Description

Method to return a list of actions for which permissions can be set given a component and section.

Syntax

static JAccess::getActions($component, $section= 'component')
Parameter Name Default Value Description
$component The component from which to retrieve the actions.
$section 'component' The name of the section within the component from which to retrieve the actions.

Returns

array List of actions available for the given component and section.

Defined in

libraries/joomla/access/access.php

Importing

jimport( 'joomla.access.access' );

Source Body

        public static function getActions($component, $section = 'component')
        {
                $actions = array();
 
                if (is_file(JPATH_ADMINISTRATOR.'/components/'.$component.'/access.xml'))
                {
                        $xml = simplexml_load_file(JPATH_ADMINISTRATOR.'/components/'.$component.'/access.xml');
 
                        foreach ($xml->children() as $child)
                        {
                                if ($section == (string) $child['name'])
                                {
                                        foreach ($child->children() as $action)
                                        {
                                                $actions[] = (object) array('name' => (string) $action['name'], 'title' => (string) $action['title'], 'description' => (string) $action['description']);
                                        }
 
                                        break;
                                }
                        }
                }
 
                return $actions;
        }
Personal tools