コード例 #1
0
ファイル: CustomFields.php プロジェクト: hschletz/braintacle
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $this->_types = $this->getOption('customFieldManager')->getFields();
     $fields = new \Zend\Form\Fieldset('Fields');
     $inputFilterField = new \Zend\InputFilter\InputFilter();
     foreach ($this->_types as $name => $type) {
         if ($type == 'clob') {
             $element = new \Zend\Form\Element\Textarea($name);
         } else {
             $element = new \Zend\Form\Element\Text($name);
         }
         if ($name == 'TAG') {
             $element->setLabel('Category');
         } else {
             $element->setLabel($name);
         }
         $fields->add($element);
         $filter = array('name' => $name, 'required' => false, 'filters' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'filterField'), 'callback_params' => $type))), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateField'), 'callbackOptions' => $type))));
         $inputFilterField->add($filter);
     }
     $this->add($fields);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('Change');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add($inputFilterField, 'Fields');
     $this->setInputFilter($inputFilter);
 }
コード例 #2
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $inputFilter = new \Zend\InputFilter\InputFilter();
     // Create list of values as array because nested iteration does not work with ResultSet objects.
     $this->_definedValues = iterator_to_array($this->getOption('registryManager')->getValueDefinitions());
     // Subform for enabling/disabling registry inspection, in addition to
     // the same setting in preferences.
     $fieldsetInspect = new \Zend\Form\Fieldset('inspect');
     $inspect = new Element\Checkbox('inspect');
     $inspect->setLabel('Inspect registry')->setChecked($this->getOption('config')->inspectRegistry);
     $fieldsetInspect->add($inspect);
     $this->add($fieldsetInspect);
     // Subform for existing values
     $fieldsetExisting = new \Zend\Form\Fieldset('existing');
     $inputFilterExisting = new \Zend\InputFilter\InputFilter();
     // Create text elements for existing values to rename them
     foreach ($this->_definedValues as $value) {
         $name = $value['Name'];
         $elementName = "value_{$value['Id']}_name";
         $element = new Element\Text($elementName);
         $element->setValue($name)->setLabel($value['FullPath']);
         $inputFilterExisting->add(array('name' => $elementName, 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)), $this->_createBlacklistValidator($name))));
         $fieldsetExisting->add($element);
     }
     $this->add($fieldsetExisting);
     $inputFilter->add($inputFilterExisting, 'existing');
     // Subform for new value
     $fieldsetNew = new \Zend\Form\Fieldset('new_value');
     $newName = new Element\Text('name');
     $newName->setLabel('Name');
     $fieldsetNew->add($newName);
     $newRootKey = new Element\Select('root_key');
     $newRootKey->setLabel('Root key')->setAttribute('type', 'select_untranslated')->setValueOptions(\Model\Registry\Value::rootKeys())->setValue(\Model\Registry\Value::HKEY_LOCAL_MACHINE);
     $fieldsetNew->add($newRootKey);
     // Additional validation in isValid()
     $newSubKeys = new Element\Text('subkeys');
     $newSubKeys->setLabel('Subkeys');
     $fieldsetNew->add($newSubKeys);
     $newValue = new Element\Text('value');
     $newValue->setLabel('Only this value (optional)');
     $fieldsetNew->add($newValue);
     $submit = new \Library\Form\Element\Submit('submit');
     $submit->setLabel('Change');
     $fieldsetNew->add($submit);
     $this->add($fieldsetNew);
     $inputFilterNew = new \Zend\InputFilter\InputFilter();
     $inputFilterNew->add(array('name' => 'name', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)), $this->_createBlacklistValidator())));
     $inputFilterNew->add(array('name' => 'subkeys', 'continue_if_empty' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateEmptySubkeys'), 'message' => "Value is required and can't be empty")), array('name' => 'StringLength', 'options' => array('max' => 255)))));
     $inputFilterNew->add(array('name' => 'value', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)))));
     $inputFilter->add($inputFilterNew, 'new_value');
     $this->setInputFilter($inputFilter);
 }
コード例 #3
0
ファイル: ChangePassword.php プロジェクト: samija/Deeplife1.0
 public function init()
 {
     // We always want to use POST method with this form
     $this->setAttribute('method', 'post');
     $this->setAttribute('data-ng-submit', 'savePassword()');
     // Add fields to this form
     $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden', 'data-ng-model' => 'passwordForm.id')));
     $this->add(array('name' => 'password', 'attributes' => array('type' => 'password', 'required' => 'required', 'class' => 'form-control', 'data-ng-model' => 'passwordForm.password'), 'options' => array('label' => 'Password')));
     $this->add(array('name' => 'passwordConfirm', 'attributes' => array('type' => 'password', 'required' => 'required', 'class' => 'form-control', 'data-ng-model' => 'passwordForm.passwordConfirm'), 'options' => array('label' => 'Confirm')));
     $actions = new \Zend\Form\Fieldset('actions');
     $actions->add(array('name' => 'close', 'attributes' => array('type' => 'reset', 'value' => 'Close', 'class' => 'btn btn-default form-control', 'data-dismiss' => "modal")));
     $actions->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Save', 'class' => 'btn btn-primary form-control')));
     $this->add($actions);
 }
コード例 #4
0
ファイル: Update.php プロジェクト: hschletz/braintacle
 /** {@inheritdoc} */
 public function init()
 {
     $fieldset = new \Zend\Form\Fieldset('Deploy');
     $fieldset->setLabel('Deploy to clients which have existing package assigned');
     $deployPending = new \Zend\Form\Element\Checkbox('Pending');
     $deployPending->setLabel('Pending');
     $fieldset->add($deployPending);
     $deployRunning = new \Zend\Form\Element\Checkbox('Running');
     $deployRunning->setLabel('Running');
     $fieldset->add($deployRunning);
     $deploySuccess = new \Zend\Form\Element\Checkbox('Success');
     $deploySuccess->setLabel('Success');
     $fieldset->add($deploySuccess);
     $deployError = new \Zend\Form\Element\Checkbox('Error');
     $deployError->setLabel('Error');
     $fieldset->add($deployError);
     $deployGroups = new \Zend\Form\Element\Checkbox('Groups');
     $deployGroups->setLabel('Groups');
     $fieldset->add($deployGroups);
     $this->add($fieldset);
     parent::init();
 }
コード例 #5
0
ファイル: Update.php プロジェクト: patrickpreuss/Braintacle
 /** {@inheritdoc} */
 public function init()
 {
     $fieldset = new \Zend\Form\Fieldset('Deploy');
     $fieldset->setLabel('Deploy to computers which have existing package assigned');
     $deployNonnotified = new \Zend\Form\Element\Checkbox('Nonnotified');
     $deployNonnotified->setLabel('Not notified');
     $fieldset->add($deployNonnotified);
     $deploySuccess = new \Zend\Form\Element\Checkbox('Success');
     $deploySuccess->setLabel('Success');
     $fieldset->add($deploySuccess);
     $deployNotified = new \Zend\Form\Element\Checkbox('Notified');
     $deployNotified->setLabel('Running');
     $fieldset->add($deployNotified);
     $deployError = new \Zend\Form\Element\Checkbox('Error');
     $deployError->setLabel('Error');
     $fieldset->add($deployError);
     $deployGroups = new \Zend\Form\Element\Checkbox('Groups');
     $deployGroups->setLabel('Groups');
     $fieldset->add($deployGroups);
     $this->add($fieldset);
     parent::init();
 }
