Skip to content

Commit

Permalink
ref: 'emsco_data_link' => Routes::DATA_LINK
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 committed Sep 21, 2024
1 parent 82433b0 commit 79d5d0b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions EMS/core-bundle/src/Form/DataField/WysiwygFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use EMS\CoreBundle\Entity\FieldType;
use EMS\CoreBundle\Form\Field\AnalyzerPickerType;
use EMS\CoreBundle\Form\Field\WysiwygStylesSetPickerType;
use EMS\CoreBundle\Routes;
use EMS\CoreBundle\Service\ElasticsearchService;
use EMS\CoreBundle\Service\WysiwygStylesSetService;
use EMS\Helpers\Standard\Type;
Expand Down Expand Up @@ -122,7 +123,7 @@ public function reverseViewTransform($data, FieldType $fieldType): DataField
$data
);

$path = $this->router->generate('emsco_data_link', ['key' => '__KEY__'], UrlGeneratorInterface::ABSOLUTE_PATH);
$path = $this->router->generate(Routes::DATA_LINK, ['key' => '__KEY__'], UrlGeneratorInterface::ABSOLUTE_PATH);
$out = \preg_replace_callback(
'/('.\preg_quote(\substr($path, 0, \strlen($path) - 7), '/').')(?P<key>[^\n\r"\'\?]*)/i',
fn ($matches) => 'ems://'.$matches['key'],
Expand Down Expand Up @@ -154,7 +155,7 @@ public function viewTransform(DataField $dataField)
fn ($matches) => $path.$matches[2],
$out
);
$path = $this->router->generate('emsco_data_link', ['key' => '__KEY__'], UrlGeneratorInterface::ABSOLUTE_PATH);
$path = $this->router->generate(Routes::DATA_LINK, ['key' => '__KEY__'], UrlGeneratorInterface::ABSOLUTE_PATH);
$out = \preg_replace_callback(
'/ems:\/\/(?P<key>file:([^\n\r"\'\?]*))/i',
fn ($matches) => \str_replace('__KEY__', $matches['key'], $path),
Expand Down
2 changes: 1 addition & 1 deletion EMS/core-bundle/src/Twig/AppExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ function ($matches) use ($path, $asFileName) {
},
$input
);
$path = $this->router->generate('emsco_data_link', ['key' => '__KEY__'], UrlGeneratorInterface::ABSOLUTE_PATH);
$path = $this->router->generate(Routes::DATA_LINK, ['key' => '__KEY__'], UrlGeneratorInterface::ABSOLUTE_PATH);
$out = \preg_replace_callback(
'/ems:\/\/(?P<key>file:([^\n\r"\'\?]*))/i',
fn ($matches) => \str_replace('__KEY__', $matches['key'], $path),
Expand Down

0 comments on commit 79d5d0b

Please sign in to comment.