Esempio n. 1
0
 public function executeRichTextarea(sfWebRequest $request)
 {
     $this->sortForm = new BaseForm();
     $this->configForm = new opRichTextareaOpenPNEConfigForm();
     $this->buttonConfigForm = new opRichTextareaOpenPNEButtonConfigForm();
     $this->buttonConfig = opWidgetFormRichTextareaOpenPNE::getAllButtons();
     if ($request->isMethod(sfWebRequest::POST)) {
         $this->configForm->bind($request->getParameter('config'));
         $this->buttonConfigForm->bind($request->getParameter('button'));
         if ($this->configForm->isValid() && $this->buttonConfigForm->isValid()) {
             $this->configForm->save();
             $this->buttonConfigForm->save();
         }
     }
 }
 public function configure()
 {
     //initialize
     new opWidgetFormRichTextareaOpenPNE();
     $allButtons = opWidgetFormRichTextareaOpenPNE::getAllButtons();
     $buttons = opWidgetFormRichTextareaOpenPNE::getButtons();
     $diff = array_diff(array_keys($allButtons), array_keys($buttons));
     foreach ($buttons as $key => $button) {
         $this->setWidget($key, new sfWidgetFormInputCheckbox());
         $this->setValidator($key, new sfValidatorBoolean());
         $this->setDefault($key, true);
     }
     foreach ($diff as $buttonName) {
         $this->setWidget($buttonName, new sfWidgetFormInputCheckbox());
         $this->setValidator($buttonName, new sfValidatorBoolean());
         $this->setDefault($buttonName, false);
     }
     $this->widgetSchema->setNameFormat('button[%s]');
 }