public function getOptions() { # The options available are based on what type was selected $options = array(); $type = $this->form->getField('entity_type')->value; return array_merge(parent::getOptions(), JFormFieldParentEntity::getParents($type)); }
function display($tpl = null) { $task = JRequest::getCmd('task', NULL); $cmd = JRequest::getCmd('cmd', NULL); switch ($task) { case 'parents': $parents = JFormFieldParentEntity::getParents($cmd); $output = ''; foreach ($parents as $parent) { $output .= '<option value="' . $parent->value . '">' . $parent->text . '</option>'; } $data = $output; default: break; } $document =& JFactory::getDocument(); $document->setMimeEncoding('application/json'); echo json_encode($data); return false; }