Last active
November 1, 2019 12:46
-
-
Save argentinaluiz/36aeaee91d2f228f21a44b89576a4243 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Pessoa\Form; | |
use Zend\Form\Fieldset; | |
use Pessoa\Entity\Cliente; | |
class ClienteFieldset extends Fieldset { | |
public function __construct() { | |
$this->add([ | |
'type' => 'Pessoa\Form\PessoaFieldset', | |
'name' => 'pessoa' | |
]); | |
$this->add([ | |
'type' => 'Text', | |
'name' => 'telefone1', | |
'attributes' => [ | |
'id' => 'telefone1', | |
], | |
'options' => [ | |
'label' => 'Telefone1', | |
'label_attributes' => [ | |
'class' => 'control-label' | |
] | |
] | |
]); | |
$this->add([ | |
'type' => 'Text', | |
'name' => 'telefone2', | |
'attributes' => [ | |
'id' => 'telefone2', | |
], | |
'options' => [ | |
'label' => 'Telefone2', | |
'label_attributes' => [ | |
'class' => 'control-label' | |
] | |
] | |
]); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Pessoa\Filter; | |
use Zend\InputFilter\InputFilter; | |
class ClienteFilter extends InputFilter | |
{ | |
public function __construct() | |
{ | |
$this->add([ | |
'type' => 'Pessoa\Filter\PessoaFilter', | |
], 'pessoa'); | |
$this->add([ | |
'name' => 'telefone1', | |
'required' => false, | |
'filters' => [ | |
['name' => 'StringTrim'], | |
['name' => 'StripTags'], | |
] | |
]); | |
$this->add([ | |
'name' => 'telefone2', | |
'required' => false, | |
'filters' => [ | |
['name' => 'StringTrim'], | |
['name' => 'StripTags'], | |
] | |
]); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CreateClienteFilter extends InputFilter { | |
public function __construct() { | |
$this->add([ | |
'type' => 'Pessoa\Filter\ClienteFilter' | |
], 'cliente'); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Pessoa\Form; | |
use Zend\Form\Form; | |
class CreateClienteForm extends Form | |
{ | |
public function __construct() | |
{ | |
$this->add([ | |
'type' => 'Pessoa\Form\ClienteFieldset', | |
'name' => 'cliente', | |
'options' => [ | |
'use_as_base_fieldset' => true | |
] | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment