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
Correctly resolve internal and external links #98
Correctly resolve internal and external links #98
Conversation
Content/StructureResolver.php
Outdated
$originalDocument = $originalStructure->getDocument(); | ||
|
||
/** @var string|null $structureType */ | ||
$structureType = 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.
would call this templateKey
to be consistent with the SulucontentBundle
Content/StructureResolver.php
Outdated
$type = 'page'; | ||
} | ||
} | ||
$type = $this->getTemplateType($structure, $document); |
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.
would call this templateType
Content/StructureResolver.php
Outdated
@@ -65,7 +69,10 @@ public function resolve( | |||
string $locale, | |||
bool $includeExtension = true | |||
): array { | |||
$data = $this->getStructureData($structure); | |||
$originalStructure = $structure; |
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.
would call this requestedStructure
Content/StructureResolver.php
Outdated
@@ -65,7 +69,10 @@ public function resolve( | |||
string $locale, | |||
bool $includeExtension = true | |||
): array { | |||
$data = $this->getStructureData($structure); | |||
$originalStructure = $structure; | |||
$structure = $this->getMostSpecificStructure($originalStructure); |
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.
would call this targetStructure
Content/StructureResolver.php
Outdated
@@ -87,6 +94,18 @@ public function resolve( | |||
$data['view'][$property->getName()] = $contentView->getView(); | |||
} | |||
|
|||
$titleProperty = $originalStructure->getProperty('title'); |
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.
think i would implement a private getProperties
method with a $requestedStructure
and $targetStructure
argument. then we can loop over the properties of that method instead of $structure->getProperties(true)
and the special logic for the title
is handled at a single place
Content/StructureResolver.php
Outdated
@@ -133,14 +156,19 @@ public function resolveProperties( | |||
); | |||
} | |||
} else { | |||
if (!$structure->hasProperty($sourceProperty)) { | |||
$propertyStructure = $structure; | |||
if ('title' === $sourceProperty) { |
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.
would use the getProperties
proposed above here too, then we dont need to handle the title
differently
Content/StructureResolver.php
Outdated
|
||
$contentView = $this->resolveProperty( | ||
$structure, | ||
$propertyStructure, |
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.
think we can access the structure of the property via the getStructure()
method
Content/StructureResolver.php
Outdated
* | ||
* @return StructureBridge | ||
*/ | ||
private function getMostSpecificStructure(StructureInterface $structure): StructureInterface |
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.
getTargetStructure
fixes #62
fixes #96
fixes #97