public function configure() { $this->widgetSchema['inner_target'] = new sfWidgetFormInputText(); $this->validatorSchema['inner_target'] = new sfValidatorString(array('required' => false)); $this->widgetSchema['event'] = new sfWidgetFormChoice(array('choices' => $this->events)); $this->validatorSchema['event'] = new sfValidatorChoice(array('choices' => array_keys($this->events))); $this->widgetSchema['opacity'] = new sfWidgetFormInputText(); $this->validatorSchema['opacity'] = new sfValidatorInteger(array('required' => true, 'min' => 0, 'max' => 100)); $this->widgetSchema['duration'] = new sfWidgetFormInputText(); $this->validatorSchema['duration'] = new sfValidatorInteger(array('min' => 0)); $this->widgetSchema['easing'] = new dmWidgetFormChoiceEasing(); $this->validatorSchema['easing'] = new dmValidatorChoiceEasing(array('required' => true)); $this->getWidgetSchema()->setHelps(array('inner_target' => 'Redefine selector for elements to fade (optional)', 'event' => 'Event that triggers the fade effect', 'opacity' => 'The percentage of transparency', 'duration' => 'Duration of fade animation in ms', 'easing' => 'The easing function for animation')); if (!$this->getDefault('event')) { $this->setDefault('event', 'load'); } if (!$this->getDefault('opacity')) { $this->setDefault('opacity', 50); } if (!$this->getDefault('duration')) { $this->setDefault('duration', 1000); } if (!$this->getDefault('easing')) { $this->setDefault('easing', 'jswing'); } parent::configure(); }
public function configure() { $this->widgetSchema['inner_target'] = new sfWidgetFormInputText(); $this->validatorSchema['inner_target'] = new sfValidatorString(array('required' => false)); $this->widgetSchema['title'] = new sfWidgetFormChoice(array('choices' => $this->getI18n()->translateArray($this->textSource))); $this->validatorSchema['title'] = new sfValidatorChoice(array('choices' => array_keys($this->textSource))); $this->widgetSchema['gravity'] = new sfWidgetFormChoice(array('choices' => $this->getI18n()->translateArray($this->gravity))); $this->validatorSchema['gravity'] = new sfValidatorChoice(array('choices' => array_keys($this->gravity))); $this->widgetSchema['opacity'] = new sfWidgetFormInputText(); $this->validatorSchema['opacity'] = new sfValidatorInteger(array('min' => 0, 'max' => 100)); $this->widgetSchema['trigger'] = new sfWidgetFormChoice(array('choices' => $this->getI18n()->translateArray($this->trigger))); $this->validatorSchema['trigger'] = new sfValidatorChoice(array('choices' => array_keys($this->trigger))); $this->widgetSchema['fade'] = new sfWidgetFormInputCheckbox(); $this->validatorSchema['fade'] = new sfValidatorBoolean(); $this->widgetSchema['delayIn'] = new sfWidgetFormInputText(); $this->validatorSchema['delayIn'] = new sfValidatorInteger(array('min' => 0)); $this->widgetSchema['delayOut'] = new sfWidgetFormInputText(); $this->validatorSchema['delayOut'] = new sfValidatorInteger(array('min' => 0)); $this->getWidgetSchema()->setLabels(array('inner_target' => 'Inner targets', 'title' => 'Text source', 'trigger' => 'Event', 'delayIn' => 'Delay in', 'delayOut' => 'Delay out')); $this->getWidgetSchema()->setHelps(array('inner_target' => 'You can enter several selectors separated with comma (,)', 'title' => 'Read text from which source?', 'gravity' => 'The position of the tip', 'fade' => 'Use fade animation to display tip?')); if (!$this->getDefault('inner_target')) { $this->setDefault('inner_target', 'img'); } if (!$this->getDefault('title')) { $this->setDefault('title', 'title'); } if (!$this->getDefault('gravity')) { $this->setDefault('gravity', 'ans'); } if (!$this->getDefault('opacity')) { $this->setDefault('opacity', 80); } if (!$this->getDefault('fade')) { $this->setDefault('fade', true); } if (!$this->getDefault('delayIn')) { $this->setDefault('delayIn', 0); } if (!$this->getDefault('delayOut')) { $this->setDefault('delayOut', 0); } parent::configure(); }
/** * Utility function * Renders the form for the behavior edit * @param dmBehaviorBaseForm $form * @param dmBehaviorsManager $behaviorsManager * @param boolean $withCopyActions * @return rendered form */ protected function renderEdit(dmBehaviorBaseForm $form, $behaviorsManager, $withCopyActions = true) { $helper = $this->getHelper(); $copyActions = ''; if ($withCopyActions && $this->getUser()->can('behavior_add')) { $copyActions .= $helper->tag('div.dm_cut_copy_actions.none', ($this->getUser()->can('behavior_delete') ? $helper->link('+/dmBehaviors/cut')->param('dm_behavior_id', $form->getDmBehavior()->get('id'))->text('')->title($this->getI18n()->__('Cut'))->set('.s16block.s16_cut.dm_behavior_cut') : '') . $helper->link('+/dmBehaviors/copy')->param('dm_behavior_id', $form->getDmBehavior()->get('id'))->text('')->title($this->getI18n()->__('Copy'))->set('.s16block.s16_copy.dm_behavior_copy')); } return $helper->tag('div.dm.dm_behavior_edit.dm_behavior_edit_form.' . dmString::underscore($form->getDmBehavior()->get('dm_behavior_key')) . '_form', array('json' => array('form_class' => $behaviorsManager->getBehaviorFormClass($form->getDmBehavior()->get('dm_behavior_key')), 'form_name' => $form->getName())), $form->render('.dm_form.list.little') . $copyActions); }