コード例 #6
0
ファイル: ClientConfig.php プロジェクト: hschletz/braintacle
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $inputFilter = new \Zend\InputFilter\InputFilter();
     // Agent options
     $agent = new \Zend\Form\Fieldset('Agent');
     $inputFilterAgent = new \Zend\InputFilter\InputFilter();
     $contactInterval = new Element\Text('contactInterval');
     $contactInterval->setLabel('Agent contact interval (in hours)')->setAttribute('size', '5');
     $agent->add($contactInterval);
     $inputFilterAgent->add($this->_getIntegerFilter('contactInterval', 1));
     $inventoryInterval = new Element\Text('inventoryInterval');
     $inventoryInterval->setLabel('Inventory interval (in days, 0 = always, -1 = never)')->setAttribute('size', '5');
     $agent->add($inventoryInterval);
     $inputFilterAgent->add($this->_getIntegerFilter('inventoryInterval', -1));
     $this->add($agent);
     $inputFilter->add($inputFilterAgent, 'Agent');
     // Download options
     $download = new \Zend\Form\Fieldset('Download');
     $inputFilterDownload = new \Zend\InputFilter\InputFilter();
     $packageDeployment = new Element\Checkbox('packageDeployment');
     $packageDeployment->setLabel('Enable package download')->setAttribute('onchange', 'toggle(this)');
     $download->add($packageDeployment);
     $downloadPeriodDelay = new Element\Text('downloadPeriodDelay');
     $downloadPeriodDelay->setLabel('Delay (in seconds) between periods')->setAttribute('size', '5');
     $download->add($downloadPeriodDelay);
     $inputFilterDownload->add($this->_getIntegerFilter('downloadPeriodDelay', 1));
     $downloadCycleDelay = new Element\Text('downloadCycleDelay');
     $downloadCycleDelay->setLabel('Delay (in seconds) between cycles')->setAttribute('size', '5');
     $download->add($downloadCycleDelay);
     $inputFilterDownload->add($this->_getIntegerFilter('downloadCycleDelay', 1));
     $downloadFragmentDelay = new Element\Text('downloadFragmentDelay');
     $downloadFragmentDelay->setLabel('Delay (in seconds) between fragments')->setAttribute('size', '5');
     $download->add($downloadFragmentDelay);
     $inputFilterDownload->add($this->_getIntegerFilter('downloadFragmentDelay', 1));
     $downloadMaxPriority = new Element\Text('downloadMaxPriority');
     $downloadMaxPriority->setLabel('Maximum package priority')->setAttribute('size', '5');
     $download->add($downloadMaxPriority);
     $inputFilterDownload->add($this->_getIntegerFilter('downloadMaxPriority', 1));
     $downloadTimeout = new Element\Text('downloadTimeout');
     $downloadTimeout->setLabel('Timeout (in days)')->setAttribute('size', '5');
     $download->add($downloadTimeout);
     $inputFilterDownload->add($this->_getIntegerFilter('downloadTimeout', 1));
     $this->add($download);
     $inputFilter->add($inputFilterDownload, 'Download');
     // Network scanning options
     $scan = new \Zend\Form\Fieldset('Scan');
     $inputFilterScan = new \Zend\InputFilter\InputFilter();
     $allowScan = new Element\Checkbox('allowScan');
     $allowScan->setLabel('Allow network scanning')->setAttribute('onchange', 'toggle(this)');
     $scan->add($allowScan);
     $subnets = new \Library\Form\Element\SelectSimple('scanThisNetwork');
     $subnets->setLabel('Always scan this network')->setEmptyOption('');
     $scan->add($subnets);
     $inputFilterScan->add(array('name' => 'scanThisNetwork', 'required' => false));
     $scanSnmp = new Element\Checkbox('scanSnmp');
     $scanSnmp->setLabel('Use SNMP');
     $scan->add($scanSnmp);
     $this->add($scan);
     $inputFilter->add($inputFilterScan, 'Scan');
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('OK');
     $this->add($submit);
     $this->setInputFilter($inputFilter);
 }
