getAll(); // Prevent parenting to children of this item. if ($id = $this->form->getValue('id')) { unset($options[$id]); } $options = array_values($options); $isSuperAdmin = JFactory::getUser()->authorise('core.admin'); // Pad the option text with spaces using depth level as a multiplier. for ($i = 0, $n = count($options); $i < $n; $i++) { // Show groups only if user is super admin or group is not super admin if ($isSuperAdmin || !JAccess::checkGroup($options[$i]->id, 'core.admin')) { $options[$i]->value = $options[$i]->id; $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->title; } else { unset($options[$i]); } } // Merge any additional options in the XML definition. return array_merge(parent::getOptions(), $options); } }