getOptionName() публичный статический Метод

Gets the active option's label given an array of JHtml options
public static getOptionName ( array $data, mixed $selected = null, string $groupKey = 'items', string $optKey = 'value', string $optText = 'text' ) : mixed
$data array The JHtml options to parse
$selected mixed The currently selected value
$groupKey string Group name
$optKey string Key name
$optText string Value name
Результат mixed The label of the currently selected option
Пример #1
0
 /**
  * Method to get the field input markup.
  *
  * @param   array   $fieldOptions  Options to be passed into the field
  *
  * @return  string  The field HTML
  */
 public function getFieldContents(array $fieldOptions = array())
 {
     $id = isset($fieldOptions['id']) ? $fieldOptions['id'] : null;
     $class = $this->class . (isset($fieldOptions['class']) ? ' ' . $fieldOptions['class'] : '');
     $selected = GroupedList::getOptionName($this->getGroups(), $this->value);
     if (is_null($selected)) {
         $selected = array('group' => '', 'item' => '');
     }
     return '<span ' . ($id ? 'id="' . $id . '-group" ' : '') . 'class="fof-groupedlist-group ' . $class . '>' . htmlspecialchars($selected['group'], ENT_COMPAT, 'UTF-8') . '</span>' . '<span ' . ($id ? 'id="' . $id . '-item" ' : '') . 'class="fof-groupedlist-item ' . $class . '>' . htmlspecialchars($selected['item'], ENT_COMPAT, 'UTF-8') . '</span>';
 }