コード例 #7
0
ファイル: ProductForm.php プロジェクト: eotg1910/shineisp2
 /**
  * Prepare the attribute form
  *
  * @param $attributes array           
  * @return \ProductAdmin\Form\ProductForm
  */
 public function createAttributesElements(array $attributes)
 {
     $customHydrator = new ClassMethods(true);
     $parentFilter = new \Zend\InputFilter\InputFilter();
     $fieldset = new \Zend\Form\Fieldset('attributes');
     //         $fieldset->setUseAsBaseFieldset(true);
     $fieldset->setObject(new \Zend\Stdlib\ArrayObject());
     $fieldset->setFormFactory($this->getFormFactory());
     // thanks to jurians #zftalk irc
     $fieldInput = null;
     $inputFilter = new \Zend\InputFilter\InputFilter();
     foreach ($attributes as $attribute) {
         $formitem = array();
         $filterChain = new \Zend\Filter\FilterChain();
         $name = $attribute->getName();
         $label = $attribute->getLabel() ? $attribute->getLabel() : "-";
         $type = $attribute->getType() ? $attribute->getType() : "string";
         $isRequired = $attribute->getIsRequired();
         $sourceModel = $attribute->getSourceModel();
         $filters = $attribute->getFilters();
         $validators = $attribute->getValidators();
         $cssStyles = $attribute->getCss();
         $validators = !empty($validators) ? json_decode($validators, true) : array();
         // create the new form element array structure
         $formitem['attributes'] = $attribute->getCustomAttributes() ? json_decode($attribute->getCustomAttributes(), true) : json_decode($attribute->attributes, true);
         $formitem['attributes']['id'] = $name;
         $formitem['attributes']['class'] = !empty($attribute->basecss) ? $attribute->basecss : null;
         $formitem['attributes']['name'] = $name;
         $formitem['type'] = !empty($sourceModel) ? $sourceModel : $attribute->input_type;
         $formitem['options']['label'] = $label;
         if ($attribute->getData()) {
             $formitem['options']['value_options'] = json_decode($attribute->getData(), true);
         }
         $filterChain->attachByName('null');
         // set as default
         // set the css style of the element
         if (!empty($cssStyles)) {
             $formitem['attributes']['class'] .= " " . $cssStyles;
         }
         // Handle the dates
         if (!empty($type) && $type == "date") {
             $customHydrator->addStrategy($name, new DateTimeStrategy());
             $typeSource = 'Zend\\Form\\Element\\Date';
             $formitem['type'] = "\\Zend\\Form\\Element\\Date";
             $formitem['options']['format'] = 'd/m/Y';
         }
         // handle the validators preferences of the attribute
         foreach ($validators as $validator) {
             $formitem['validators'] = $validator;
         }
         // var_dump($type);
         // var_dump($customHydrator);
         //             var_dump($formitem);
         // Attach the form item into the form
         $fieldset->add($formitem);
         $fieldInput = new \Zend\InputFilter\Input($name);
         $fieldInput->setRequired($isRequired);
         // handle the filters preferences of the attribute
         if (!empty($filters)) {
             // get the filters attached to the attribute
             $filters = json_decode($filters, true);
             foreach ($filters as $filter) {
                 // if the filter is an array check it by name
                 if (is_array($filter)) {
                     // If the filter is a ...
                     if ($filter['name'] == "File\\RenameUpload") {
                         // create the filter Zend\InputFilter\FileInput
                         $thefilter = new \Zend\InputFilter\FileInput($filter['options']);
                         // ... but how to attach the new filter to the
                         // chain?
                         $chain = new \Zend\Filter\FilterChain();
                         // ... in this way it doesn't work!!
                         $chain->attachByName("filerenameupload", $filter['options']);
                         $filterChain->merge($chain);
                         // just for debugging it ...
                         $filtersApplied = $filterChain->getFilters();
                         //                             var_dump($filtersApplied->toArray());
                     }
                 } elseif ($filter == "cleanurl") {
                     // custom filter
                     $filterChain->attach(new \ProductAdmin\Form\Filter\Cleanurl());
                 } elseif (is_string($filter)) {
                     $filterChain->attachByName($filter);
                 }
             }
         }
         $fieldInput->setFilterChain($filterChain);
         $inputFilter->add($fieldInput);
     }
     $fieldset->setHydrator($customHydrator);
     $this->add($fieldset);
     $parentFilter->add($inputFilter, 'attributes');
     // thanks to GeeH #zftalk irc
     $this->setInputFilter($parentFilter);
     return $this;
 }
