Source for file groupedlist.php
Documentation is available at groupedlist.php
* @package FrameworkOnFramework
* @copyright Copyright (C) 2010 - 2012 Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
// Protect from unauthorized access
require_once JPATH_LIBRARIES .
'/joomla/form/fields/groupedlist.php';
* Form Field class for FOF
* Supports a generic list of options.
* @package FrameworkOnFramework
/** @var FOFTable The item being rendered in a repeatable form field */
/** @var int A monotonically increasing number, denoting the row number in a repeatable view */
* Method to get certain otherwise inaccessible properties from the form field object.
* @param string $name The property name for which to the the value.
* @return mixed The property value or null.
public function __get($name)
return parent::__get($name);
* Get the rendering of this field type for static display, e.g. in a single
* item view (typically a "read" task).
* @return string The field HTML
$class =
$this->element['class'] ? (string)
$this->element['class'] :
'';
$selected =
self::getOptionName($this->getOptions(), $this->value);
return '<span id="' .
$this->id .
'-group" class="fof-groupedlist-group ' .
$class .
'>' .
'<span id="' .
$this->id .
'-item" class="fof-groupedlist-item ' .
$class .
'>' .
* Get the rendering of this field type for a repeatable (grid) display,
* e.g. in a view listing many item (typically a "browse" task)
* @return string The field HTML
$class =
$this->element['class'] ? (string)
$this->element['class'] :
'';
$selected =
self::getOptionName($this->getOptions(), $this->value);
return '<span class="' .
$this->id .
'-group fof-groupedlist-group ' .
$class .
'">' .
'<span class="' .
$this->id .
'-item fof-groupedlist-item ' .
$class .
'">' .
* Gets the active option's label given an array of JHtml options
* @param array $data The JHtml options to parse
* @param mixed $selected The currently selected value
* @param string $groupKey Group name
* @param string $optKey Key name
* @param string $optText Value name
* @return mixed The label of the currently selected option
public static function getOptionName($data, $selected =
null, $groupKey =
'items', $optKey =
'value', $optText =
'text')
foreach ($data as $dataKey =>
$group)
$subList =
$group[$groupKey];
$label =
$group[$optText];
// Sub-list is in a property of an object
$subList =
$group->$groupKey;
$label =
$group->$optText;
throw
new RuntimeException('Invalid group contents.', 1);
Documentation generated on Tue, 19 Nov 2013 15:04:07 +0100 by phpDocumentor 1.4.3