public function loadOption(FormInterface $form, $helperName, $optionValue, array $options=array())
    {
        if (!$form instanceof FormCollectionInterface) {
            throw new InvalidArgumentException(
                sprintf('loadOption requires a instance of Type "%s", "%s" was given.',
                    FormCollectionInterface::class,
                    get_class($form))
            );
        }

        if ($this->getHelper('option')->hasKey($helperName)) {
            /**
             * @var $formHelper FormHelperOptionInterface
             */
            $formHelper = $this->getHelper('option')->get($helperName);
            $tmpFormHelper = clone $formHelper;
            $tmpFormHelper->setForm($form);
            if (is_array($optionValue)) {
                $tmpFormHelper->setChoices($optionValue);
            } else {
                $tmpFormHelper->setChoice($optionValue);
            }
            $tmpFormHelper->setOptions($options);
            return $tmpFormHelper->render();
        } else {
            throw new InvalidArgumentException('unkown form helper ' . $helperName);
        }
    }
public function loadOption(FormInterface $form, $helperName, $optionValue, array $options=array())
    {
        if (!$form instanceof FormCollectionInterface) {
            throw new InvalidArgumentException(
                sprintf('loadOption requires a instance of Type "%s", "%s" was given.',
                    FormCollectionInterface::class,
                    get_class($form))
            );
        }

        if ($this->getHelper('option')->hasKey($helperName)) {
            /**
             * @var $formHelper FormHelperOptionInterface
             */
            $formHelper = $this->getHelper('option')->get($helperName);
            $tmpFormHelper = clone $formHelper;
            $tmpFormHelper->setForm($form);
            if (is_array($optionValue)) {
                $tmpFormHelper->setChoices($optionValue);
            } else {
                $tmpFormHelper->setChoice($optionValue);
            }
            $tmpFormHelper->setOptions($options);
            return $tmpFormHelper->render();
        } else {
            throw new InvalidArgumentException('unkown form helper ' . $helperName);
        }
    }
public function loadOption ( FormInterface $ form , $ helperName , $ optionValue , array $ options = array ( ) ) { if ( ! $ form instanceof FormCollectionInterface ) { throw new InvalidArgumentException ( sprintf ( 'loadOption requires a instance of Type "%s", "%s" was given.' , FormCollectionInterface :: class , get_class ( $ form ) ) ) ; } if ( $ this -> getHelper ( 'option' ) -> hasKey ( $ helperName ) ) { /**
             * @var $formHelper FormHelperOptionInterface
             */ $ formHelper = $ this -> getHelper ( 'option' ) -> get ( $ helperName ) ; $ tmpFormHelper = clone $ formHelper ; $ tmpFormHelper -> setForm ( $ form ) ; if ( is_array ( $ optionValue ) ) { $ tmpFormHelper -> setChoices ( $ optionValue ) ; } else { $ tmpFormHelper -> setChoice ( $ optionValue ) ; } $ tmpFormHelper -> setOptions ( $ options ) ; return $ tmpFormHelper -> render ( ) ; } else { throw new InvalidArgumentException ( 'unkown form helper ' . $ helperName ) ; } }
load and render form help option

@param     FormInterface     $form               form collection instance
@param     string            $helperName         form helper name
@param     string            $optionValue        form helper option value or values
@param     array             $options            form helper options
@return    string        rendered html

@throws  InvalidArgumentException
load and render form help option