forked from sulu/SuluCommunityBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request sulu#49 from alexander-schranz/feature/dynamic-for…
…m-corrections WIP: Default Export + Select to Dropdown
- Loading branch information
Showing
10 changed files
with
90 additions
and
16 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
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,66 @@ | ||
<?php | ||
|
||
namespace L91\Sulu\Bundle\FormBundle\Provider; | ||
|
||
use L91\Sulu\Bundle\FormBundle\Entity\Dynamic; | ||
use Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineFieldDescriptor; | ||
|
||
class DynamicProvider implements ListProviderInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getFieldDescriptors($webspace, $locale, $uuid) | ||
{ | ||
$fieldDescriptors = [ | ||
'id' => $this->createFieldDescriptor('id', '', 'public.id'), | ||
'firstName' => $this->createFieldDescriptor('firstName'), | ||
'lastName' => $this->createFieldDescriptor('lastName'), | ||
'email' => $this->createFieldDescriptor('email'), | ||
'phone' => $this->createFieldDescriptor('phone'), | ||
'street' => $this->createFieldDescriptor('street'), | ||
'zip' => $this->createFieldDescriptor('zip'), | ||
'city' => $this->createFieldDescriptor('city'), | ||
'state' => $this->createFieldDescriptor('state'), | ||
'country' => $this->createFieldDescriptor('country'), | ||
'function' => $this->createFieldDescriptor('function'), | ||
'company' => $this->createFieldDescriptor('company'), | ||
'created' => $this->createFieldDescriptor('created', 'date', 'public.created'), | ||
]; | ||
|
||
return $fieldDescriptors; | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* @param bool $disabled | ||
* @param string $type | ||
* | ||
* @return DoctrineFieldDescriptor | ||
*/ | ||
protected function createFieldDescriptor($name, $type = '', $translationKey = '', $disabled = false) | ||
{ | ||
if (!$translationKey) { | ||
$translationKey = 'l91_sulu_form.type.' . strtolower($name); | ||
} | ||
|
||
return new DoctrineFieldDescriptor( | ||
$name, | ||
$name, | ||
Dynamic::class, | ||
$translationKey, | ||
[], | ||
$disabled, | ||
false, | ||
$type | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getEntityName($webspace, $locale, $uuid) | ||
{ | ||
return Dynamic::class; | ||
} | ||
} |
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
File renamed without changes.
File renamed without changes.