Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Attributes\Form;
- use Attributes\Service\AttributeType\AttributeTypeServiceInterface;
- use Zend\Form\Fieldset;
- use Zend\Form\Element;
- use Zend\Hydrator\Reflection as ReflectionHydrator;
- use Attributes\Model\EavAttribute;
- class AttributeFieldset extends Fieldset
- {
- private $_attribute_type;
- private $attribute_type_array; // dropdown
- public function __construct(AttributeTypeServiceInterface $attribute_type,$name = null, $options = array())
- {
- parent::__construct($name , $options );
- $type_list=$attribute_type->findAllAttributesType();
- foreach($type_list as $type_list_K => $type_list_V){
- $id = $type_list_V->getId();
- $name = $type_list_V->getName();
- $this->attribute_type_array[$id] = $name;
- }
- }
- public function init(){
- $this->add([
- 'name' => 'eav_validation_type',
- 'attributes' => [
- 'type' => 'text',
- 'size' => '50',
- 'class' => 'form-control',
- ],
- 'options' => [
- 'label' => 'Validation Type',
- ],
- ]);
- $this->add([
- 'name' => 'eav_attribute_input_label',
- 'attributes' => [
- 'type' => 'text',
- 'size' => '50',
- 'class' => 'form-control',
- ],
- 'options' => [
- 'label' => 'Attribute Name',
- ],
- ]);
- $this->add([
- 'name' => 'eav_attribute_code',
- 'attributes' => [
- 'type' => 'text',
- 'size' => '50',
- 'class' => 'form-control',
- ],
- 'options' => [
- 'label' => 'Attribute Code',
- ],
- ]);
- $this->add([
- 'type' => Element\Select::class,
- 'name' => 'eav_attribute_input_type_id',
- 'options' => [
- 'label' => 'Select an attribute type',
- 'value_options' => $this->attribute_type_array,
- 'empty_option' => "select attribute type"
- ],
- ]);
- $this->add(array(
- 'type' => 'Zend\Form\Element\Radio',
- 'name' => 'is_required',
- 'options' => array(
- 'label' => 'values required?',
- 'value_options' => array(
- '0' => 'Yes',
- '1' => 'No',
- ),
- ),
- ));
- $this->add(array(
- 'type' => 'Zend\Form\Element\Radio',
- 'name' => 'eav_attribute_unique',
- 'options' => array(
- 'label' => 'Unique Value?',
- 'value_options' => array(
- '0' => 'Yes',
- '1' => 'No',
- ),
- ),
- ));
- $this->add(array(
- 'type' => 'Zend\Form\Element\Radio',
- 'name' => 'can_product_display',
- 'options' => array(
- 'label' => 'Add to product display?',
- 'value_options' => array(
- '0' => 'Yes',
- '1' => 'No',
- ),
- ),
- ));
- $this->add(array(
- 'type' => 'Zend\Form\Element\Radio',
- 'name' => 'can_use_filter',
- 'options' => array(
- 'label' => 'Use as filter?',
- 'value_options' => array(
- '0' => 'Yes',
- '1' => 'No',
- ),
- ),
- ));
- $this->add(array(
- 'type' => 'Zend\Form\Element\Radio',
- 'name' => 'can_search',
- 'options' => array(
- 'label' => 'Can us in search?',
- 'value_options' => array(
- '0' => 'Yes',
- '1' => 'No',
- ),
- ),
- ));
- $this->add([
- 'name' => 'default_value',
- 'attributes' => [
- 'type' => 'text',
- 'size' => '50',
- 'class' => 'form-control',
- ],
- 'options' => [
- 'label' => 'Default Value',
- ],
- ]);
- }
- }
Add Comment
Please, Sign In to add comment