Perforce Chronicle 2012.2/486814
API Documentation
|
Validates string for suitability as a record field name. More...
Public Member Functions | |
__construct () | |
Add a message template upon instantiation. | |
isValid ($value) | |
Checks if the given string is a valid record field name. | |
Public Attributes | |
const | LEADING_UNDERSCORE = 'leadingUnderscore' |
Validates string for suitability as a record field name.
The string must pass p4 attribute name validation. Additionally, it cannot begin with an underscore as this is reserved for record field metadata.
P4Cms_Validate_RecordField::__construct | ( | ) |
Add a message template upon instantiation.
Reimplemented in P4Cms_Validate_ContentTypeElementName.
{ $message = "First character cannot be underscore ('_')."; $this->_messageTemplates[self::LEADING_UNDERSCORE] = $message; }
P4Cms_Validate_RecordField::isValid | ( | $ | value | ) |
Checks if the given string is a valid record field name.
string | $value | the value to validate. |
Reimplemented from P4_Validate_KeyName.
Reimplemented in P4Cms_Validate_ContentTypeElementName.
{ // test for leading underscore ('_') character. if ($value[0] === "_") { $this->_error(static::LEADING_UNDERSCORE); return false; } return parent::isValid($value); }
const P4Cms_Validate_RecordField::LEADING_UNDERSCORE = 'leadingUnderscore' |