public function configure() { $this->useFields(array('title')); $this->addPagerItems(); $this->widgetSchema['title'] = new sfWidgetFormInputText(); $this->widgetSchema->setNameFormat('searchBibliography[%s]'); $this->validatorSchema['title'] = new sfValidatorString(array('required' => false, 'trim' => true)); $choices = array_merge(array('' => ''), Bibliography::getAvailableTypes()); $this->widgetSchema['type'] = new sfWidgetFormChoice(array('choices' => $choices)); $this->validatorSchema['type'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($choices))); }
public function configure() { $this->useFields(array('title', 'type', 'abstract', 'year')); $this->validatorSchema['title'] = new sfValidatorString(array('required' => true, 'trim' => true)); $this->widgetSchema['title']->setLabel('Full Bibliographic reference'); $this->validatorSchema['year'] = new sfValidatorInteger(array('required' => false, 'min' => 0, 'max' => date('Y') + 2)); $this->widgetSchema['year']->setAttributes(array('class' => 'small_size')); $choices = Bibliography::getAvailableTypes(); $this->widgetSchema['type'] = new sfWidgetFormChoice(array('choices' => $choices)); $this->validatorSchema['type'] = new sfValidatorChoice(array('required' => true, 'choices' => array_keys($choices))); $this->validatorSchema['Authors_holder'] = new sfValidatorPass(); $this->widgetSchema['Authors_holder'] = new sfWidgetFormInputHidden(array('default' => 1)); $this->loadEmbed('Authors'); //force load of authors }