jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/381962 )
Change subject: PHP: Implement SearchInputWidget, deprecate search option ...................................................................... PHP: Implement SearchInputWidget, deprecate search option Bug: T166685 Change-Id: I31caa6a84015c45e313c317aaac0cfbe6db48831 --- M bin/testsuitegenerator.rb M demos/pages/widgets.php A php/widgets/SearchInputWidget.php M php/widgets/TextInputWidget.php 4 files changed, 43 insertions(+), 0 deletions(-) Approvals: jenkins-bot: Verified Jforrester: Looks good to me, approved diff --git a/bin/testsuitegenerator.rb b/bin/testsuitegenerator.rb index 711059f..3770661 100644 --- a/bin/testsuitegenerator.rb +++ b/bin/testsuitegenerator.rb @@ -81,6 +81,11 @@ ['FieldLayout', 'help'] => [], ['ActionFieldLayout', 'help'] => [], ['FieldsetLayout', 'help'] => [], + # the dynamic 'clear' indicator in JS messes everything up + ['SearchInputWidget', 'value'] => [], + ['SearchInputWidget', 'indicator'] => [], + ['SearchInputWidget', 'required'] => [], + ['SearchInputWidget', 'disabled'] => [], # these are defined by Element and would bloat the tests 'classes' => [], 'id' => [], diff --git a/demos/pages/widgets.php b/demos/pages/widgets.php index 4848a47..fa48e7d 100644 --- a/demos/pages/widgets.php +++ b/demos/pages/widgets.php @@ -368,6 +368,13 @@ ] ), new OOUI\FieldLayout( + new OOUI\SearchInputWidget(), + [ + 'label' => "SearchInputWidget", + 'align' => 'top' + ] + ), + new OOUI\FieldLayout( new OOUI\TextInputWidget( [ 'value' => 'Access key: S', 'accessKey' => 's' diff --git a/php/widgets/SearchInputWidget.php b/php/widgets/SearchInputWidget.php new file mode 100644 index 0000000..6349479 --- /dev/null +++ b/php/widgets/SearchInputWidget.php @@ -0,0 +1,25 @@ +<?php + +namespace OOUI; + +/** + * Input widget with a text field. + */ +class SearchInputWidget extends TextInputWidget { + use IconElement; + use IndicatorElement; + + public function __construct( array $config = [] ) { + // Config initialization + $config = array_merge( [ + 'icon' => 'search', + ], $config ); + + // Parent constructor + parent::__construct( $config ); + } + + protected function getSaneType( $config ) { + return 'search'; + } +} diff --git a/php/widgets/TextInputWidget.php b/php/widgets/TextInputWidget.php index ceab8ae..72abc16 100644 --- a/php/widgets/TextInputWidget.php +++ b/php/widgets/TextInputWidget.php @@ -87,6 +87,12 @@ 'Use MultilineTextInputWidget instead.' ); } + if ( $config['type'] === 'search' && !( $this instanceof SearchInputWidget ) ) { + Element::warnDeprecation( + 'The TextInputWidget "type" => "search" is deprecated as of OOjs UI v0.22.2. ' . + 'Use SearchInputWidget instead.' + ); + } // Traits $this->initializeIconElement( $config ); -- To view, visit https://gerrit.wikimedia.org/r/381962 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I31caa6a84015c45e313c317aaac0cfbe6db48831 Gerrit-PatchSet: 4 Gerrit-Project: oojs/ui Gerrit-Branch: master Gerrit-Owner: Prtksxna <psax...@wikimedia.org> Gerrit-Reviewer: Bartosz DziewoĆski <matma....@gmail.com> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits