public function configure()
 {
     parent::configure();
     $this->widgetSchema['name'] = new sfWidgetFormInputText();
     $this->validatorSchema['name'] = new dmValidatorDirectoryName();
     $this->mergePostValidator(new sfValidatorAnd(array(new sfValidatorCallback(array('callback' => array($this, 'checkExistsInParent'))))));
 }
 public function configure()
 {
     parent::configure();
     $parentChoices = $this->getParentChoices();
     $this->widgetSchema['parent_id'] = new sfWidgetFormChoice(array('choices' => $parentChoices));
     $this->validatorSchema['parent_id'] = new sfValidatorChoice(array('choices' => array_keys($parentChoices), 'required' => true));
     $this->mergePostValidator(new sfValidatorAnd(array(new sfValidatorCallback(array('callback' => array($this, 'checkExistsInParent'))))));
 }
 public function configure()
 {
     parent::configure();
     $this->widgetSchema['file'] = new sfWidgetFormDmInputFile();
     $this->widgetSchema['override'] = new sfWidgetFormInputCheckbox();
     $this->widgetSchema['override']->setLabel('Override?');
     $this->validatorSchema['file'] = new sfValidatorFile(array());
     $this->validatorSchema['override'] = new sfValidatorBoolean();
 }
Example #4
0
 public function configure()
 {
     parent::configure();
     $this->widgetSchema['cssClass'] = new sfWidgetFormInputText(array('label' => 'CSS class'));
     $this->validatorSchema['cssClass'] = new dmValidatorCssClasses(array('required' => false));
     $this->setDefault('cssClass', $this->dmWidget->get('css_class'));
     /*
      * if the user can not edit widgets (but only fast edit them)
      * remove the CSS class field
      */
     if (($user = $this->getService('user')) && !$user->can('widget_edit')) {
         $this->changeToHidden('cssClass');
         $this->widgetSchema['cssClass']->setAttribute('readonly', true);
         //unset($this['cssClass']);
     }
 }
 public function configure()
 {
     parent::configure();
     $this->widgetSchema['dm_behavior_enabled'] = new sfWidgetFormInputCheckbox(array('label' => 'Enabled'));
     $this->validatorSchema['dm_behavior_enabled'] = new sfValidatorBoolean();
 }
 public function configure()
 {
     parent::configure();
     $this->widgetSchema['behaviors'] = new sfWidgetFormInputHidden();
     $this->validatorSchema['behaviors'] = new sfValidatorPass();
 }