/**
* Load the form
*/
protected function loadForm()
{
// create form
$this->frm = new Form('edit');
$this->frm->addText('title', $this->record['title'], null, 'inputText title', 'inputTextError title');
$this->frm->addEditor('text', $this->record['text']);
//$this->frm->addText('link', $this->record['link']);
$this->frm->addText('linktext', $this->record['linktext']);
$this->frm->addImage('image');
// build array with options for the hidden Radiobutton
$RadiobuttonHiddenValues[] = array('label' => Language::lbl('Hidden'), 'value' => 'Y');
$RadiobuttonHiddenValues[] = array('label' => Language::lbl('Published'), 'value' => 'N');
$this->frm->addRadioButton('hidden', $RadiobuttonHiddenValues, $this->record['hidden']);
// get categories
$categories = BackendBlocksModel::getCategories();
$this->frm->addDropdown('category_id', $categories, $this->record['category_id']);
// meta
$this->meta = new Meta($this->frm, $this->record['meta_id'], 'title', true);
$this->meta->setUrlCallBack('Backend\\Modules\\Blocks\\Engine\\Model', 'getUrl', array($this->record['id']));
// redirect
$redirectValue = 'none';
if (isset($this->record['page_id'])) {
$redirectValue = 'internal';
}
if (isset($this->record['link'])) {
$redirectValue = 'external';
}
$redirectValues = array(array('value' => 'none', 'label' => \SpoonFilter::ucfirst(Language::lbl('None'))), array('value' => 'internal', 'label' => \SpoonFilter::ucfirst(Language::lbl('InternalLink')), 'variables' => array('isInternal' => true)), array('value' => 'external', 'label' => \SpoonFilter::ucfirst(Language::lbl('ExternalLink')), 'variables' => array('isExternal' => true)));
$this->frm->addRadiobutton('redirect', $redirectValues, $redirectValue);
$this->frm->addDropdown('internal_redirect', BackendPagesModel::getPagesForDropdown(), $redirectValue == 'internal' ? $this->record['page_id'] : null);
$this->frm->addText('external_redirect', $redirectValue == 'external' ? $this->record['link'] : null, null, null, null, true);
}