Last active
January 2, 2016 13:59
-
-
Save sinamiandashti/8313472 to your computer and use it in GitHub Desktop.
TWB bundle inline layout in fieldset issue
This file contains 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
$this->add(array( | |
'type' => 'Zend\Form\Element\Collection', | |
'name' => 'hostmacros', | |
'twb-layout' => \TwbBundle\Form\View\Helper\TwbBundleForm::LAYOUT_INLINE, | |
'options' => array( | |
// 'label' => 'Please choose categories for this product', | |
// 'count' => 2, | |
'twb-layout' => \TwbBundle\Form\View\Helper\TwbBundleForm::LAYOUT_INLINE, | |
'should_create_template' => true, | |
'allow_add' => true, | |
'target_element' => array( | |
'type' => 'NocConfig\Form\HostMacros', | |
), | |
), | |
)); |
This file contains 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 NocConfig\Form; | |
use Zend\Form\Fieldset; | |
use Zend\InputFilter\InputFilterProviderInterface; | |
use Zend\Stdlib\Hydrator\ClassMethods as ClassMethodsHydrator; | |
class HostMacros extends Fieldset implements InputFilterProviderInterface | |
{ | |
public function __construct() | |
{ | |
parent::__construct('hostmacros'); | |
$this->setHydrator(new ClassMethodsHydrator(false)); | |
$this->setOptions(array('twb-layout' => \TwbBundle\Form\View\Helper\TwbBundleForm::LAYOUT_INLINE)); | |
$this->add(array( | |
'name' => 'macro', | |
'attributes' => array( | |
'placeholder' => "{\$MACRO}", | |
'name' => 'macros', | |
), | |
'options' => array( | |
'label' => '' | |
), | |
)); | |
$this->add(array( | |
'name' => 'value', | |
'attributes' => array( | |
'placeholder' => "value", | |
'name' => 'value', | |
), | |
'options' => array( | |
'label' => '' | |
), | |
)); | |
} | |
/** | |
* Should return an array specification compatible with | |
* {@link Zend\InputFilter\Factory::createInputFilter()}. | |
* | |
* @return array | |
*/ | |
public function getInputFilterSpecification() | |
{ | |
return array( | |
'macro' => array( | |
'required' => false, | |
), | |
'value' => array( | |
'required' => false, | |
), | |
); | |
} | |
} |
This file contains 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
<fieldset><fieldset><div class="form-group "><input name="hostmacros[0][macros]" placeholder="{$MACRO}" class="form-control" type="text" value=""></div> | |
<div class="form-group "><input name="hostmacros[0][value]" placeholder="value" class="form-control" type="text" value=""></div> | |
</fieldset><span data-template="<fieldset ><div class="form-group "><input name="hostmacros[__index__][macros]" placeholder="{$MACRO}" class="form-control" type="text" value=""></div> | |
<div class="form-group "><input name="hostmacros[__index__][value]" placeholder="value" class="form-control" type="text" value=""></div> | |
</fieldset>"></span></fieldset> |
This file contains 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
<? echo $this->formCollection($this->form->get('hostmacros'),true,'inline'); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment