-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add InternalExternalLink form type #13
base: master
Are you sure you want to change the base?
Conversation
composer.lock
Outdated
@@ -0,0 +1,6601 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file should not be commited ;)
## How it works | ||
|
||
InternalExternalLink form type groups many fields to record each type of values. | ||
Javascript is use to display form and manage interaction between each field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used
* file that was distributed with this source code. | ||
* | ||
*/ | ||
namespace Sonata\SonataHelpersBundle\DependencyInjection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add blank line above plz ;)
* | ||
*/ | ||
namespace Sonata\SonataHelpersBundle\DependencyInjection; | ||
use Symfony\Component\Config\FileLocator; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add blank line above plz ;)
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add blank line above plz ;)
->select('page') | ||
->from(Page::class, 'page') | ||
->andWhere('page.requestMethod LIKE :request_method', 'page.routeName NOT LIKE :fos_user') | ||
->andWhere('page.routeName NOT LIKE :sonata_cache', 'page.url IS NOT NULL') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice exclusions ;)
maybe we should add : ->andWhere('page.routeName NOT LIKE :internal_page')
and 'internal_page' => '_page_internal%',
in parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree. It should use the same filters as the CMS router.
It could be even more handy to get routes directly from the router
thx @bdejacobet . Could we imagine in the future to link it with ArticleBundle to also be able to choose a link to an article? ;) |
->select('page') | ||
->from(Page::class, 'page') | ||
->andWhere('page.requestMethod LIKE :request_method', 'page.routeName NOT LIKE :fos_user') | ||
->andWhere('page.routeName NOT LIKE :sonata_cache', 'page.url IS NOT NULL') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree. It should use the same filters as the CMS router.
It could be even more handy to get routes directly from the router
src/Entity/PageManager.php
Outdated
]) | ||
; | ||
|
||
if (null !== $site) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$site
can't be null
since the function definition doesn't allow it
* | ||
* @author Benoit de Jacobet <[email protected]> | ||
*/ | ||
class PageDataTransformer implements DataTransformerInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class has the same behaviour as a normalizer.
It should be integrated using the serializer component of Symfony.
This way we could use context to handle different behaviours
instead of an internal $keysToTransform
property
case 'link': | ||
if (!$values['link']) { | ||
$this->context->buildViolation($constraint->message) | ||
->setParameter('{{ error }}', 'Il faut saisir une url externe') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FR text
cd3d874
to
82033d2
Compare
I am targeting this branch, because it is a new feature
Changelog
To do
sonata-project/page-bundle
to dependenciesSubject
Add InternalExternalLink form type