I try to add two additional DOM elements to a field.
public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
{
$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);
// Execute only if we had a jtfileupload
if ($field->type != 'jtfileupload')
{
return $fieldNode;
}
if (!$fieldNode)
{
return $fieldNode;
}
$fieldNode->setAttribute('accept', '.pdf,.PDF');
//Edit? File already exist?
if (!empty($field->value)){
$fieldNode->setAttribute('display', 'none'); //Wirkt nicht warum?
$fieldNode->setAttribute('disabled', 'disabled');
$domDoc = $parent->ownerDocument;
$fileName = $domDoc->createElement("span",$field->value);
$fieldNode->parentNode->appendChild($fileName);
$parent->appendChild($fileName);
}
return $fieldNode;
}