Beispiel #1
0
 /**
  * @param array $params
  */
 public function __construct($params)
 {
     parent::__construct($params);
     $this->msg = empty($params['licenses']) ? wfMessage('licenses')->inContentLanguage()->plain() : $params['licenses'];
     $this->selected = null;
     $this->makeLicenses();
 }
Beispiel #2
0
 /**
  * @param array $params
  *   In adition to the usual HTMLFormField parameters, this can take the following fields:
  *   - flatlist: If given, the options will be displayed on a single line (wrapping to following
  *     lines if necessary), rather than each one on a line of its own. This is desirable mostly
  *     for very short lists of concisely labelled options.
  */
 public function __construct($params)
 {
     parent::__construct($params);
     if (isset($params['flatlist'])) {
         $this->mClass .= ' mw-htmlform-flatlist';
     }
 }
Beispiel #3
0
 /**
  * Constructor
  *
  * @param $params array
  */
 public function __construct($params)
 {
     parent::__construct($params);
     $this->msg = empty($params['licenses']) ? wfMsg('licenses') : $params['licenses'];
     $this->selected = null;
     $this->makeLicenses();
 }
Beispiel #4
0
 public function __construct($params)
 {
     parent::__construct($params);
     # Per HTML5 spec, hidden fields cannot be 'required'
     # http://www.w3.org/TR/html5/forms.html#hidden-state-%28type=hidden%29
     unset($this->mParams['required']);
 }
 public function __construct($params)
 {
     parent::__construct($params);
     # Per HTML5 spec, hidden fields cannot be 'required'
     # http://dev.w3.org/html5/spec/states-of-the-type-attribute.html#hidden-state
     unset($this->mParams['required']);
 }
 public function __construct($info)
 {
     $info['nodata'] = true;
     if (isset($info['flags'])) {
         $this->mFlags = $info['flags'];
     }
     # Generate the label from a message, if possible
     if (isset($info['buttonlabel-message'])) {
         $msgInfo = $info['buttonlabel-message'];
         if (is_array($msgInfo)) {
             $msg = array_shift($msgInfo);
         } else {
             $msg = $msgInfo;
             $msgInfo = array();
         }
         $this->buttonLabel = $this->msg($msg, $msgInfo)->parse();
     } elseif (isset($info['buttonlabel'])) {
         if ($info['buttonlabel'] === ' ') {
             // Apparently some things set &nbsp directly and in an odd format
             $this->buttonLabel = ' ';
         } else {
             $this->buttonLabel = htmlspecialchars($info['buttonlabel']);
         }
     } elseif (isset($info['buttonlabel-raw'])) {
         $this->buttonLabel = $info['buttonlabel-raw'];
     }
     parent::__construct($info);
 }
 public function __construct($params)
 {
     $missing = array_diff(self::$requiredParams, array_keys($params));
     if ($missing) {
         throw new HTMLFormFieldRequiredOptionsException($this, $missing);
     }
     parent::__construct($params);
 }
 public function __construct($info)
 {
     $info['nodata'] = true;
     if (isset($info['flags'])) {
         $this->mFlags = $info['flags'];
     }
     parent::__construct($info);
 }
 public function __construct($params)
 {
     parent::__construct($params);
     // For differentiating the type of form, mainly
     if (isset($params['prefix'])) {
         $this->prefix = $params['prefix'];
     }
 }
