Fz-29 has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/356901 )
Change subject: Added Hierarchy option to #cargo_declare in order to complete the first step in the task T161034. ...................................................................... Added Hierarchy option to #cargo_declare in order to complete the first step in the task T161034. Change-Id: I53e57ab6b09773d99c983ebbcb7cc50991420014 --- M CargoFieldDescription.php 1 file changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo refs/changes/01/356901/1 diff --git a/CargoFieldDescription.php b/CargoFieldDescription.php index 982826a..18e72dd 100644 --- a/CargoFieldDescription.php +++ b/CargoFieldDescription.php @@ -14,6 +14,7 @@ private $mDelimiter; public $mAllowedValues = null; public $mIsHidden = false; + public $mIsHierarchy = false; public $mOtherParams = array(); /** @@ -27,7 +28,7 @@ if ( strpos( $fieldDescriptionStr, 'List' ) === 0 ) { $matches = array(); - $foundMatch = preg_match( '/List \((.*)\) of (.*)/', $fieldDescriptionStr, $matches ); + $foundMatch = preg_match( '/List \((.*)\) of (.*)/s', $fieldDescriptionStr, $matches ); if ( !$foundMatch ) { // Return a true error message here? return null; @@ -39,7 +40,7 @@ // There may be additional parameters, in/ parentheses. $matches = array(); - $foundMatch2 = preg_match( '/([^(]*)\s*\((.*)\)/', $fieldDescriptionStr, $matches ); + $foundMatch2 = preg_match( '/([^(]*)\s*\((.*)\)/s', $fieldDescriptionStr, $matches ); if ( $foundMatch2 ) { $fieldDescriptionStr = trim( $matches[1] ); $extraParamsString = $matches[2]; @@ -48,6 +49,9 @@ $extraParamParts = explode( '=', $extraParam, 2 ); if ( count( $extraParamParts ) == 1 ) { $paramKey = trim( $extraParamParts[0] ); + if($paramKey == 'hierarchy') { + $mIsHierarchy = true; + } $fieldDescription->mOtherParams[$paramKey] = true; } else { $paramKey = trim( $extraParamParts[0] ); @@ -108,6 +112,8 @@ $fieldDescription->mAllowedValues = $value; } elseif ( $param == 'hidden' ) { $fieldDescription->mIsHidden = true; + } elseif ( $param == 'hierarchy' ) { + $fieldDescription->mIsHierarchy = true; } } return $fieldDescription; @@ -144,6 +150,9 @@ if ( $this->mIsHidden ) { $descriptionData['hidden'] = true; } + if ( $this->mIsHierarchy ) { + $descriptionData['hierarchy'] = true; + } foreach ( $this->mOtherParams as $otherParam => $value ) { $descriptionData[$otherParam] = $value; } -- To view, visit https://gerrit.wikimedia.org/r/356901 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I53e57ab6b09773d99c983ebbcb7cc50991420014 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Cargo Gerrit-Branch: master Gerrit-Owner: Fz-29 <f29ah...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits