API16

Difference between revisions of "JAccess/getActions"

From Joomla! Documentation

< API16:JAccess
m (removing red link to edit, no existant pages)
m (preparing for archive only)
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
 
Method to return a list of actions for which permissions can be set given a component and section.
 
Method to return a list of actions for which permissions can be set given a component and section.
  
<span class="editsection" style="font-size:76%;">
+
 
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
  
 
<! removed transcluded page call, red link never existed >
 
<! removed transcluded page call, red link never existed >
Line 58: Line 56:
 
</source>
 
</source>
  
<span class="editsection" style="font-size:76%;">
+
 
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
 
<! removed transcluded page call, red link never existed >
 
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
<CodeExamplesForm />
+
=== Code Examples ===
 
<dpl>
 
<dpl>
 
  noresultsheader=\n
 
  noresultsheader=\n
 
  category=getActions
 
  category=getActions
 
  category=JAccess
 
  category=JAccess
  category=CodeExample
+
  namespace=CodeExample
 
  category=MethodExample
 
  category=MethodExample
 
  include=*
 
  include=*

Latest revision as of 20:16, 24 March 2017

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

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


<! removed transcluded page call, red link never existed >

Syntax[edit]

static 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[edit]

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

Defined in[edit]

libraries/joomla/access/access.php

Importing[edit]

jimport( 'joomla.access.access' );

Source Body[edit]

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;
}


<! removed transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]