feat: {{link:ID}} placeholder via Divi's post_link_url dynamic content
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -37,7 +37,14 @@ final class DiviCompositionTest extends TestCase
|
||||
return DiviFixtures::dynamicContentRegistry();
|
||||
});
|
||||
|
||||
return new DiviComposition($modules, $design, ComposeFixture::sanitizer(), ComposeFixture::media(), $registry);
|
||||
return new DiviComposition(
|
||||
$modules,
|
||||
$design,
|
||||
ComposeFixture::sanitizer(),
|
||||
ComposeFixture::media(),
|
||||
$registry,
|
||||
ComposeFixture::links()
|
||||
);
|
||||
}
|
||||
|
||||
private static function siteTitle(): string
|
||||
@@ -74,6 +81,24 @@ final class DiviCompositionTest extends TestCase
|
||||
self::assertSame($composition->references(), $composition->references());
|
||||
}
|
||||
|
||||
/** E13a: the composition hands its link targets to Placeholders; the result still passes ValueCleaner. */
|
||||
public function testInternalLinksUseTheLinkTargets(): void
|
||||
{
|
||||
$composer = $this->composition()->forPost(7)->composer();
|
||||
|
||||
$column = Block::create('divi/column');
|
||||
|
||||
$page = $composer->compose([['type' => 'button', 'text' => 'Kontakt', 'url' => '{{link:839}}']], $column, 'nodes');
|
||||
self::assertSame([], $page['errors']);
|
||||
self::assertStringContainsString(
|
||||
'post_link_url_page',
|
||||
json_encode($page['blocks'][0]->attrs(), JSON_THROW_ON_ERROR)
|
||||
);
|
||||
|
||||
$missing = $composer->compose([['type' => 'button', 'url' => '{{link:999}}']], $column, 'nodes');
|
||||
self::assertStringContainsString('Eintrag 999', $missing['errors']['nodes[0].url']);
|
||||
}
|
||||
|
||||
public function testWithoutAPostTheDefaultMapApplies(): void
|
||||
{
|
||||
$composition = $this->composition();
|
||||
|
||||
Reference in New Issue
Block a user