コード例 #8
0
    public function testRenderFieldsetRenderFieldsetAsElement()
    {
        $translator = $this->getMock('Zend\\I18n\\Translator\\Translator');
        $translator->method('translate')->will($this->returnCallback(function ($string) {
            return "{$string}-translated";
        }));
        $view = $this->_createView();
        $view->plugin('translate')->setTranslator($translator);
        $view->plugin('FormRow')->setTranslatorEnabled(false);
        $text1 = new \Zend\Form\Element\Text('text1');
        $text1->setLabel('Text1');
        $text2 = new \Zend\Form\Element\Text('text2');
        $text2->setLabel('Text2');
        $fieldset = new \Zend\Form\Fieldset('fieldset');
        $fieldset->setLabel('Fieldset');
        $text3 = new \Zend\Form\Element\Text('text3');
        $text3->setLabel('Text3');
        $fieldset->add($text3);
        $form = new \Console\Form\Form();
        $form->init();
        $form->add($text1);
        $form->add($fieldset);
        $form->add($text2);
        $expected = <<<EOT
<div class="table">
<label><span>Text1</span><input type="text" name="text1" value=""></label>
<span class="label">Fieldset-translated</span>
<fieldset>
<legend></legend>
<div class="table"><label><span>Text3</span><input type="text" name="text3" value=""></label>
</div>

</fieldset>

<label><span>Text2</span><input type="text" name="text2" value=""></label>
</div>

EOT;
        $this->assertEquals($expected, $form->renderFieldset($view, $form));
    }
コード例 #9
0
 /**
  * Base tests for all _useform()-based actions (GET method)
  *
  * @param string $action "action" part of URI
  * @param string $formClass Form name without namespace
  */
 protected function _testUseFormGet($action, $formClass)
 {
     $preferences = new \Zend\Form\Fieldset('Preferences');
     $preferences->add(new \Zend\Form\Element\Text('pref1'));
     $preferences->add(new \Zend\Form\Element\Text('pref2'));
     $formData = array('Preferences' => array('pref1' => 'value1', 'pref2' => 'value2'));
     $form = $this->createMock("Console\\Form\\Preferences\\{$formClass}");
     $form->method('get')->willReturn($preferences);
     $form->expects($this->once())->method('setData')->with($formData);
     $form->expects($this->never())->method('getData');
     $form->expects($this->never())->method('isValid');
     $form->expects($this->once())->method('render')->willReturn('<form></form>');
     $this->_formManager->expects($this->once())->method('get')->with("Console\\Form\\Preferences\\{$formClass}")->will($this->returnValue($form));
     $this->_config->method('__get')->will($this->returnValueMap(array(array('pref1', 'value1'), array('pref2', 'value2'))));
     $this->_config->expects($this->never())->method('setOptions');
     $this->dispatch("/console/preferences/{$action}");
     $this->assertResponseStatusCode(200);
     $this->assertXPathQuery('//form');
 }
コード例 #10
0
 public function testGetFieldsetValidationGroupWillAutogenerateListFromFieldsetWhenEmpty()
 {
     $fieldset = new \Zend\Form\Fieldset();
     $fieldset->add(array('name' => 'test', 'type' => 'Text'));
     $this->extension->setFieldset($fieldset);
     $this->assertEquals(array('test'), $this->extension->getFieldsetValidationGroup());
 }
