/** * Load up a field 'select as' statement * * @param JModel $formModel Form model * @param string $fieldName Element full name * @param array &$asfields As fields to append as statement to * @param array $opts Options * * @throws RuntimeException * * @return void */ private function asField($formModel, $fieldName, &$asfields, $opts) { $elementModel = $formModel->getElement($fieldName); $fields = array(); if ($elementModel) { if ($elementModel->getElement()->published != 1) { throw new RuntimeException('Approval ' . $fieldName . ' element must be published', 500); } $elementModel->getAsField_html($asfields, $fields, $opts); } }