Skip to content
This repository has been archived by the owner on May 2, 2020. It is now read-only.

Commit

Permalink
Fixed Form deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick van Laarhoven committed Jan 29, 2016
1 parent 88ec657 commit 21970f3
Show file tree
Hide file tree
Showing 63 changed files with 256 additions and 276 deletions.
2 changes: 1 addition & 1 deletion Block/BlockManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Opifer\ContentBundle\Block;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityManagerInterface;
use Gedmo\SoftDeleteable\SoftDeleteableListener;
use Opifer\CmsBundle\EventListener\LoggableListener;
use Opifer\ContentBundle\Block\Service\BlockServiceInterface;
use Doctrine\ORM\EntityManagerInterface;
use Opifer\ContentBundle\Block\Tool\ContentTool;
use Opifer\ContentBundle\Block\Tool\ToolsetMemberInterface;
use Opifer\ContentBundle\Entity\PointerBlock;
Expand Down
2 changes: 1 addition & 1 deletion Block/RevertVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Opifer\ContentBundle\Block;

use Opifer\ContentBundle\Model\BlockInterface;
use Opifer\ContentBundle\Block\BlockManager;
use Opifer\ContentBundle\Model\BlockInterface;

/**
* Class RevertVisitor
Expand Down
8 changes: 4 additions & 4 deletions Block/Service/AbstractBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

use Opifer\ContentBundle\Entity\Block;
use Opifer\ContentBundle\Environment\Environment;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Opifer\ContentBundle\Model\BlockInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* Class AbstractBlockService
Expand Down
2 changes: 1 addition & 1 deletion Block/Service/BlockServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Opifer\ContentBundle\Block\Service;

use Opifer\ContentBundle\Model\BlockInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Form\FormBuilderInterface;

/**
* Interface BlockServiceInterface
Expand Down
35 changes: 16 additions & 19 deletions Block/Service/ButtonBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
use Opifer\ContentBundle\Block\Tool\ToolsetMemberInterface;
use Opifer\ContentBundle\Entity\ButtonBlock;
use Opifer\ContentBundle\Model\BlockInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

/**
Expand All @@ -20,23 +23,19 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)
{
parent::buildManageForm($builder, $options);

$propertiesForm = $builder->create('properties', 'form')
->add('url', 'text', ['label' => 'label.url'])
->add(
'target',
'choice',
[
'label' => 'label.target',
'choices' => ['_blank' => '_blank', '_self' => '_self'],
'required' => false,
]
)
->add('id', 'text', ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', 'text', ['attr' => ['help_text' => 'help.extra_classes']]);
$propertiesForm = $builder->create('properties', FormType::class)
->add('url', TextType::class, ['label' => 'label.url'])
->add('target', ChoiceType::class, [
'label' => 'label.target',
'choices' => ['_blank' => '_blank', '_self' => '_self'],
'required' => false,
])
->add('id', TextType::class, ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', TextType::class, ['attr' => ['help_text' => 'help.extra_classes']]);


if ($this->config['styles']) {
$propertiesForm->add('styles', 'choice', [
$propertiesForm->add('styles', ChoiceType::class, [
'label' => 'label.styling',
'choices' => array_combine($this->config['styles'], $this->config['styles']),
'required' => false,
Expand All @@ -46,8 +45,8 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)
}

$builder->add(
$builder->create('default', 'form', ['inherit_data' => true])
->add('value', 'text', ['label' => 'label.label'])
$builder->create('default', FormType::class, ['inherit_data' => true])
->add('value', TextType::class, ['label' => 'label.label'])
)->add(
$propertiesForm
);
Expand Down Expand Up @@ -81,6 +80,4 @@ public function getTool()

return $tool;
}


}
}
13 changes: 8 additions & 5 deletions Block/Service/CarouselSlideBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

namespace Opifer\ContentBundle\Block\Service;

use Opifer\CmsBundle\Form\Type\CKEditorType;
use Opifer\ContentBundle\Block\Tool\ContentTool;
use Opifer\ContentBundle\Block\Tool\ToolsetMemberInterface;
use Opifer\ContentBundle\Entity\CarouselSlideBlock;
use Opifer\ContentBundle\Model\BlockInterface;
use Opifer\MediaBundle\Form\Type\MediaPickerType;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

/**
Expand All @@ -21,9 +24,9 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)
{
parent::buildManageForm($builder, $options);

$propertiesForm = $builder->create('properties', 'form')
->add('id', 'text', ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', 'text', ['attr' => ['help_text' => 'help.extra_classes']]);
$propertiesForm = $builder->create('properties', FormType::class)
->add('id', TextType::class, ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', TextType::class, ['attr' => ['help_text' => 'help.extra_classes']]);


if ($this->config['styles']) {
Expand All @@ -40,12 +43,12 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)
}

$builder->add(
$builder->create('default', 'form', ['inherit_data' => true])
$builder->create('default', FormType::class, ['inherit_data' => true])
->add('media', MediaPickerType::class, [
'required' => false,
'multiple' => false,
])
->add('value', 'ckeditor', ['label' => 'label.rich_text', 'attr' => ['label_col' => 12, 'widget_col' => 12]])
->add('value', CKEditorType::class, ['label' => 'label.rich_text', 'attr' => ['label_col' => 12, 'widget_col' => 12]])
)->add(
$propertiesForm
);
Expand Down
23 changes: 14 additions & 9 deletions Block/Service/ColumnBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@

use Opifer\ContentBundle\Block\Tool\ColumnTool;
use Opifer\ContentBundle\Block\Tool\ToolsetMemberInterface;
use Opifer\ContentBundle\Entity\ColumnBlock;
use Opifer\ContentBundle\Form\Type\GutterCollectionType;
use Opifer\ContentBundle\Form\Type\SpanCollectionType;
use Opifer\ContentBundle\Model\BlockInterface;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\HttpFoundation\Response;
use Opifer\ContentBundle\Entity\ColumnBlock;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;

/**
* Class ColumnBlockService
Expand Down Expand Up @@ -59,9 +64,9 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)
{
parent::buildManageForm($builder, $options);

$propertiesForm = $builder->create('properties', 'form')
->add('id', 'text', ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', 'text', ['attr' => ['help_text' => 'help.extra_classes']]);
$propertiesForm = $builder->create('properties', FormType::class)
->add('id', TextType::class, ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', TextType::class, ['attr' => ['help_text' => 'help.extra_classes']]);

$builder->add($propertiesForm);

Expand All @@ -82,7 +87,7 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)
}

$styles = ['row-space-top-2', 'row-space-top-4', 'row-space-top-8', 'row-space-2', 'row-space-4', 'row-space-8'];
$form->get('properties')->add('styles', 'choice', [
$form->get('properties')->add('styles', ChoiceType::class, [
'label' => 'label.styling',
'choices' => $styles,
'required' => false,
Expand All @@ -92,8 +97,8 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)
]);


$form->get('properties')->add('spans', 'span_collection', ['column_count' => $block->getColumnCount(), 'label' => 'label.spans', 'attr' => ['help_text' => 'help.column_spans']]);
$form->get('properties')->add('gutters', 'gutter_collection', ['column_count' => $block->getColumnCount(), 'label' => 'label.gutters', 'attr' => ['help_text' => 'help.column_gutters']]);
$form->get('properties')->add('spans', SpanCollectionType::class, ['column_count' => $block->getColumnCount(), 'label' => 'label.spans', 'attr' => ['help_text' => 'help.column_spans']]);
$form->get('properties')->add('gutters', GutterCollectionType::class, ['column_count' => $block->getColumnCount(), 'label' => 'label.gutters', 'attr' => ['help_text' => 'help.column_gutters']]);

});
}
Expand Down
29 changes: 14 additions & 15 deletions Block/Service/ContainerBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
use Opifer\ContentBundle\Block\Tool\ContainerTool;
use Opifer\ContentBundle\Block\Tool\ToolsetMemberInterface;
use Opifer\ContentBundle\Entity\ContainerBlock;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;

/**
* Class ColumnBlockService
Expand All @@ -25,9 +28,9 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)
parent::buildManageForm($builder, $options);


$propertiesForm = $builder->create('properties', 'form')
->add('id', 'text', ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', 'text', ['attr' => ['help_text' => 'help.extra_classes']]);
$propertiesForm = $builder->create('properties', FormType::class)
->add('id', TextType::class, ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', TextType::class, ['attr' => ['help_text' => 'help.extra_classes']]);

$builder->add($propertiesForm);

Expand All @@ -36,7 +39,7 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)

$form = $event->getForm();

$form->get('properties')->add('styles', 'choice', [
$form->get('properties')->add('styles', ChoiceType::class, [
'label' => 'label.styling',
'choices' => $this->config['styles'],
'required' => false,
Expand All @@ -45,16 +48,12 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)
'attr' => ['help_text' => 'help.html_styles'],
]);

$form->get('properties')->add(
'container_size',
'choice',
[
'label' => 'label.container_sizing',
'choices' => ['fluid' => 'label.container_fluid', '' => 'label.container_fixed', 'smooth' => 'label.container_smooth'],
'required' => true,
'attr' => ['help_text' => 'help.container_sizing'],
]
);
$form->get('properties')->add('container_size', ChoiceType::class, [
'label' => 'label.container_sizing',
'choices' => ['fluid' => 'label.container_fluid', '' => 'label.container_fixed', 'smooth' => 'label.container_smooth'],
'required' => true,
'attr' => ['help_text' => 'help.container_sizing'],
]);
});
}

Expand Down
15 changes: 9 additions & 6 deletions Block/Service/HtmlBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

namespace Opifer\ContentBundle\Block\Service;

use Opifer\CmsBundle\Form\Type\CKEditorType;
use Opifer\ContentBundle\Block\Tool\ContentTool;
use Opifer\ContentBundle\Block\Tool\ToolsetMemberInterface;
use Opifer\ContentBundle\Entity\HtmlBlock;
use Symfony\Component\Form\FormBuilderInterface;
use Opifer\ContentBundle\Model\BlockInterface;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

/**
* HTML Block Service
Expand All @@ -22,12 +25,12 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)

// Default panel
$builder->add(
$builder->create('default', 'form', ['inherit_data' => true])
->add('value', 'ckeditor', ['label' => 'label.rich_text', 'attr' => ['label_col' => 12, 'widget_col' => 12]])
$builder->create('default', FormType::class, ['inherit_data' => true])
->add('value', CKEditorType::class, ['label' => 'label.rich_text', 'attr' => ['label_col' => 12, 'widget_col' => 12]])
)->add(
$builder->create('properties', 'form')
->add('id', 'text', ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', 'text', ['attr' => ['help_text' => 'help.extra_classes']])
$builder->create('properties', FormType::class)
->add('id', TextType::class, ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', TextType::class, ['attr' => ['help_text' => 'help.extra_classes']])
);
}

Expand Down
2 changes: 1 addition & 1 deletion Block/Service/ImageBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)
'attr' => array('label_col' => 12, 'widget_col' => 12),
])
)->add(
$builder->create('properties', 'form')
$builder->create('properties', FormType::class)
->add('id', TextType::class, ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', TextType::class, ['attr' => ['help_text' => 'help.extra_classes']])
->add('filter', ChoiceType::class, [
Expand Down
16 changes: 10 additions & 6 deletions Block/Service/JumbotronBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

namespace Opifer\ContentBundle\Block\Service;

use Opifer\CmsBundle\Form\Type\CKEditorType;
use Opifer\ContentBundle\Block\Tool\ContentTool;
use Opifer\ContentBundle\Block\Tool\ToolsetMemberInterface;
use Opifer\ContentBundle\Entity\JumbotronBlock;
use Opifer\ContentBundle\Model\BlockInterface;
use Opifer\MediaBundle\Form\Type\MediaPickerType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

/**
Expand All @@ -23,15 +27,15 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)
{
parent::buildManageForm($builder, $options);

$propertiesForm = $builder->create('properties', 'form')
->add('id', 'text', ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', 'text', ['attr' => ['help_text' => 'help.extra_classes']]);
$propertiesForm = $builder->create('properties', FormType::class)
->add('id', TextType::class, ['attr' => ['help_text' => 'help.html_id']])
->add('extra_classes', TextType::class, ['attr' => ['help_text' => 'help.extra_classes']]);


if ($this->config['styles']) {

$propertiesForm
->add('styles', 'choice', [
->add('styles', ChoiceType::class, [
'label' => 'label.styling',
'choices' => $this->config['styles'],
'required' => false,
Expand All @@ -42,13 +46,13 @@ public function buildManageForm(FormBuilderInterface $builder, array $options)
}

$builder->add(
$builder->create('default', 'form', ['inherit_data' => true])
$builder->create('default', FormType::class, ['inherit_data' => true])
->add('media', MediaPickerType::class, [
'required' => false,
'multiple' => false,
'attr' => array('label_col' => 12, 'widget_col' => 12),
])
->add('value', 'ckeditor', ['label' => 'label.rich_text', 'attr' => ['label_col' => 12, 'widget_col' => 12]])
->add('value', CKEditorType::class, ['label' => 'label.rich_text', 'attr' => ['label_col' => 12, 'widget_col' => 12]])
)->add(
$propertiesForm
);
Expand Down
Loading

0 comments on commit 21970f3

Please sign in to comment.