コード例 #11
0
ファイル: Packages.php プロジェクト: patrickpreuss/Braintacle
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $preferences = $this->get('Preferences');
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $integerFilter = array('name' => 'Callback', 'options' => array('callback' => array($this, 'normalize'), 'callback_params' => 'integer'));
     $integerValidator = array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateType'), 'callbackOptions' => 'integer'));
     $deploy = new \Zend\Form\Fieldset('Deploy');
     $deploy->setLabel('Defaults for deploying updated packages');
     $deployNonnotified = new \Zend\Form\Element\Checkbox('defaultDeployNonnotified');
     $deployNonnotified->setLabel('Not notified');
     $deploy->add($deployNonnotified);
     $deploySuccess = new \Zend\Form\Element\Checkbox('defaultDeploySuccess');
     $deploySuccess->setLabel('Success');
     $deploy->add($deploySuccess);
     $deployNotified = new \Zend\Form\Element\Checkbox('defaultDeployNotified');
     $deployNotified->setLabel('Running');
     $deploy->add($deployNotified);
     $deployError = new \Zend\Form\Element\Checkbox('defaultDeployError');
     $deployError->setLabel('Error');
     $deploy->add($deployError);
     $deployGroups = new \Zend\Form\Element\Checkbox('defaultDeployGroups');
     $deployGroups->setLabel('Groups');
     $deploy->add($deployGroups);
     $preferences->add($deploy);
     $defaultPlatform = new \Zend\Form\Element\Select('defaultPlatform');
     $defaultPlatform->setLabel('Default platform')->setAttribute('type', 'select_untranslated')->setValueOptions(array('windows' => 'Windows', 'linux' => 'Linux', 'mac' => 'MacOS'));
     $preferences->add($defaultPlatform);
     $defaultAction = new \Zend\Form\Element\Select('defaultAction');
     $defaultAction->setLabel('Default action')->setValueOptions(array('launch' => $this->_('Download package, execute command, retrieve result'), 'execute' => $this->_('Optionally download package, execute command'), 'store' => $this->_('Just download package to target path')));
     $preferences->add($defaultAction);
     $defaultActionParam = new \Zend\Form\Element\Text('defaultActionParam');
     $defaultActionParam->setLabel('Default action parameter');
     $preferences->add($defaultActionParam);
     $defaultPackagePriority = new \Library\Form\Element\SelectSimple('defaultPackagePriority');
     $defaultPackagePriority->setValueOptions(range(0, 10))->setLabel('Default priority (0: exclusive, 10: lowest)');
     $preferences->add($defaultPackagePriority);
     $defaultMaxFragmentSize = new \Zend\Form\Element\Text('defaultMaxFragmentSize');
     $defaultMaxFragmentSize->setAttribute('size', '8')->setLabel('Default maximum fragment size (kB)');
     $preferences->add($defaultMaxFragmentSize);
     $inputFilter->add(array('name' => 'defaultMaxFragmentSize', 'required' => false, 'filters' => array($integerFilter), 'validators' => array($integerValidator)));
     $defaultWarn = new \Zend\Form\Element\Checkbox('defaultWarn');
     $defaultWarn->setLabel('Warn user by default');
     $preferences->add($defaultWarn);
     $defaultWarnMessage = new \Zend\Form\Element\Textarea('defaultWarnMessage');
     $defaultWarnMessage->setLabel('Default warn message');
     $preferences->add($defaultWarnMessage);
     $defaultWarnCountdown = new \Zend\Form\Element\Text('defaultWarnCountdown');
     $defaultWarnCountdown->setAttribute('size', '5')->setLabel('Default warn countdown (seconds)');
     $preferences->add($defaultWarnCountdown);
     $inputFilter->add(array('name' => 'defaultWarnCountdown', 'required' => false, 'filters' => array($integerFilter), 'validators' => array($integerValidator)));
     $defaultWarnAllowAbort = new \Zend\Form\Element\Checkbox('defaultWarnAllowAbort');
     $defaultWarnAllowAbort->setLabel('Allow user abort by default');
     $preferences->add($defaultWarnAllowAbort);
     $defaultWarnAllowDelay = new \Zend\Form\Element\Checkbox('defaultWarnAllowDelay');
     $defaultWarnAllowDelay->setLabel('Allow user delay by default');
     $preferences->add($defaultWarnAllowDelay);
     $defaultPostInstMessage = new \Zend\Form\Element\Textarea('defaultPostInstMessage');
     $defaultPostInstMessage->setLabel('Default post-installation message');
     $preferences->add($defaultPostInstMessage);
     $parentFilter = new \Zend\InputFilter\InputFilter();
     $parentFilter->add($inputFilter, 'Preferences');
     $this->setInputFilter($parentFilter);
 }
コード例 #12
0
ファイル: fieldset.php プロジェクト: ahyswang/eva-engine
<?php

require_once './autoloader.php';
$value = array('title' => 'mytitle');
$value = new \ArrayObject($value);
$value['tag'] = new \ArrayObject(array('tagname' => 'mytag'));
$tagElement = array('name' => 'tagname', 'attributes' => array('type' => 'text', 'label' => 'Post Tag Name'));
$postElement = array('name' => 'title', 'attributes' => array('type' => 'text', 'label' => 'Post Title'));
$fieldset = new \Zend\Form\Fieldset('tag');
$fieldset->add($tagElement);
$form = new \Zend\Form\Form();
$form->add($postElement);
$form->add($fieldset);
$form->bind($value);