Esempio n. 1
0
 public function createActions()
 {
     $actions = parent::createActions();
     $actions('action_submit')->setTitle(trans('cmsable::forms.save'));
     $actions->push(Action::create('delete')->setTitle(trans('cmsable::forms.delete')));
     return $actions;
 }
Esempio n. 2
0
 protected function getFallbackActionKey(Action $action, $property)
 {
     return 'forms.actions.' . $action->getShortName() . ".{$property}";
 }
Esempio n. 3
0
 protected function createActionList($actionName = '', $actionTitle = '')
 {
     $actions = new FieldList();
     $actions->setForm($this);
     if (!$actionName && !$actionTitle) {
         return $actions;
     }
     $action = Action::create($actionName);
     if ($actionTitle) {
         $action->setTitle($actionTitle);
     }
     $actions->push($action);
     return $actions;
 }
Esempio n. 4
0
$form->push($container);
$container->push($name)->push($surname)->push($rememberMe)->push($rememberMyRadio);
$container2 = new FieldList('group2', 'Tab Two');
$container2->setSwitchable(TRUE);
// $container2->push($category)->push($tagsField)->push($category2)->push($tags2);
$linkTypes = array('internal' => 'Internal', 'external' => 'External');
$selectGroup = SelectOneGroup::create('linkType', 'Link')->setSrc($linkTypes);
$selectGroup->setValue('internal');
$targets = array('firstchild' => 'First Child Page', '1' => 'Home', '2' => 'Contact', '3' => 'About us');
$pages = SelectOneField::create('internalTarget', 'Target')->setSrc($targets);
$selectGroup->push($pages);
$externalTarget = TextField::create('externalTarget', 'URL');
$selectGroup->push($externalTarget);
$container2->push($selectGroup);
$form->push($container2);
$form->actions->push(Action::create('delete')->setTitle('Delete'));
$form('surname')->setValue('Button');
$nameValidator = new TextValidator();
$nameValidator->required = FALSE;
$nameValidator->minLength = 3;
$nameValidator->setMaxLength = 12;
$requiredValidator = new RequiredValidator();
$requiredValidator->required = TRUE;
$trueValidator = new BooleanValidator();
$trueValidator->mustBeTrue = TRUE;
$validator = new SimpleValidator($form);
$validator->set('name', $nameValidator);
$validator->set('surname', $requiredValidator);
$validator->set('linkType', $requiredValidator);
$validator->set('rememberMyRadio', $trueValidator);
$validator->set('internalTarget', $requiredValidator);