/** * Constructor. * * Available options: * * - alert_text: The text of the Javascript alert to show * - hide_parent: Whether to hide the parent form when clicking the checkbox * - parent_level: The number of times parentNode must be called to reach the parent to hide. * Recommended values: 6 for embedded form, 7 for merged form * * @param array $options An array of options * @param array $attributes An array of default HTML attributes * * @see sfWidgetFormInput */ public function __construct($options = array(), $attributes = array()) { parent::__construct($options, $attributes); if ($this->getOption('hide_parent')) { $hideParentCode = 'this' . str_repeat('.parentNode', $this->getOption('parent_level')) . '.style.display="none";'; if ($this->getOption('alert_text')) { $this->setAttribute('onclick', sprintf('if(confirm("%s")) { %s } else return false;', $this->translate($this->getOption('alert_text')), $hideParentCode)); } else { $this->setAttribute('onclick', $hideParentCode); } } }
public function __construct($options = array(), $attributes = array()) { parent::__construct($options, $attributes); }
public function __construct($options = array(), $attributes = array()) { $this->addOption('inner_label'); parent::__construct($options, $attributes); }