<?php
class Loginform_Form_Edit {
public static function get() {
$form = new Html_Form_SubForm();
$form->getView()->setScriptPath(APP_DIR . '/plugins/Loginform/views/scripts');
$form->setName('data');
/******************************
settings
******************************/
// name
$name = new Html_Form_Element_Text(array(
'name' => 'name',
'label' => Dub_Locale::_('Name', 'Loginform'),
'required' => true,
'validators' => array(
array('NotEmpty', false, array(
'messages' => array(
'isEmpty' => Dub_Locale::_('Name is empty', 'Loginform')
)
))
),
'attribs' => array(
'class' => 'big',
),
));
// show_username
$show_username = new Html_Form_Element_Checkbox(array(
'name' => 'show_username',
'label' => Dub_Locale::_('If user is logged in, show username', 'Loginform')
));
// show_logout_button
$show_logout_button = new Html_Form_Element_Checkbox(array(
'name' => 'show_logout_button',
'label' => Dub_Locale::_('If user is logged in, show logout-button', 'Loginform')
));
// show_form
$show_form = new Html_Form_Element_Checkbox(array(
'name' => 'show_form',
'label' => Dub_Locale::_('If user is logged in, show login-form anyway', 'Loginform')
));
// css
$css = new Html_Form_Element_Text(array(
'name' => 'css',
'label' => Dub_Locale::_('CSS-Class', 'Loginform'),
'description' => Dub_Locale::_('The CSS-classname of the <form>-element.', 'Loginform'),
'attribs' => array(
'class' => 'medium',
),
));
// redirect_path
$redirect_path = new Html_Form_Element_Text(array(
'name' => 'redirect_path',
'label' => Dub_Locale::_('Redirect Path', 'Loginform'),
'description' => Dub_Locale::_('After logging in, the user gets redirected to this path (Format: "my/example/path").', 'Loginform'),
'attribs' => array(
'class' => 'big',
),
));
$form->addElements(array(
$name,
$show_username,
$show_logout_button,
$show_form,
$css,
$redirect_path
));
$form->addGroup(array(
'name' => 'group_edit_settings',
'id' => 'group_edit_settings',
'title' => Dub_Locale::_('Properties', 'Loginform'),
'expandable' => true,
'expanded' => true,
'view_script' => 'group_edit_settings.phtml',
'view_script_data' => array(
'form' => $form
),
'elements' => array(
'name',
'show_username',
'show_logout_button',
'show_form',
'css',
'redirect_path'
),
));
$form->setDecorators(array(
array('viewScript', array(
'viewScript' => 'edit.phtml',
'form' => $form
))
));
return $form;
}
}