Beispiel #10
0
 /**
  * @param array $params
  *   - type: HTML textfield type
  *   - size: field size in characters (defaults to 45)
  *   - placeholder/placeholder-message: set HTML placeholder attribute
  *   - spellcheck: set HTML spellcheck attribute
  *   - persistent: upon unsuccessful requests, retain the value (defaults to true, except
  *     for password fields)
  */
 public function __construct($params)
 {
     parent::__construct($params);
     if (isset($params['placeholder-message'])) {
         $this->mPlaceholder = $this->getMessage($params['placeholder-message'])->parse();
     } elseif (isset($params['placeholder'])) {
         $this->mPlaceholder = $params['placeholder'];
     }
 }
 public function __construct($params)
 {
     parent::__construct($params);
     if (isset($this->mParams['output-as-default'])) {
         $this->outputAsDefault = (bool) $this->mParams['output-as-default'];
     }
     # Per HTML5 spec, hidden fields cannot be 'required'
     # http://www.w3.org/TR/html5/forms.html#hidden-state-%28type=hidden%29
     unset($this->mParams['required']);
 }
 /**
  * @param array $params
  *   In adition to the usual HTMLFormField parameters, this can take the following fields:
  *   - dropdown: If given, the options will be displayed inside a dropdown with a text field that
  *     can be used to filter them. This is desirable mostly for very long lists of options.
  *     This only works for users with JavaScript support and falls back to the list of checkboxes.
  *   - flatlist: If given, the options will be displayed on a single line (wrapping to following
  *     lines if necessary), rather than each one on a line of its own. This is desirable mostly
  *     for very short lists of concisely labelled options.
  */
 public function __construct($params)
 {
     parent::__construct($params);
     // For backwards compatibility, also handle the old way with 'cssclass' => 'mw-chosen'
     if (isset($params['dropdown']) || strpos($this->mClass, 'mw-chosen') !== false) {
         $this->mClass .= ' mw-htmlform-dropdown';
     }
     if (isset($params['flatlist'])) {
         $this->mClass .= ' mw-htmlform-flatlist';
     }
 }
 public function __construct($info)
 {
     if (isset($info['buttonclass'])) {
         $this->mButtonClass = $info['buttonclass'];
     }
     if (isset($info['buttonid'])) {
         $this->mButtonId = $info['buttonid'];
     }
     if (isset($info['buttonname'])) {
         $this->mButtonName = $info['buttonname'];
     }
     if (isset($info['buttondefault'])) {
         $this->mButtonValue = $info['buttondefault'];
     }
     if (isset($info['buttontype'])) {
         $this->mButtonType = $info['buttontype'];
     }
     parent::__construct($info);
 }
 public function __construct($params)
 {
     $this->uniqueId = get_class($this) . ++self::$counter . 'x';
     parent::__construct($params);
     if (empty($this->mParams['fields']) || !is_array($this->mParams['fields'])) {
         throw new MWException('HTMLFormFieldCloner called without any fields');
     }
     // Make sure the delete button, if explicitly specified, is sane
     if (isset($this->mParams['fields']['delete'])) {
         $class = 'mw-htmlform-cloner-delete-button';
         $info = $this->mParams['fields']['delete'] + ['cssclass' => $class];
         unset($info['name'], $info['class']);
         if (!isset($info['type']) || $info['type'] !== 'submit') {
             throw new MWException('HTMLFormFieldCloner delete field, if specified, must be of type "submit"');
         }
         if (!in_array($class, explode(' ', $info['cssclass']))) {
             $info['cssclass'] .= " {$class}";
         }
         $this->mParams['fields']['delete'] = $info;
     }
 }
 public function __construct($info)
 {
     $info['nodata'] = true;
     if (isset($info['flags'])) {
         $this->mFlags = $info['flags'];
     }
     # Generate the label from a message, if possible
     if (isset($info['buttonlabel-message'])) {
         $this->buttonLabel = $this->getMessage($info['buttonlabel-message'])->parse();
     } elseif (isset($info['buttonlabel'])) {
         if ($info['buttonlabel'] === ' ') {
             // Apparently some things set &nbsp directly and in an odd format
             $this->buttonLabel = ' ';
         } else {
             $this->buttonLabel = htmlspecialchars($info['buttonlabel']);
         }
     } elseif (isset($info['buttonlabel-raw'])) {
         $this->buttonLabel = $info['buttonlabel-raw'];
     }
     $this->setShowEmptyLabel(false);
     parent::__construct($info);
 }
 /**
  * Constructor
  *
  * @param $params array Need a 'templates' key giving the templates list to parse.
  */
 public function __construct($params)
 {
     parent::__construct($params);
     $this->selected = null;
 }
 public function __construct($params)
 {
     parent::__construct($params);
     $this->mAllValue = array_key_exists('all', $params) ? $params['all'] : 'all';
 }
Beispiel #18
0
 public function __construct($info)
 {
     $info['nodata'] = true;
     parent::__construct($info);
 }
 public function __construct($params)
 {
     parent::__construct($params);
     $this->mAllValue = isset($this->mParams['all']) ? $this->mParams['all'] : 'all';
 }