-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Symfony 3.0 support
- Loading branch information
Showing
10 changed files
with
80 additions
and
22 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
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 |
---|---|---|
@@ -1,8 +1,3 @@ | ||
twig: | ||
form: | ||
resources: | ||
- 'CmfMediaBundle:Form:fields.html.twig' | ||
|
||
cmf_media: | ||
persistence: | ||
phpcr: | ||
|
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,7 @@ | ||
imports: | ||
- { resource: cmf_media.yml } | ||
|
||
twig: | ||
form: | ||
resources: | ||
- 'CmfMediaBundle:Form:fields.html.twig' |
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,6 @@ | ||
imports: | ||
- { resource: cmf_media.yml } | ||
|
||
twig: | ||
form_themes: | ||
- 'CmfMediaBundle:Form:fields.html.twig' |
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,48 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony CMF package. | ||
* | ||
* (c) 2011-2015 Symfony CMF | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Cmf\Bundle\MediaBundle\Util; | ||
|
||
final class LegacyFormHelper | ||
{ | ||
private static $map = array( | ||
'Symfony\Cmf\Bundle\MediaBundle\Form\Type\FileType' => 'cmf_media_file', | ||
'Symfony\Cmf\Bundle\MediaBundle\Form\Type\ImageType' => 'cmf_media_image', | ||
'Symfony\Component\Form\Extension\Core\Type\FileType' => 'file', | ||
'Symfony\Component\Form\Extension\Core\Type\FormType' => 'form', | ||
); | ||
|
||
public static function getType($class) | ||
{ | ||
if (!self::isLegacy()) { | ||
return $class; | ||
} | ||
|
||
if (!isset(self::$map[$class])) { | ||
throw new \InvalidArgumentException(sprintf('Form type with class "%s" can not be found. Please check for typos or add it to the map in LegacyFormHelper', $class)); | ||
} | ||
|
||
return self::$map[$class]; | ||
} | ||
|
||
public static function isLegacy() | ||
{ | ||
return !method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix'); | ||
} | ||
|
||
private function __construct() | ||
{ | ||
} | ||
|
||
private function __clone() | ||
{ | ||
} | ||
} |
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