本文整理汇总了PHP中Symfony\Component\Form\AbstractType::configureOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractType::configureOptions方法的具体用法?PHP AbstractType::configureOptions怎么用?PHP AbstractType::configureOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\AbstractType
的用法示例。
在下文中一共展示了AbstractType::configureOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureOptions
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
if ($this->formType) {
$this->formType->configureOptions($resolver);
}
}
示例2: configureOptions
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(['format' => $this->format, 'invalid_message' => 'This value should be in format {{ format }}', 'invalid_message_parameters' => function (Options $options) {
return ['{{ format }}' => $options['format']];
}, 'widget' => $this->widget]);
}
示例3: configureOptions
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('nameable' => false, 'deleteable' => false, 'downloadable' => true, 'maxWidth' => 320, 'maxHeight' => 180, 'minWidth' => 16, 'minHeight' => 16, 'previewImages' => true, 'previewAsCanvas' => true, 'previewFilter' => null, 'multipart' => true, 'novalidate' => true, 'required' => false));
$resolver->setAllowedValues('multipart', array(true))->setAllowedValues('novalidate', array(true))->setAllowedValues('required', array(false));
$resolver->setAllowedTypes('nameable', array('string', 'bool'))->setAllowedTypes('deleteable', array('string', 'bool'))->setAllowedTypes('downloadable', array('bool'))->setAllowedTypes('maxWidth', array('integer'))->setAllowedTypes('maxHeight', array('integer'))->setAllowedTypes('minWidth', array('integer'))->setAllowedTypes('minHeight', array('integer'))->setAllowedTypes('previewImages', array('bool'))->setAllowedTypes('previewAsCanvas', array('bool'))->setAllowedTypes('previewFilter', array('string', 'null'));
}
示例4: configureOptions
/**
* Form type default options
*
* @param OptionsResolver $resolver The resolver.
*
* @return array
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefault('data_class', function (Options $options) {
return $options['isORM'] ? 'PhpInk\\Nami\\CoreBundle\\Model\\Orm\\User' : 'PhpInk\\Nami\\CoreBundle\\Model\\Odm\\User';
});
$resolver->setDefaults('intention', 'resetting');
}
示例5: configureOptions
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$dataClass = function (Options $options) {
return $options['class'];
};
$resolver->setDefaults(array('class' => null, 'data_class' => $dataClass, 'translation_domain' => 'messages', 'horizontal' => true, 'horizontal_input_wrapper_class' => 'col-md-12', 'horizontal_label_offset_class' => ''));
}
示例6: configureOptions
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('acceptFileTypes' => '/.*$/i', 'autoUpload' => false, 'editable' => array(), 'displayDownloadButton' => true, 'loadImageFileTypes' => '/^image\\/(gif|jpe?g|png)$/i', 'loadImageMaxFileSize' => 5000000, 'maxNumberOfFiles' => null, 'maxFileSize' => null, 'minFileSize' => null, 'multipart' => true, 'multiple' => true, 'nameable' => true, 'nameable_field' => 'name', 'novalidate' => true, 'prependFiles' => false, 'previewAsCanvas' => true, 'previewFilter' => null, 'itemFilter' => null, 'previewMaxHeight' => 80, 'previewMaxWidth' => 80, 'primary_key' => 'id', 'required' => false, 'sortable' => false, 'sortable_field' => 'position', 'uploadRouteName' => null, 'uploadRouteParameters' => array()));
// This seems weird... why to we accept it as option if we force
// its value?
$resolver->setAllowedValues('novalidate', array(true))->setAllowedValues('multipart', array(true))->addAllowedValues('multiple', array(true))->setAllowedValues('required', array(false));
$resolver->setAllowedTypes('acceptFileTypes', array('string'))->setAllowedTypes('autoUpload', array('bool'))->setAllowedTypes('editable', array('array'))->setAllowedTypes('displayDownloadButton', array('bool'))->setAllowedTypes('loadImageFileTypes', array('string'))->setAllowedTypes('loadImageMaxFileSize', array('integer'))->setAllowedTypes('maxNumberOfFiles', array('integer', 'null'))->setAllowedTypes('maxFileSize', array('integer', 'null'))->setAllowedTypes('minFileSize', array('integer', 'null'))->setAllowedTypes('multipart', array('bool'))->setAllowedTypes('multiple', array('bool'))->setAllowedTypes('nameable', array('bool'))->setAllowedTypes('nameable_field', array('string', 'null'))->setAllowedTypes('novalidate', array('bool'))->setAllowedTypes('prependFiles', array('bool'))->setAllowedTypes('previewAsCanvas', array('bool'))->setAllowedTypes('previewFilter', array('string', 'null'))->setAllowedTypes('itemFilter', array('string', 'null'))->setAllowedTypes('previewMaxWidth', array('integer'))->setAllowedTypes('previewMaxHeight', array('integer'))->setAllowedTypes('primary_key', array('string'))->setAllowedTypes('required', array('bool'))->setAllowedTypes('sortable', array('bool'))->setAllowedTypes('sortable_field', array('string'))->setAllowedTypes('uploadRouteName', array('string', 'null'))->setAllowedTypes('uploadRouteParameters', array('array'));
}
示例7: configureOptions
/**
* {@inheritDoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
// TODO: Remove conditional parent call when bumping requirements to SF 2.7+
if (method_exists('Symfony\\Component\\Form\\AbstractType', 'configureOptions')) {
parent::configureOptions($resolver);
} else {
parent::setDefaultOptions($resolver);
}
$resolver->setDefaults(array('map' => array()));
}
示例8: configureOptions
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefault('mao', null);
$resolver->setDefaults(['data_class' => Metadata::class]);
$resolver->setDefaults(['type_options' => []]);
$resolver->setDefaults(['type_forms' => []]);
$resolver->setAllowedTypes('type_options', ['array']);
$resolver->setAllowedTypes('mao', [MetadataAccessObject::class]);
}
示例9: configureOptions
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(['choices' => function (Options $options) {
if (null === $options['enabled']) {
return $this->localeRepository->findAll();
}
return $this->localeRepository->findBy(['enabled' => $options['enabled']]);
}, 'choice_value' => 'code', 'choice_label' => 'name', 'choice_translation_domain' => false, 'enabled' => null, 'label' => 'sylius.form.locale.locale', 'placeholder' => 'sylius.form.locale.select']);
}
示例10: configureOptions
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setRequired('resource')->setAllowedTypes('resource', ResourceInterface::class)->setDefaults(['class' => function (Options $options) {
return $options['resource']->getModel();
}, 'choice_value' => function (Options $options) {
return $options['resource']->getIdPropertyPath();
}, 'choice_label' => function (Options $options) {
return $options['resource']->getLabelPropertyPath();
}, 'placeholder' => '']);
}
示例11: getConstraints
/**
* @param AbstractType $type
* @param string $groups
* @return array
*
* Get an array with the type's constraints loaded with groups
*/
protected function getConstraints(AbstractType $type, $groups = "Default")
{
/**
* Create a resolver to get the options
*/
$nullResolver = new OptionsResolver();
$type->configureOptions($nullResolver);
$options = $nullResolver->resolve();
if (!isset($options["constraints"])) {
$options["constraints"] = array();
}
/**
* Then replace groups
*/
$constraints = $this->replaceGroups($groups, $options["constraints"]);
return $constraints;
}
示例12: configureOptions
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('csrf_protection' => false, 'allow_extra_fields' => true, 'cascade_validation' => true));
}
示例13: configureOptions
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('data_class' => 'AppBundle\\Entity\\Profile'));
}
示例14: configureOptions
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults([]);
}
示例15: configureOptions
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
parent::configureOptions($resolver);
$resolver->setDefaults(array('method' => 'GET', 'csrf_protection' => false));
}