Skip to content

Commit

Permalink
Merge pull request #16 from webburza/fix/compatibility
Browse files Browse the repository at this point in the history
Fix/compatibility
  • Loading branch information
ychanan authored Jun 23, 2016
2 parents b3c6bfc + c4bde9e commit f11ade9
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 27 deletions.
4 changes: 2 additions & 2 deletions EventListener/FrontendMenuBuilderListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
namespace Webburza\Sylius\ArticleBundle\EventListener;

use Sylius\Bundle\WebBundle\Event\MenuBuilderEvent;
use Symfony\Component\Translation\DataCollectorTranslator;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\TranslatorInterface;

class FrontendMenuBuilderListener
{
Expand All @@ -12,7 +12,7 @@ class FrontendMenuBuilderListener
*/
protected $translator;

public function __construct(DataCollectorTranslator $translator)
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}
Expand Down
30 changes: 16 additions & 14 deletions EventListener/MenuBuilderListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
namespace Webburza\Sylius\ArticleBundle\EventListener;

use Sylius\Bundle\WebBundle\Event\MenuBuilderEvent;
use Symfony\Component\Translation\DataCollectorTranslator;
use Symfony\Component\Translation\Translator;
use Symfony\Component\Translation\TranslatorInterface;

class MenuBuilderListener
{
Expand All @@ -12,7 +12,7 @@ class MenuBuilderListener
*/
protected $translator;

public function __construct(DataCollectorTranslator $translator)
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}
Expand All @@ -21,18 +21,20 @@ public function addBackendMenuItems(MenuBuilderEvent $event)
{
$menu = $event->getMenu();

$menu['content']
->addChild('webburza_sylius_articles', array(
'route' => 'webburza_article_index',
'labelAttributes' => array('icon' => 'glyphicon glyphicon-file'),
))
->setLabel($this->translator->trans('webburza.sylius.article.backend.articles'));
if (isset($menu['content'])) {
$menu['content']
->addChild('webburza_sylius_articles', array(
'route' => 'webburza_article_index',
'labelAttributes' => array('icon' => 'glyphicon glyphicon-file'),
))
->setLabel($this->translator->trans('webburza.sylius.article.backend.articles'));

$menu['content']
->addChild('webburza_sylius_article_categories', array(
'route' => 'webburza_article_category_index',
'labelAttributes' => array('icon' => 'glyphicon glyphicon-tags'),
))
->setLabel($this->translator->trans('webburza.sylius.article_category.backend.article_categories'));
$menu['content']
->addChild('webburza_sylius_article_categories', array(
'route' => 'webburza_article_category_index',
'labelAttributes' => array('icon' => 'glyphicon glyphicon-tags'),
))
->setLabel($this->translator->trans('webburza.sylius.article_category.backend.article_categories'));
}
}
}
2 changes: 1 addition & 1 deletion Form/Type/ArticleCategoryTranslationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ArticleCategoryTranslationType extends AbstractResourceType
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('title', Type\TextType::class, [
$builder->add('title', 'text', [
'label' => 'webburza.sylius.article_category.label.title'
]);
}
Expand Down
2 changes: 1 addition & 1 deletion Form/Type/ArticleCategoryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'label' => 'webburza.sylius.article_category.translations'
]);

$builder->add('published', Type\CheckboxType::class, [
$builder->add('published', 'checkbox', [
'label' => 'webburza.sylius.article_category.label.published'
]);
}
Expand Down
12 changes: 6 additions & 6 deletions Form/Type/ArticleTranslationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ class ArticleTranslationType extends AbstractResourceType
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('title', Type\TextType::class, [
$builder->add('title', 'text', [
'label' => 'webburza.sylius.article.label.title'
]);

$builder->add('lead', Type\TextareaType::class, [
$builder->add('lead', 'textarea', [
'label' => 'webburza.sylius.article.label.lead',
'attr' => ['rows' => 4]
]);

$builder->add('content', Type\TextareaType::class, [
$builder->add('content', 'textarea', [
'label' => 'webburza.sylius.article.label.content',
'attr' => ['class' => 'ckeditor']
]);

$builder->add('active', Type\CheckboxType::class, [
$builder->add('active', 'checkbox', [
'label' => 'webburza.sylius.article.label.active'
]);

$builder->add('metaKeywords', Type\TextareaType::class, [
$builder->add('metaKeywords', 'textarea', [
'label' => 'webburza.sylius.article.label.meta_keywords',
'attr' => ['rows' => 2]
]);

$builder->add('metaDescription', Type\TextareaType::class, [
$builder->add('metaDescription', 'textarea', [
'label' => 'webburza.sylius.article.label.meta_description',
'attr' => ['rows' => 2]
]);
Expand Down
6 changes: 3 additions & 3 deletions Form/Type/ArticleType.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'multiple' => true
]);

$builder->add('publishedAt', Type\DateTimeType::class, [
$builder->add('publishedAt', 'datetime', [
'label' => 'webburza.sylius.article.label.published_at',
'required' => false,
'date_format' => 'y-M-d',
'date_widget' => 'choice',
'time_widget' => 'text'
]);

$builder->add('published', Type\CheckboxType::class, [
$builder->add('published', 'checkbox', [
'label' => 'webburza.sylius.article.label.published'
]);

$builder->add('featured', Type\CheckboxType::class, [
$builder->add('featured', 'checkbox', [
'label' => 'webburza.sylius.article.label.featured'
]);
}
Expand Down

0 comments on commit f11ade9

Please sign in to comment.