This repository has been archived by the owner on Sep 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add data transformers on abstract way use current form builder fix menu block admin fix menu admin problem use parent service definition use current form builder fix menu block admin fix menu admin problem use parent service definition Apply fixes from StyleCI
- Loading branch information
1 parent
38da164
commit a9f162e
Showing
19 changed files
with
139 additions
and
68 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,37 @@ | ||
<?php | ||
|
||
namespace Symfony\Cmf\Bundle\SonataAdminIntegrationBundle\Admin; | ||
|
||
use Doctrine\Bundle\PHPCRBundle\Form\DataTransformer\DocumentToPathTransformer; | ||
use Sonata\DoctrinePHPCRAdminBundle\Admin\Admin; | ||
use Symfony\Bridge\Doctrine\ManagerRegistry; | ||
use Symfony\Component\Form\FormBuilder; | ||
|
||
/** | ||
* @author Maximilian Berghoff <[email protected]> | ||
*/ | ||
class AbstractAdmin extends Admin | ||
{ | ||
/** | ||
* @var ManagerRegistry | ||
*/ | ||
private $managerRegistry; | ||
|
||
public function setManagerRegistry(ManagerRegistry $managerRegistry) | ||
{ | ||
$this->managerRegistry = $managerRegistry; | ||
} | ||
|
||
/** | ||
* Will add a the phpcr data transformer to a specific field. | ||
* | ||
* @param FormBuilder $formBuilder | ||
* @param $fieldName | ||
*/ | ||
public function addTransformerToField(FormBuilder $formBuilder, $fieldName) | ||
{ | ||
$formBuilder->get($fieldName)->addModelTransformer(new DocumentToPathTransformer( | ||
$this->managerRegistry->getManagerForClass($this->getClass()) | ||
)); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -12,14 +12,14 @@ | |
namespace Symfony\Cmf\Bundle\SonataAdminIntegrationBundle\Admin\Block; | ||
|
||
use Sonata\AdminBundle\Form\FormMapper; | ||
use Sonata\DoctrinePHPCRAdminBundle\Admin\Admin; | ||
use Sonata\DoctrinePHPCRAdminBundle\Form\Type\TreeModelType; | ||
use Symfony\Cmf\Bundle\SonataAdminIntegrationBundle\Admin\AbstractAdmin; | ||
use Symfony\Cmf\Bundle\TreeBrowserBundle\Form\Type\TreeSelectType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
|
||
/** | ||
* @author Nicolas Bastien <[email protected]> | ||
*/ | ||
abstract class AbstractBlockAdmin extends Admin | ||
abstract class AbstractBlockAdmin extends AbstractAdmin | ||
{ | ||
/** | ||
* @var string | ||
|
@@ -31,7 +31,7 @@ abstract class AbstractBlockAdmin extends Admin | |
*/ | ||
public function getExportFormats() | ||
{ | ||
return array(); | ||
return []; | ||
} | ||
|
||
/** | ||
|
@@ -44,12 +44,14 @@ protected function configureFormFields(FormMapper $formMapper) | |
->with('form.group_location', ['class' => 'col-md-3']) | ||
->add( | ||
'parentDocument', | ||
TreeModelType::class, | ||
['root_node' => $this->getRootPath(), 'choice_list' => array(), 'select_root_node' => true] | ||
TreeSelectType::class, | ||
['root_node' => $this->getRootPath(), 'widget' => 'browser'] | ||
) | ||
->add('name', TextType::class) | ||
->end() | ||
->end() | ||
; | ||
|
||
$this->addTransformerToField($formMapper->getFormBuilder(), 'parentDocument'); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
use Sonata\AdminBundle\Datagrid\DatagridMapper; | ||
use Sonata\AdminBundle\Datagrid\ListMapper; | ||
use Sonata\AdminBundle\Form\FormMapper; | ||
use Sonata\DoctrinePHPCRAdminBundle\Form\Type\TreeModelType; | ||
use Symfony\Cmf\Bundle\TreeBrowserBundle\Form\Type\TreeSelectType; | ||
|
||
/** | ||
* @author Lukas Kahwe Smith <[email protected]> | ||
|
@@ -44,8 +44,8 @@ protected function configureFormFields(FormMapper $formMapper) | |
->with('form.group_block', ['class' => 'col-md-9']) | ||
->add( | ||
'referencedBlock', | ||
TreeModelType::class, | ||
['choice_list' => [], 'required' => false, 'root_node' => $this->getRootPath()] | ||
TreeSelectType::class, | ||
['root_node' => $this->getRootPath(), 'widget' => 'browser', 'required' => false] | ||
) | ||
->end() | ||
->end() | ||
|
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
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.