-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Add a new Link component #22273
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 a new Link component #22273
Changes from 1 commit
b7a1591
d83b244
7be2a6c
66c4ed6
aaa54c2
c73ae6c
949a207
fc4d63b
aba1dbb
4a82c3d
b136372
fd2dd50
f0ce807
209901b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
use Symfony\Component\Form\Form; | ||
use Symfony\Component\Link\LinkManagerInterface; | ||
use Symfony\Component\WebLink\WebLinkManagerInterface; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. alpha order |
||
use Symfony\Component\Serializer\Serializer; | ||
use Symfony\Component\Translation\Translator; | ||
use Symfony\Component\Validator\Validation; | ||
|
@@ -101,7 +101,7 @@ public function getConfigTreeBuilder() | |
$this->addPropertyInfoSection($rootNode); | ||
$this->addCacheSection($rootNode); | ||
$this->addPhpErrorsSection($rootNode); | ||
$this->addLinksSection($rootNode); | ||
$this->addWebLinkSection($rootNode); | ||
|
||
return $treeBuilder; | ||
} | ||
|
@@ -808,13 +808,13 @@ private function addPhpErrorsSection(ArrayNodeDefinition $rootNode) | |
; | ||
} | ||
|
||
private function addLinksSection(ArrayNodeDefinition $rootNode) | ||
private function addWebLinkSection(ArrayNodeDefinition $rootNode) | ||
{ | ||
$rootNode | ||
->children() | ||
->arrayNode('links') | ||
->info('links configuration') | ||
->{!class_exists(FullStack::class) && interface_exists(LinkManagerInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}() | ||
->arrayNode('web_link') | ||
->info('web links configuration') | ||
->{!class_exists(FullStack::class) && interface_exists(WebLinkManagerInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}() | ||
->end() | ||
->end() | ||
; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
use Symfony\Component\Finder\Finder; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\Link\LinkManagerInterface; | ||
use Symfony\Component\WebLink\WebLinkManagerInterface; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. alpha order |
||
use Symfony\Component\PropertyAccess\PropertyAccessor; | ||
use Symfony\Component\Serializer\Encoder\YamlEncoder; | ||
use Symfony\Component\Serializer\Encoder\CsvEncoder; | ||
|
@@ -209,12 +209,12 @@ public function load(array $configs, ContainerBuilder $container) | |
$this->registerPropertyInfoConfiguration($config['property_info'], $container, $loader); | ||
} | ||
|
||
if ($this->isConfigEnabled($container, $config['links'])) { | ||
if (!interface_exists(LinkManagerInterface::class)) { | ||
throw new LogicException('Link support cannot be enabled as the Link component is not installed.'); | ||
if ($this->isConfigEnabled($container, $config['web_link'])) { | ||
if (!interface_exists(WebLinkManagerInterface::class)) { | ||
throw new LogicException('WebLink support cannot be enabled as the WebLink component is not installed.'); | ||
} | ||
|
||
$loader->load('links.xml'); | ||
$loader->load('web_link.xml'); | ||
} | ||
|
||
$this->addAnnotatedClassesToCompile(array( | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
<xsd:element name="csrf-protection" type="csrf_protection" minOccurs="0" maxOccurs="1" /> | ||
<xsd:element name="esi" type="esi" minOccurs="0" maxOccurs="1" /> | ||
<xsd:element name="fragments" type="fragments" minOccurs="0" maxOccurs="1" /> | ||
<xsd:element name="links" type="links" minOccurs="0" maxOccurs="1" /> | ||
<xsd:element name="web-link" type="web_link" minOccurs="0" maxOccurs="1" /> | ||
<xsd:element name="profiler" type="profiler" minOccurs="0" maxOccurs="1" /> | ||
<xsd:element name="router" type="router" minOccurs="0" maxOccurs="1" /> | ||
<xsd:element name="session" type="session" minOccurs="0" maxOccurs="1" /> | ||
|
@@ -63,7 +63,7 @@ | |
<xsd:attribute name="path" type="xsd:string" /> | ||
</xsd:complexType> | ||
|
||
<xsd:complexType name="links"> | ||
<xsd:complexType name="web_link"> | ||
<xsd:attribute name="enabled" type="xsd:boolean" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it make sense to set this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All others similar parameters use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe something to "fix" by adding a new "boolean" type, borrowed from the XSD of the DI XmlFileLoader? (in another PR) |
||
</xsd:complexType> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" ?> | ||
|
||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
|
||
<services> | ||
|
||
<service id="web_link.manager" class="Symfony\Component\WebLink\WebLinkManager" public="false" /> | ||
<service id="Symfony\Component\WebLink\WebLinkManagerInterface" alias="web_link.manager" public="false" /> | ||
|
||
<service id="web_link.add_link_header_listener" class="Symfony\Component\Link\WebLink\HeaderListener" public="false"> | ||
<argument type="service" id="web_link.manager" /> | ||
|
||
<tag name="kernel.event_subscriber" /> | ||
</service> | ||
|
||
</services> | ||
</container> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,7 +238,7 @@ protected static function getBundleDefaultConfig() | |
'log' => true, | ||
'throw' => true, | ||
), | ||
'links' => array( | ||
'web_link' => array( | ||
'enabled' => !class_exists(FullStack::class), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about adding the component as a dev dependency to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is, it's not related. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, I misread the code |
||
), | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?php | ||
|
||
$container->loadFromExtension('framework', array( | ||
'links' => array('enabled' => true), | ||
'web_link' => array('enabled' => true), | ||
)); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
framework: | ||
links: | ||
web_link: | ||
enabled: true |
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.
We don't need this method.