/** * Like TitleInputWidget, but the namespace has to be input through a separate dropdown field. * * @param array $config Configuration options * @param array $config['namespace'] Configuration for the NamespaceInputWidget dropdown * with list of namespaces * @param array $config['title'] Configuration for the TitleInputWidget text field */ public function __construct(array $config = array()) { // Configuration initialization $config = array_merge(array('namespace' => array(), 'title' => array()), $config); // Parent constructor parent::__construct($config); // Properties $this->config = $config; $this->namespace = new NamespaceInputWidget($config['namespace']); $this->title = new TitleInputWidget(array_merge($config['title'], array('infusable' => false, 'relative' => true, 'namespace' => isset($config['namespace']['value']) ? $config['namespace']['value'] : null))); // Initialization $this->addClasses(array('mw-widget-complexTitleInputWidget'))->appendContent($this->namespace, $this->title); }
/** * @param array $config Configuration options * @param string $config['nameNamespace'] HTML input name for the namespace dropdown box (default: * 'namespace') * @param string $config['nameInvert'] HTML input name for the "invert selection" checkbox. If * null, the checkbox will not be generated. (default: 'invert') * @param string $config['nameAssociated'] HTML input name for the "include associated namespace" * checkbox. If null, the checkbox will not be generated. (default: 'associated') * @param string $config['includeAllValue'] If specified, add a "all namespaces" option to the * namespace dropdown, and use this as the input value for it * @param int|string $config['valueNamespace'] Input value of the namespace dropdown box. May be a * string only if 'includeAllValue' is set. * @param boolean $config['valueInvert'] Input value of the "invert selection" checkbox (default: * false) * @param boolean $config['valueAssociated'] Input value of the "include associated namespace" * checkbox (default: false) * @param string $config['labelInvert'] Text of label to use for "invert selection" checkbox * @param string $config['labelAssociated'] Text of label to use for "include associated * namespace" checkbox */ public function __construct(array $config = array()) { // Configuration initialization $config = array_merge(array('nameNamespace' => 'namespace', 'nameInvert' => 'invert', 'nameAssociated' => 'associated', 'valueNamespace' => null, 'valueInvert' => false, 'valueAssociated' => false), $config); // Parent constructor parent::__construct($config); // Properties $this->allValue = isset($config['includeAllValue']) ? $config['includeAllValue'] : null; $this->namespace = new \OOUI\DropdownInputWidget(array('name' => $config['nameNamespace'], 'value' => $config['valueNamespace'], 'options' => $this->getNamespaceDropdownOptions($config))); if ($config['nameAssociated'] !== null) { // FIXME Should use a LabelWidget? But they don't work like HTML <label>s yet $this->associated = new \OOUI\FieldLayout(new \OOUI\CheckboxInputWidget(array('name' => $config['nameAssociated'], 'selected' => $config['valueAssociated'], 'value' => '1')), array('align' => 'inline', 'label' => $config['labelAssociated'])); } if ($config['nameInvert'] !== null) { $this->invert = new \OOUI\FieldLayout(new \OOUI\CheckboxInputWidget(array('name' => $config['nameInvert'], 'selected' => $config['valueInvert'], 'value' => '1')), array('align' => 'inline', 'label' => $config['labelInvert'])); } // Initialization $this->addClasses(array('mw-widget-namespaceInputWidget'))->appendContent($this->namespace, $this->associated, $this->invert); }
/** * @param array $config Configuration options * @param array $config['namespace'] Configuration for the NamespaceInputWidget * dropdown with list of namespaces * @param string $config['namespace']['includeAllValue'] If specified, * add an "all namespaces" option to the dropdown, and use this as the input value for it * @param array|null $config['invert'] Configuration for the "invert selection" * CheckboxInputWidget. If null, the checkbox will not be generated. * @param array|null $config['associated'] Configuration for the "include associated namespace" * CheckboxInputWidget. If null, the checkbox will not be generated. * @param array $config['invertLabel'] Configuration for the FieldLayout with label * wrapping the "invert selection" checkbox * @param string $config['invertLabel']['label'] Label text for the label * @param array $config['associatedLabel'] Configuration for the FieldLayout with label * wrapping the "include associated namespace" checkbox * @param string $config['associatedLabel']['label'] Label text for the label */ public function __construct(array $config = []) { // Configuration initialization $config = array_merge(['namespace' => [], 'invert' => [], 'invertLabel' => [], 'associated' => [], 'associatedLabel' => []], $config); // Parent constructor parent::__construct($config); // Properties $this->config = $config; $this->namespace = new NamespaceInputWidget($config['namespace']); if ($config['associated'] !== null) { $this->associated = new \OOUI\CheckboxInputWidget(array_merge(['value' => '1'], $config['associated'])); // TODO Should use a LabelWidget? But they don't work like HTML <label>s yet $this->associatedLabel = new \OOUI\FieldLayout($this->associated, array_merge(['align' => 'inline'], $config['associatedLabel'])); } if ($config['invert'] !== null) { $this->invert = new \OOUI\CheckboxInputWidget(array_merge(['value' => '1'], $config['invert'])); // TODO Should use a LabelWidget? But they don't work like HTML <label>s yet $this->invertLabel = new \OOUI\FieldLayout($this->invert, array_merge(['align' => 'inline'], $config['invertLabel'])); } // Initialization $this->addClasses(['mw-widget-complexNamespaceInputWidget'])->appendContent($this->namespace, $this->associatedLabel, $this->invertLabel); }