i am confused and don't get this to work.
here is a class : class Custom_HtmlEditorField_Toolbar extends Extension
it pushes a new radio-button to the link-dialog - popup on htmleditorfield.
also a sitetree- dropdown.
what i am trying to do is to add a checkbox, only visible when choosing the linkable-radio-button.
why is this checkbox hidden (display: none)???
any ideas?
thanks. timo.
class Custom_HtmlEditorField_Toolbar extends Extension{
/**
* Aggiorna l'elenco delle possibili opzioni di link
* @param Form $form
* @return type
*/
public function updateLinkForm($form) {
Requirements::javascript(LINKABLE_DATAOBJECTS_DIR . "/javascript/linkable-dataobjects.js");
$fields = $form->Fields();
/* @var $linkTipe CompositeField */
$compositeField = $fields[1];
/* @var $linkTipe OptionsetField */
$linkTipe = $fields[1]->fieldByName("LinkType");
$options = $linkTipe->getSource();
$linkables = ClassInfo::implementorsOf('Linkable', 'replace_linkabledo');
foreach ($linkables as $class) {
$options[strtolower($class)] = $class::LinkLabel();
$linkTipe->setSource($options);
$replaceField = $fields[1];
$checkbox = new CheckboxField('replace_linkabledo', 'Link mit DIV ersetzen?');
$checkbox->addExtraClass('linkabledo', 'Linkable');
$replaceField->push($checkbox);
$dropdown = new DropdownField(strtolower($class), _t('HtmlEditorField.NEWS', $class::LinkLabel()), $class::get()->map('ID', 'Title'));
$dropdown->addExtraClass('linkabledo');
$compositeField->push($dropdown);
}
return $form;
}
}