+ /**
+ * Put a form section together from the individual fields' HTML, merging it and wrapping.
+ * @param OOUI\\FieldLayout[] $fieldsHtml
+ * @param string $sectionName
+ * @param bool $anyFieldHasLabel Unused
+ * @return string HTML
+ */
+ protected function formatSection( array $fieldsHtml, $sectionName, $anyFieldHasLabel ) {
+ $config = array(
+ 'items' => $fieldsHtml,
+ );
+ if ( $sectionName ) {
+ $config['id'] = Sanitizer::escapeId( $sectionName );
+ }
+ if ( is_string( $this->mWrapperLegend ) ) {
+ $config['label'] = $this->mWrapperLegend;
+ }
+ return new OOUI\FieldsetLayout( $config );
+ }
+
+ /**
+ * @param string|array|Status $err
+ * @return string
+ */
+ function getErrors( $err ) {
+ if ( !$err ) {
+ $errors = array();
+ } else if ( $err instanceof Status ) {
+ if ( $err->isOK() ) {
+ $errors = array();
+ } else {
+ $errors = $err->getErrorsByType( 'error' );
+ foreach ( $errors as &$error ) {
+ // Input: array( 'message' => 'foo', 'errors' => array( 'a', 'b', 'c' ) )
+ // Output: array( 'foo', 'a', 'b', 'c' )
+ $error = array_merge( array( $error['message'] ), $error['params'] );
+ }
+ }
+ } else {
+ $errors = $err;
+ if ( !is_array( $errors ) ) {
+ $errors = array( $errors );
+ }
+ }
+
+ foreach ( $errors as &$error ) {
+ if ( is_array( $error ) ) {
+ $msg = array_shift( $error );
+ } else {
+ $msg = $error;
+ $error = array();
+ }
+ $error = $this->msg( $msg, $error )->parse();
+ $error = new OOUI\HtmlSnippet( $error );