Skip to content

Conversation

@javiereguiluz
Copy link
Collaborator

The original TOC entry URL has something like "url" => "dashboards.html#dashboard-route" ... but I need each part of the URL separately because we're generating URLs with Twig's path() inside a Symfony app.

This PR adds the following properties to allow generating URLs with them:

    "page" => "dashboards"
    "fragment" => "dashboard-route"

$tocTree[] = [
'url' => sprintf('%s#%s', $metaEntry->getUrl(), Environment::slugify($title[0])),
'page' => u($metaEntry->getUrl())->beforeLast('.html'),
'fragment' => Environment::slugify($title[0]),
Copy link
Contributor

Choose a reason for hiding this comment

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

Bah, apparently we never created a test for this class. Ideally, we would have a test for this... probably most useful would be an integration test. But, the feature seems good to me 👍

@weaverryan weaverryan merged commit 2c06418 into symfony-tools:master Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants