addErrorMsg( 'smw_emptystring' ); } $allowsListValueParser = $this->dataValueServiceFactory->getValueParser( $this ); $allowsListValueParser->parse( $value ); if ( $allowsListValueParser->getErrors() !== [] ) { foreach ( $allowsListValueParser->getErrors() as $error ) { $this->addErrorMsg( $error ); } } else { parent::parseUserValue( $value ); } } /** * @see DataValue::getShortWikiText * * @param string $value */ public function getShortWikiText( $linker = null ) { if ( !$this->isValid() ) { return ''; } $id = $this->getDataItem()->getString(); return '[['. Localizer::getInstance()->getNamespaceTextById( NS_MEDIAWIKI ) . ':' . self::LIST_PREFIX . $id . '|' . $id .']]'; } /** * @see DataValue::getLongHtmlText * * @param string $value */ public function getLongHtmlText( $linker = null ) { return $this->getShortHtmlText( $linker ); } /** * @see DataValue::getShortHtmlText * * @param string $value */ public function getShortHtmlText( $linker = null ) { if ( !$this->isValid() ) { return ''; } $id = $this->getDataItem()->getString(); $title = \Title::newFromText( self::LIST_PREFIX . $id, NS_MEDIAWIKI ); return \Html::rawElement( 'a', [ 'href' => $title->getLocalUrl(), 'target' => '_blank' ], $id ); } }