forked from ezsystems/PlatformUIBundle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3483981
commit 64ea426
Showing
12 changed files
with
285 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* File containing the SectionList class. | ||
* | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
* @version //autogentag// | ||
*/ | ||
|
||
namespace EzSystems\PlatformUIBundle\Entity; | ||
|
||
/** | ||
* Class SectionList | ||
* | ||
* Entity class used by the section list form | ||
* | ||
*/ | ||
class SectionList | ||
{ | ||
/** | ||
* @var array of sections ids | ||
*/ | ||
public $ids = array(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
/** | ||
* File containing the SectionListType class. | ||
* | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
* @version //autogentag// | ||
*/ | ||
|
||
namespace EzSystems\PlatformUIBundle\Form\Type; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | ||
use EzSystems\PlatformUIBundle\Helper\SectionHelperInterface; | ||
use Symfony\Component\Translation\TranslatorInterface; | ||
|
||
/** | ||
* Class SectionListType | ||
* | ||
* @package EzSystems\PlatformUIBundle\Form\Type | ||
*/ | ||
class SectionListType extends AbstractType | ||
{ | ||
/** | ||
* @var \EzSystems\PlatformUIBundle\Helper\SectionHelperInterface | ||
*/ | ||
protected $sectionHelper; | ||
|
||
/** | ||
* @var \Symfony\Component\Translation\TranslatorInterface | ||
*/ | ||
private $translator; | ||
|
||
public function __construct( | ||
SectionHelperInterface $sectionHelper, | ||
TranslatorInterface $translator | ||
) | ||
{ | ||
$this->sectionHelper = $sectionHelper; | ||
$this->translator = $translator; | ||
} | ||
|
||
public function buildForm( FormBuilderInterface $builder, array $options ) | ||
{ | ||
$sectionList = $this->sectionHelper->getSectionList(); | ||
|
||
$submitLabel = $this->translator->trans( | ||
'section.remove.selected', | ||
array(), | ||
'section' | ||
); | ||
|
||
$builder | ||
->add( | ||
'ids', | ||
'choice', | ||
array( | ||
'choices' => array( $sectionList ), | ||
'multiple' => true, | ||
'expanded' => true | ||
) | ||
) | ||
->add( 'delete', 'submit', array( 'label' => $submitLabel ) ); | ||
} | ||
|
||
public function getName() | ||
{ | ||
return 'sectionlist'; | ||
} | ||
|
||
public function setDefaultOptions( OptionsResolverInterface $resolver ) | ||
{ | ||
$resolver->setDefaults( | ||
array( 'data_class' => 'EzSystems\PlatformUIBundle\Entity\SectionList' ) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.