Skip to content

Add Base implementation of website content resolving #271

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

Merged
merged 27 commits into from
Nov 25, 2024

Conversation

Prokyonn
Copy link
Member

@Prokyonn Prokyonn commented Sep 2, 2024

@coveralls
Copy link

coveralls commented Sep 2, 2024

Pull Request Test Coverage Report for Build 11978668947

Details

  • 268 of 353 (75.92%) changed or added relevant lines in 17 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-2.9%) to 97.052%

Changes Missing Coverage Covered Lines Changed/Added Lines %
Content/Application/PropertyResolver/Resolver/LinkPropertyResolver.php 23 24 95.83%
Content/Application/PropertyResolver/Resolver/TeaserSelectionPropertyResolver.php 25 26 96.15%
Content/Application/ResourceLoader/Loader/LinkResourceLoader.php 19 22 86.36%
Content/Application/ContentResolver/Value/ContentView.php 9 13 69.23%
Content/Application/PropertyResolver/Resolver/BlockPropertyResolver.php 25 39 64.1%
Content/Application/ResourceLoader/Loader/TeaserResourceLoader.php 2 21 9.52%
Content/Application/ContentResolver/ContentResolver.php 63 83 75.9%
Content/UserInterface/Controller/Website/ContentController.php 0 23 0.0%
Totals Coverage Status
Change from base Build 11035923812: -2.9%
Covered Lines: 2798
Relevant Lines: 2883

💛 - Coveralls

@Prokyonn Prokyonn force-pushed the feature/content-resolver branch from 1521891 to ded692b Compare September 25, 2024 09:50
* with this source code in the file LICENSE.
*/

namespace Sulu\Bundle\ContentBundle\Content\Application\ContentObjects;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Comment on lines +61 to +91
$content = \array_merge($content, $result['content']);
$view = \array_merge($view, $result['view']);
$resolvableResources = \array_merge_recursive($resolvableResources, $result['resolvableResources']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge behave sometimes strange for nested arrays maybe we need to use array_replace / array_recursive_replace

foreach ($items as $item) {
$name = $item->getName();
$type = $item->getType();
if ($item instanceof SectionMetadata || $item instanceof FormMetadata) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if there is not a method to get the flatted version of the metadata without the sections for resolving.

@Prokyonn Prokyonn force-pushed the feature/content-resolver branch from ded692b to 53343e0 Compare September 27, 2024 06:55
@Prokyonn Prokyonn force-pushed the feature/content-resolver branch from bd4ec5f to 320d270 Compare October 14, 2024 15:41
@Prokyonn Prokyonn force-pushed the feature/content-resolver branch from 320d270 to 8f73e54 Compare October 14, 2024 15:44
Comment on lines +13 to +18
"repositories": [
{
"type": "vcs",
"url": "https://github.com/Prokyonn/sulu.git"
}
],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think we need it the other way around?

Sulu need install this fork to test it 🤔

Or does this branch has something requirements / new classes we require from sulu/sulu?

Prokyonn and others added 2 commits October 16, 2024 17:09
Co-authored-by: Alexander Schranz <alexander@sulu.io>
Co-authored-by: Alexander Schranz <alexander@sulu.io>
$blockTypes = $metadata->getTypes();
$contentViews = [];
foreach ($data as $block) {
$type = $block['type'];
Copy link
Member

@alexander-schranz alexander-schranz Oct 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not forgot to implement block visitors into the content bundle
they are required for hide and scheduled blocks.

Comment on lines +25 to +28
/**
* Prevent circular dependency by injecting the MetadataResolver after instantiation.
*/
public function setMetadataResolver(MetadataResolver $metadataResolver): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* Prevent circular dependency by injecting the MetadataResolver after instantiation.
*/
public function setMetadataResolver(MetadataResolver $metadataResolver): void
/**
* @internal
*
* Prevent circular dependency by injecting the MetadataResolver after instantiation.
*/
public function setMetadataResolver(MetadataResolver $metadataResolver): void

This method should not be part of the public API.

/**
* @internal This class is intended for internal use only within the package/library. Modifying or depending on this class may result in unexpected behavior and is not supported.
*/
class ContentView
Copy link
Member

@alexander-schranz alexander-schranz Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed we will require a $resourceCallback function as a parameter so the Link content type can after resolving set query and anchor ontop of it. This allows modification of the loaded resource by the propertyresolver later.

@Prokyonn Prokyonn marked this pull request as ready for review November 22, 2024 18:53
@alexander-schranz alexander-schranz merged commit 581f085 into sulu:0.9 Nov 25, 2024
3 of 5 checks passed
@alexander-schranz alexander-schranz changed the title Draft: Base implementation of website content resolving Add Base implementation of website content resolving Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New functionality not yet included in Bundle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants