コード例 #1
0
 public function configure()
 {
     parent::configure();
     unset($this['tree_left'], $this['tree_right'], $this['tree_level'], $this['created_at'], $this['updated_at']);
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('plopAdmin');
     $this->validatorSchema->setOption('allow_extra_fields', true);
     $this->validatorSchema->setOption('filter_extra_fields', false);
     if ($this->isNew()) {
         if ($this->getOption('culture', sfPlop::get('sf_plop_default_culture'))) {
             $this->getObject()->setCulture($this->getOption('culture'));
         }
         $this->embedForm($this->getObject()->getCulture(), new sfPlopPageI18nForm($this->getObject()->getTranslation($this->getObject()->getCulture()), array('only_title' => true)));
         $this->widgetSchema->moveField($this->getObject()->getCulture(), sfWidgetFormSchema::FIRST);
     }
     $this->widgetSchema['theme'] = new sfWidgetFormPlopChoiceSubTheme(array('add_empty' => true));
     $this->validatorSchema['theme'] = new sfvalidatorPlopChoiceSubTheme(array('required' => false));
     $this->widgetSchema['is_published']->setLabel('Is published ?');
     $this->widgetSchema['is_category']->setLabel('Is category ?');
     $this->widgetSchema['icon'] = new sfWidgetFormAssetExtraChoice(array('label' => 'Icon'));
     $this->validatorSchema['icon'] = new sfValidatorString(array('required' => false));
     $this->widgetSchema['template_id'] = new sfWidgetFormChoice(array('choices' => array('' => '') + $this->getTemplatePages()));
     $this->validatorSchema['template_id'] = new sfValidatorChoice(array('choices' => array_keys($this->getTemplatePages()), 'required' => false));
     if (!$this->getObject()->isRoot()) {
         $this->widgetSchema['position'] = new sfWidgetFormChoice(array('choices' => $this->getPositions(), 'expanded' => true));
         $this->validatorSchema['position'] = new sfValidatorChoice(array('choices' => array_keys($this->getPositions()), 'required' => false));
         $this->widgetSchema['position_relative'] = new sfWidgetFormChoice(array('label' => 'Relative position to', 'choices' => array('' => '') + sfPlopPagePeer::getPagesWithLevel()));
         $this->validatorSchema['position_relative'] = new sfValidatorChoice(array('choices' => array_keys(sfPlopPagePeer::getPagesWithLevel()), 'required' => false));
     }
     $this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'checkPositions'))));
 }
コード例 #2
0
 public function configure()
 {
     parent::configure();
     unset($this['slug'], $this['is_published'], $this['is_category'], $this['color'], $this['icon'], $this['template_id'], $this['position'], $this['position_relative'], $this['theme'], $this['tree_left'], $this['tree_right'], $this['tree_level'], $this['created_at'], $this['updated_at']);
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('plopAdmin');
     foreach (sfPlop::get('sf_plop_cultures') as $culture) {
         $this->embedForm($culture, new sfPlopPageI18nForm($this->getObject()->getTranslation($culture)));
     }
 }