public function getTableRow( $value ) {
list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
$inputHtml = $this->getInputHTML( $value );
- $fieldType = get_class( $this );
+ $fieldType = static::class;
$helptext = $this->getHelpTextHtmlTable( $this->getHelpText() );
$cellAttributes = [];
$rowAttributes = [];
public function getDiv( $value ) {
list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
$inputHtml = $this->getInputHTML( $value );
- $fieldType = get_class( $this );
+ $fieldType = static::class;
$helptext = $this->getHelpTextHtmlDiv( $this->getHelpText() );
$cellAttributes = [];
$label = $this->getLabelHtml( $cellAttributes );
$infusable = false;
}
- $fieldType = get_class( $this );
+ $fieldType = static::class;
$help = $this->getHelpText();
$errors = $this->getErrorsRaw( $value );
foreach ( $errors as &$error ) {
}
/**
- * Returns the attributes required for the tooltip and accesskey.
+ * Returns the attributes required for the tooltip and accesskey, for Html::element() etc.
*
* @return array Attributes
*/
return Linker::tooltipAndAccesskeyAttribs( $this->mParams['tooltip'] );
}
+ /**
+ * Returns the attributes required for the tooltip and accesskey, for OOUI widgets' config.
+ *
+ * @return array Attributes
+ */
+ public function getTooltipAndAccessKeyOOUI() {
+ if ( empty( $this->mParams['tooltip'] ) ) {
+ return [];
+ }
+
+ return [
+ 'title' => Linker::titleAttrib( $this->mParams['tooltip'] ),
+ 'accessKey' => Linker::accesskey( $this->mParams['tooltip'] ),
+ ];
+ }
+
/**
* Returns the given attributes from the parameters
*
* @since 1.18
*/
protected static function formatErrors( $errors ) {
+ // Note: If you change the logic in this method, change
+ // htmlform.Checker.js to match.
+
if ( is_array( $errors ) && count( $errors ) === 1 ) {
$errors = array_shift( $errors );
}
public function skipLoadData( $request ) {
return !empty( $this->mParams['nodata'] );
}
+
+ /**
+ * Whether this field requires the user agent to have JavaScript enabled for the client-side HTML5
+ * form validation to work correctly.
+ *
+ * @return boolean
+ * @since 1.29
+ */
+ public function needsJSForHtml5FormValidation() {
+ if ( $this->mHideIf ) {
+ // This is probably more restrictive than it needs to be, but better safe than sorry
+ return true;
+ }
+ return false;
+ }
}