Source for file category.php
Documentation is available at category.php
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* Form Field class for the Joomla Platform.
* Supports an HTML select list of categories
public $type =
'Category';
* Method to get the field options for category
* Use the extension attribute in a form to specify the.specific extension for
* which categories should be displayed.
* Use the show_root attribute to specify whether to show the global category root in the list.
* @return array The field option objects.
$extension =
$this->element['extension'] ? (string)
$this->element['extension'] : (string)
$this->element['scope'];
$published = (string)
$this->element['published'];
// Load the category options for a given extension.
// Filter over published state or not depending upon if it is present.
$options =
JHtml::_('category.options', $extension, array('filter.published' =>
explode(',', $published)));
$options =
JHtml::_('category.options', $extension);
// Verify permissions. If the action attribute is set, then we scan the options.
if ((string)
$this->element['action'])
// Get the current user object.
foreach ($options as $i =>
$option)
* To take save or create in a category you need to have create rights for that category
* unless the item is already in that category.
* Unset the option if the user isn't authorised for it. In this field assets are always categories.
if ($user->authorise('core.create', $extension .
'.category.' .
$option->value) !=
true)
if (isset
($this->element['show_root']))
JLog::add(JText::_('JLIB_FORM_ERROR_FIELDS_CATEGORY_ERROR_EXTENSION_EMPTY'), JLog::WARNING, 'jerror');
// Merge any additional options in the XML definition.
Documentation generated on Tue, 19 Nov 2013 14:55:22 +0100 by phpDocumentor 1.4.3