'color', ]; /** * @var \Zend\Validator\ValidatorInterface */ protected $validator; /** * Get validator * * @return \Zend\Validator\ValidatorInterface */ protected function getValidator() { if (null === $this->validator) { $this->validator = new RegexValidator('/^#[0-9a-fA-F]{6}$/'); } return $this->validator; } /** * Provide default input rules for this element * * Attaches a color validator. * * @return array */ public function getInputSpecification() { return [ 'name' => $this->getName(), 'required' => true, 'filters' => [ ['name' => 'Zend\Filter\StringTrim'], ['name' => 'Zend\Filter\StringToLower'], ], 'validators' => [ $this->getValidator(), ], ]; } }