本文整理汇总了PHP中Symfony\Component\Form\AbstractType::setDefaultOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractType::setDefaultOptions方法的具体用法?PHP AbstractType::setDefaultOptions怎么用?PHP AbstractType::setDefaultOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Form\AbstractType
的用法示例。
在下文中一共展示了AbstractType::setDefaultOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultOptions
/**
* @param \Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver
*
* @return void
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$resolver->setRequired('action');
$resolver->setRequired('fields');
$resolver->setDefaults(['attr' => ['class' => 'form-inline']]);
}
示例2: setDefaultOptions
/**
* {@inheritDoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$resolver->setRequired(array('root'));
$resolver->setOptional(array('create_in_overlay', 'edit_in_overlay', 'delete_in_overlay'));
$resolver->setDefaults(array('create_in_overlay' => true, 'edit_in_overlay' => true, 'delete_in_overlay' => true));
}
示例3: setDefaultOptions
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$resolver->setDefaults(array('nameable' => false, 'deleteable' => false, 'maxWidth' => 320, 'maxHeight' => 180, 'minWidth' => 16, 'minHeight' => 16, 'previewImages' => true, 'previewAsCanvas' => true, 'previewFilter' => null, 'multipart' => true, 'novalidate' => true, 'required' => false));
$resolver->setAllowedValues(array('multipart' => array(true), 'novalidate' => array(true), 'required' => array(false)));
$resolver->setAllowedTypes(array('nameable' => array('string', 'bool'), 'deleteable' => array('string', 'bool'), 'maxWidth' => array('integer'), 'maxHeight' => array('integer'), 'minWidth' => array('integer'), 'minHeight' => array('integer'), 'previewImages' => array('bool'), 'previewAsCanvas' => array('bool'), 'previewFilter' => array('string', 'null')));
}
示例4: setDefaultOptions
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$currencyChoices = $this->currencyManager->getActiveCodes();
$resolver->replaceDefaults(array('data_type' => NumberFilterType::DATA_DECIMAL));
$resolver->setDefaults(array('currency_choices' => array_combine($currencyChoices, $currencyChoices), 'currency_options' => array()));
}
示例5: setDefaultOptions
/**
* @param \Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver
*
* @return void
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$resolver->setRequired(self::OPTION_SALUTATION_CHOICES);
$resolver->setRequired(self::OPTION_COUNTRY_CHOICES);
$resolver->setRequired(self::OPTION_PREFERRED_COUNTRY_CHOICES);
}
示例6: setDefaultOptions
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$resolver->setOptional(array('widget_options'));
$resolver->setAllowedTypes(array('widget_options' => 'array'));
$resolver->setDefaults(array('mapped' => false, 'error_bubbling' => false, 'constraints' => new Constraints\Recaptcha(), 'widget_options' => array()));
}
示例7: setDefaultOptions
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$resolver->setRequired(array('referenced_class'));
$resolver->setOptional(array('key'));
$resolver->setDefaults(array('key' => ReferenceManyCollectionToArrayTransformer::KEY_UUID));
}
示例8: setDefaultOptions
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setOptional(['preview', 'media_type', 'select_label', 'change_label', 'select_multiple_label', 'change_multiple_label'])->addAllowedTypes(['preview' => 'string', 'media_type' => 'string', 'select_label' => 'string', 'change_label' => 'string', 'select_multiple_label' => 'string', 'change_multiple_label' => 'string']);
parent::setDefaultOptions($resolver);
$compound = function (Options $options) {
return $options['multiple'];
};
$resolver->setDefaults(['class' => 'Hexmedia\\ContentBundle\\Entity\\Media', 'compound' => $compound]);
}
示例9: setDefaultOptions
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$resolver->setDefaults(array('label' => 'Email', 'data_class' => 'HMLB\\UserBundle\\Command\\ChangePassword', 'empty_data' => function (Options $options) {
return function (FormInterface $form) use($options) {
return new ChangePassword($form->get('password')->getData(), $form->get('user')->getData());
};
}));
}
示例10: setDefaultOptions
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$resolver->setDefaults(array('acceptFileTypes' => '/.*$/i', 'autoUpload' => false, 'editable' => array(), '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, '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(array('novalidate' => array(true), 'multipart' => array(true), 'multiple' => array(true), 'required' => array(false)));
$resolver->setAllowedTypes(array('acceptFileTypes' => array('string'), 'autoUpload' => array('bool'), 'editable' => array('array'), 'loadImageFileTypes' => array('string'), 'loadImageMaxFileSize' => array('integer'), 'maxNumberOfFiles' => array('integer', 'null'), 'maxFileSize' => array('integer', 'null'), 'minFileSize' => array('integer', 'null'), 'multipart' => array('bool'), 'multiple' => array('bool'), 'nameable' => array('bool'), 'nameable_field' => array('string', 'null'), 'novalidate' => array('bool'), 'prependFiles' => array('bool'), 'previewAsCanvas' => array('bool'), 'previewFilter' => array('string', 'null'), 'previewMaxWidth' => array('integer'), 'previewMaxHeight' => array('integer'), 'primary_key' => array('string'), 'required' => array('bool'), 'sortable' => array('bool'), 'sortable_field' => array('string'), 'uploadRouteName' => array('string', 'null'), 'uploadRouteParameters' => array('array')));
}
示例11: setDefaultOptions
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$dataClass = function (Options $options) {
// return null;
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' => ''));
}
示例12: setDefaultOptions
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$resolver->setDefaults(array('required' => false, 'condition_pattern' => FilterOperands::STRING_EQUALS, 'compound' => function (Options $options) {
return $options['condition_pattern'] == FilterOperands::OPERAND_SELECTOR;
}, 'text_options' => array('required' => false, 'trim' => true), 'choice_options' => array('choices' => FilterOperands::getStringOperandsChoices(), 'required' => false, 'translation_domain' => 'LexikFormFilterBundle'), 'data_extraction_method' => function (Options $options) {
return $options['compound'] ? 'text' : 'default';
}))->setAllowedValues(array('data_extraction_method' => array('text', 'default'), 'condition_pattern' => FilterOperands::getStringOperands(true)));
}
示例13: 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()));
}
示例14: setDefaultOptions
/**
* @param \Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver
*
* @return void
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$resolver->setDefaults(['validation_groups' => function (FormInterface $form) {
$defaultData = $form->getConfig()->getData();
if (array_key_exists(self::FIELD_FROM_URL, $defaultData) === false || $defaultData[self::FIELD_FROM_URL] !== $form->getData()[self::FIELD_FROM_URL]) {
return [Constraint::DEFAULT_GROUP, self::GROUP_UNIQUE_URL_CHECK];
}
return [Constraint::DEFAULT_GROUP];
}]);
}
示例15: setDefaultOptions
/**
* @param \Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver
*
* @return void
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
parent::setDefaultOptions($resolver);
$resolver->setDefaults(['validation_groups' => function (FormInterface $form) {
$defaultData = $form->getConfig()->getData();
if (!isset($defaultData[self::FIELD_ID_KEY_MAPPING])) {
return [Constraint::DEFAULT_GROUP, self::GROUP_PLACEHOLDER_CHECK];
}
return [Constraint::DEFAULT_GROUP];
}]);
}