Perforce Chronicle 2012.2/486814
API Documentation
|
Validates string for suitability as a content type element name. More...
Public Member Functions | |
__construct () | |
Revised message templates upon instantiation. | |
isValid ($value) | |
Defined by Zend_Validate_Interface. | |
Public Attributes | |
const | ILLEGAL_ELEMENT_NAME = 'illegalElementName' |
const | ZEND_FORM_EXCEPTION = 'zendFormException' |
Validates string for suitability as a content type element name.
P4Cms_Validate_ContentTypeElementName::__construct | ( | ) |
Revised message templates upon instantiation.
Reimplemented from P4Cms_Validate_RecordField.
{ $message = "Only '_' and alphanumeric characters are permitted in element names."; $this->_messageTemplates[self::ILLEGAL_ELEMENT_NAME] = $message; $this->_messageTemplates[self::ZEND_FORM_EXCEPTION] = 'Zend_Form failed to accept the field name.'; }
P4Cms_Validate_ContentTypeElementName::isValid | ( | $ | value | ) |
Defined by Zend_Validate_Interface.
Checks if the given element name conforms to Zend_Form naming.
string | $value | The value to validate. |
Reimplemented from P4Cms_Validate_RecordField.
{ $this->_setValue($value); // validate that the name contains something if (!isset($value) or !strlen($value)) { $this->_error(self::IS_EMPTY); return false; } // validate against Zend_Form_Element's filterName $element = null; try { $element = new Zend_Form_Element($value); } catch (Exception $e) { $this->_error(self::ZEND_FORM_EXCEPTION); return false; } if ($element->filterName($value) !== $value) { $this->_error(self::ILLEGAL_ELEMENT_NAME); return false; } return parent::isValid($value); }
const P4Cms_Validate_ContentTypeElementName::ILLEGAL_ELEMENT_NAME = 'illegalElementName' |
const P4Cms_Validate_ContentTypeElementName::ZEND_FORM_EXCEPTION = 'zendFormException' |