Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AllBundles] Dep#small issues #944

Merged
merged 5 commits into from
Jan 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function __construct($identifier, Request $request, FormFactoryInterface
*/
public function buildForm()
{
$builder = $this->formFactory->createBuilder('form', null);
$builder = $this->formFactory->createBuilder(FormType::class, null);

foreach ($this->tabs as $tab) {
$tab->buildForm($builder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$builder->add('type', ChoiceType::class, array(
'choices' => array_combine(Bike::$types, Bike::$types),
'placeholder' => false,
'required' => true
'required' => true,
'choices_as_values' => true
));
$builder->add('brand', TextType::class, array(
'required' => true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$builder->add('imagePosition', ChoiceType::class, array(
'choices' => array_combine(ServicePagePart::$imagePositions, ServicePagePart::$imagePositions),
'placeholder' => false,
'required' => true
'required' => true,
'choices_as_values' => true
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,20 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$builder->add('type', ChoiceType::class, array(
'choices' => array_combine({{ pagepart }}::$types, {{ pagepart }}::$types),
'placeholder' => false,
'required' => true
'required' => true,
'choices_as_values' => true
));
$builder->add('size', ChoiceType::class, array(
'choices' => array_combine({{ pagepart }}::$sizes, {{ pagepart }}::$sizes),
'placeholder' => false,
'required' => true
'required' => true,
'choices_as_values' => true
));
$builder->add('position', ChoiceType::class, array(
'choices' => array_combine({{ pagepart }}::$positions, {{ pagepart }}::$positions),
'placeholder' => false,
'required' => true
'required' => true,
'choices_as_values' => true
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)

$builder->add('niv', ChoiceType::class, array(
'label' => 'pagepart.header.type',
'choices' => array_combine({{ pagepart }}::$supportedHeaders, $names),
'required' => true
'choices' => array_combine($names, {{ pagepart }}::$supportedHeaders),
'required' => true,
'choices_as_values' => true
));
$builder->add('title', TextType::class, array(
'label' => 'pagepart.header.title',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
Expand Down Expand Up @@ -111,7 +112,7 @@ public function setContext(RequestContext $context)
*
* @return null|string
*/
public function generate($name, $parameters = array(), $absolute = false)
public function generate($name, $parameters = array(), $absolute = UrlGeneratorInterface::ABSOLUTE_URL)
{
$this->urlGenerator = new UrlGenerator($this->routeCollection, $this->context);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('locale', ChoiceType::class, array(
'attr' => array('info_text' => 'Defines the locale that should be blacklisted'),
'choices' => $this->locales
'choices' => $this->locales,
'choices_as_values' => true
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('locale', ChoiceType::class, array(
'attr' => array('info_text' => 'Defines the locale that should be whitelisted'),
'choices' => $this->locales
'choices' => $this->locales,
'choices_as_values' => true
));
}

Expand Down
3 changes: 2 additions & 1 deletion src/Kunstmaan/MediaBundle/Form/AbstractRemoteType.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
array(
'choices' => array(),
'constraints' => array(new NotBlank()),
'required' => true
'required' => true,
'choices_as_values' => true
)
)
->add(
Expand Down
1 change: 1 addition & 0 deletions src/Kunstmaan/MediaBundle/Form/FolderType.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'slideshow' => 'slideshow',
'video' => 'video'
),
'choices_as_values' => true
)
)
->add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
array(
'choices' => array('soundcloud' => 'soundcloud'),
'constraints' => array(new NotBlank()),
'required' => true
'required' => true,
'choices_as_values' => true
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
array(
'choices' => array('slideshare' => 'slideshare'),
'constraints' => array(new NotBlank()),
'required' => true
'required' => true,
'choices_as_values' => true
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
array(
'choices' => $this->getRemoteVideoChoices(),
'constraints' => array(new NotBlank()),
'required' => true
'required' => true,
'choices_as_values' => true
)
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Kunstmaan/MenuBundle/Form/MenuItemAdminType.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
MenuItem::$types
),
'placeholder' => false,
'required' => true
'required' => true,
'choices_as_values' => true
)
);
$locale = $this->locale;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'choices' => array_combine(range(-50, 50), range(-50, 50)),
'placeholder' => false,
'required' => false,
'attr' => array('title' => 'Used to reorder the pages.')
'attr' => array('title' => 'Used to reorder the pages.'),
'choices_as_values' => true
));
}

Expand Down
11 changes: 10 additions & 1 deletion src/Kunstmaan/PagePartBundle/Form/HeaderPagePartAdminType.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ class HeaderPagePartAdminType extends AbstractType
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('niv', ChoiceType::class, array('label' => 'pagepart.header.type', 'choices' => array('1' => 'Header 1', '2' => 'Header 2', '3' => 'Header 3', '4' => 'Header 4', '5' => 'Header 5', '6' => 'Header 6'), 'required' => true,));
$builder->add(
'niv',
ChoiceType::class,
array(
'label' => 'pagepart.header.type',
'choices' => array('Header 1' => '1', 'Header 2' => '2', 'Header 3' => '3', 'Header 4' => '4', 'Header 5' => '5', 'Header 6' => '6'),
'required' => true,
'choices_as_values' => true
)
);
$builder->add('title', null, array('label' => 'pagepart.header.title', 'required' => true));
}

Expand Down
3 changes: 2 additions & 1 deletion src/Kunstmaan/RedirectBundle/Form/RedirectAdminType.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ public function buildForm(FormBuilderInterface $builder, array $options)
if ($this->domainConfiguration->isMultiDomainHost()) {
$hosts = $this->domainConfiguration->getHosts();
$domains = array_combine($hosts, $hosts);
$domains = array_merge(array('' => 'redirect.all'), $domains);
$domains = array_merge(array('redirect.all' => ''), $domains);

$builder->add('domain', ChoiceType::class, array(
'choices' => $domains,
'required' => true,
'expanded' => false,
'multiple' => false,
'choices_as_values' => true,
));
}

Expand Down
35 changes: 18 additions & 17 deletions src/Kunstmaan/SeoBundle/Form/SeoType.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,24 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('metaDescription', null, array('label' => 'Meta description', 'max_length' => 155));

$builder->add('metaRobots', ChoiceType::class, array(
'choices' => array(
self::ROBOTS_NOINDEX => 'seo.form.robots.noindex',
self::ROBOTS_NOFOLLOW => 'seo.form.robots.nofollow',
self::ROBOTS_NOARCHIVE => 'seo.form.robots.noarchive',
self::ROBOTS_NOSNIPPET => 'seo.form.robots.nosnippet',
self::ROBOTS_NOTRANSLATE => 'seo.form.robots.notranslate',
self::ROBOTS_NOIMAGEINDEX => 'seo.form.robots.noimageindex',
),
'max_length' => 255,
'required' => false,
'multiple' => true,
'expanded' => false,
'label' => 'Meta robots',
'attr' => array(
'class' => 'js-advanced-select form-control',
'data-placeholder' => 'Choose robot tags',
)));
'choices' => array(
'seo.form.robots.noindex' => self::ROBOTS_NOINDEX,
'seo.form.robots.nofollow' => self::ROBOTS_NOFOLLOW,
'seo.form.robots.noarchive' => self::ROBOTS_NOARCHIVE,
'seo.form.robots.nosnippet' => self::ROBOTS_NOSNIPPET,
'seo.form.robots.notranslate' => self::ROBOTS_NOTRANSLATE,
'seo.form.robots.noimageindex' => self::ROBOTS_NOIMAGEINDEX,
),
'choices_as_values' => true,
'max_length' => 255,
'required' => false,
'multiple' => true,
'expanded' => false,
'label' => 'Meta robots',
'attr' => array(
'class' => 'js-advanced-select form-control',
'data-placeholder' => 'Choose robot tags',
)));

$builder->get('metaRobots')
->addModelTransformer(new CallbackTransformer(
Expand Down
15 changes: 8 additions & 7 deletions src/Kunstmaan/SeoBundle/Form/SocialType.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'label' => 'seo.form.og.type',
'required' => false,
'choices' => array(
"website" => "Website",
"article" => "Article",
"profile" => "Profile",
"book" => "Book",
"video.other" => "Video",
"music.song" => "Music"
)
"Website" => "website",
"Article" => "article",
"Profile" => "profile",
"Book" => "book",
"Video" => "video.other",
"Music" => "music.song"
),
'choices_as_values' => true,
))
->add('ogImage', MediaType::class, array(
'label' => 'seo.form.og.image',
Expand Down
3 changes: 2 additions & 1 deletion src/Kunstmaan/TaggingBundle/Form/TagsAdminType.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ public function getDefaultOptions(array $options)
$result = array();

foreach ($this->tagManager->findAll() as $tag) {
$result[$tag->getId()] = $tag->getName();
$result[$tag->getName()] = $tag->getId();
}

return array(
'choices' => $result,
'multiple' => true,
'required' => false,
'choices_as_values' => true,
'attr' => array(
'class' => 'js-advanced-select form-control advanced-select',
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function addAction(Request $request, $keyword = '', $domain = '', $locale
$translation->addText($locale, '');
}

$form = $this->createForm(TranslationAdminType::class, $translation, array('intention' => 'add'));
$form = $this->createForm(TranslationAdminType::class, $translation, array('csrf_token_id' => 'add'));
if ('POST' == $request->getMethod()) {
$form->handleRequest($request);

Expand Down
5 changes: 2 additions & 3 deletions src/Kunstmaan/TranslatorBundle/Form/TranslationAdminType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class TranslationAdminType extends AbstractType
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$intention = $options['intention'];
$intention = $options['csrf_token_id'];
$options = array();
if ($intention == 'edit') {
$options = array('read_only' => true);
$options = array('attr' => array('readonly' => true));
}

$builder->add('domain', TextType::class, $options);
Expand Down Expand Up @@ -47,7 +47,6 @@ public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => '\Kunstmaan\TranslatorBundle\Model\Translation',
'intention' => null
));
}
}