Cscott has uploaded a new change for review.
https://gerrit.wikimedia.org/r/190364
Change subject: Various fixes to the PHP implementation
......................................................................
Various fixes to the PHP implementation
* Added a number of missing property declarations.
* Cleared the options array in DropdownInputWidget::setOptions().
* Added access key support to ButtonElement.
* Added LabelWidget to the widgets.php demo, for completeness.
* Documentation comment improvements.
Change-Id: I3843be8fe8aa003e3408a8c5251c06767ffd4990
---
M demos/widgets.php
M php/elements/ButtonElement.php
M php/layouts/FieldLayout.php
M php/layouts/FieldsetLayout.php
M php/widgets/ButtonInputWidget.php
M php/widgets/CheckboxInputWidget.php
M php/widgets/DropdownInputWidget.php
M php/widgets/InputWidget.php
M php/widgets/LabelWidget.php
M php/widgets/TextInputWidget.php
10 files changed, 76 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/64/190364/1
diff --git a/demos/widgets.php b/demos/widgets.php
index a95668c..38ca94b 100644
--- a/demos/widgets.php
+++ b/demos/widgets.php
@@ -628,6 +628,25 @@
'label' =>
"IndicatorWidget (disabled)\xE2\x80\x8E",
'align' => 'top'
)
+ ),
+ new OOUI\FieldLayout(
+ new OOUI\LabelWidget(
array(
+ 'label' =>
'Label'
+ ) ),
+ array(
+ 'label' =>
"LabelWidget (normal)\xE2\x80\x8E",
+ 'align' => 'top'
+ )
+ ),
+ new OOUI\FieldLayout(
+ new OOUI\LabelWidget(
array(
+ 'label' =>
'Label',
+ 'disabled' =>
true,
+ ) ),
+ array(
+ 'label' =>
"LabelWidget (disabled)\xE2\x80\x8E",
+ 'align' => 'top'
+ )
)
)
) );
diff --git a/php/elements/ButtonElement.php b/php/elements/ButtonElement.php
index 33942fc..57b2f57 100644
--- a/php/elements/ButtonElement.php
+++ b/php/elements/ButtonElement.php
@@ -18,12 +18,20 @@
*/
protected $framed = false;
+ /**
+ * Button's access key.
+ *
+ * @var string
+ */
+ protected $accessKey = null;
+
public static $targetPropertyName = 'button';
/**
* @param Element $element Element being mixed into
* @param array $config Configuration options
* @param boolean $config['framed'] Render button with a frame
(default: true)
+ * @param string $config['accessKey'] Button's access key
*/
public function __construct( Element $element, array $config = array()
) {
// Parent constructor
@@ -34,6 +42,7 @@
$this->element->addClasses( array( 'oo-ui-buttonElement' ) );
$this->target->addClasses( array( 'oo-ui-buttonElement-button'
) );
$this->toggleFramed( isset( $config['framed'] ) ?
$config['framed'] : true );
+ $this->setAccessKey( isset( $config['accessKey'] ) ?
$config['accessKey'] : null );
$this->target->setAttributes( array(
'role' => 'button',
) );
diff --git a/php/layouts/FieldLayout.php b/php/layouts/FieldLayout.php
index 345011a..3e73fd6 100644
--- a/php/layouts/FieldLayout.php
+++ b/php/layouts/FieldLayout.php
@@ -25,6 +25,15 @@
protected $align;
/**
+ * Field widget to be laid out.
+ *
+ * @var Widget
+ */
+ protected $fieldWidget;
+
+ private $field, $body, $help;
+
+ /**
* @param Widget $fieldWidget Field widget
* @param array $config Configuration options
* @param string $config['align'] Alignment mode, either 'left',
'right', 'top' or 'inline'
diff --git a/php/layouts/FieldsetLayout.php b/php/layouts/FieldsetLayout.php
index cb73bf2..f9faa35 100644
--- a/php/layouts/FieldsetLayout.php
+++ b/php/layouts/FieldsetLayout.php
@@ -9,13 +9,6 @@
*/
class FieldsetLayout extends Layout {
/**
- * Alignment.
- *
- * @var string
- */
- protected $align;
-
- /**
* @param array $config Configuration options
* @param FieldLayout[] $config['items'] Items to add
*/
diff --git a/php/widgets/ButtonInputWidget.php
b/php/widgets/ButtonInputWidget.php
index b2e5928..9f319c6 100644
--- a/php/widgets/ButtonInputWidget.php
+++ b/php/widgets/ButtonInputWidget.php
@@ -6,6 +6,17 @@
* A button that is an input widget. Intended to be used within a FormLayout.
*/
class ButtonInputWidget extends InputWidget {
+ /* Properties */
+
+ /**
+ * Whether to use `<input/>` rather than `<button/>`.
+ *
+ * @var boolean
+ */
+ protected $useInputTag;
+
+ private $labelElementMixin;
+
/**
* @param array $config Configuration options
* @param string $config['type'] HTML tag `type` attribute, may be
'button', 'submit' or 'reset'
diff --git a/php/widgets/CheckboxInputWidget.php
b/php/widgets/CheckboxInputWidget.php
index 3bb54bb..d6e7790 100644
--- a/php/widgets/CheckboxInputWidget.php
+++ b/php/widgets/CheckboxInputWidget.php
@@ -7,6 +7,15 @@
*/
class CheckboxInputWidget extends InputWidget {
+ /* Properties */
+
+ /**
+ * Whether the checkbox is selected.
+ *
+ * @var boolean
+ */
+ protected $selected;
+
/**
* @param array $config Configuration options
* @param boolean $config['selected'] Whether the checkbox is initially
selected
@@ -31,6 +40,7 @@
* Set selection state of this checkbox.
*
* @param boolean $state Whether the checkbox is selected
+ * @chainable
*/
public function setSelected( $state ) {
$this->selected = (bool)$state;
diff --git a/php/widgets/DropdownInputWidget.php
b/php/widgets/DropdownInputWidget.php
index 3fe91a5..042f1c7 100644
--- a/php/widgets/DropdownInputWidget.php
+++ b/php/widgets/DropdownInputWidget.php
@@ -55,6 +55,7 @@
public function setOptions( $options ) {
$value = $this->getValue();
$isValueAvailable = false;
+ $this->options = array();
// Rebuild the dropdown menu
$this->input->clearContent();
diff --git a/php/widgets/InputWidget.php b/php/widgets/InputWidget.php
index a51f904..fa1ecbb 100644
--- a/php/widgets/InputWidget.php
+++ b/php/widgets/InputWidget.php
@@ -12,6 +12,13 @@
/* Properties */
/**
+ * Input element.
+ *
+ * @var Tag
+ */
+ protected $input;
+
+ /**
* Input value.
*
* @var string
diff --git a/php/widgets/LabelWidget.php b/php/widgets/LabelWidget.php
index 64243a6..65e3a3c 100644
--- a/php/widgets/LabelWidget.php
+++ b/php/widgets/LabelWidget.php
@@ -11,6 +11,15 @@
public static $tagName = 'span';
+ /* Properties */
+
+ /**
+ * Input element.
+ *
+ * @var Tag
+ */
+ protected $input;
+
/**
* @param array $config Configuration options
* @param InputWidget $config['input'] Input widget this label is for
(default: null)
diff --git a/php/widgets/TextInputWidget.php b/php/widgets/TextInputWidget.php
index 2dd4de6..57a9c6a 100644
--- a/php/widgets/TextInputWidget.php
+++ b/php/widgets/TextInputWidget.php
@@ -10,7 +10,7 @@
/* Properties */
/**
- * Prevent chages.
+ * Prevent changes.
*
* @var boolean
*/
--
To view, visit https://gerrit.wikimedia.org/r/190364
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3843be8fe8aa003e3408a8c5251c06767ffd4990
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits