Datatypes\Textstring\Editor::load PHP Method

load() public method

Load textstring editor
public load ( ) : Zend\Form\Element\Text
return Zend\Form\Element\Text
    public function load()
    {
        $parameters = $this->getConfig();
        $property = $this->getProperty();
        $textstring = new Element\Text($this->getName());
        $textstring->setAttribute('class', 'form-control');
        $textstring->setLabel($property->getName());
        $textstring->setAttribute('id', $this->getName());
        $textstring->setValue($this->getValue());
        $textstring->setAttribute('required', $property->isRequired());
        if (!empty($parameters['length'])) {
            $textstring->setAttribute('maxlength', $parameters['length']);
        }
        return $textstring;
    }

Usage Example

Example #1
0
 /**
  * Test
  *
  * @return void
  */
 public function testLoad()
 {
     $this->assertInstanceOf('Zend\\Form\\Element\\Text', $this->object->load());
 }