Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Github issue: (#379)
What does this Pull Request do?
Moves the custom Twig filter TwigTruncate code to a utility class so it can be shared across metadatamanipulators and metadataparsers that use Twig templates.
What's new?
Adds a new MIK utility class, src/utilities/MikTwigExtension.php, that is used within metadatamanipulators and metadataparsers like this:
The custom TwigTruncate filter is then available in metadatamanipulators and metadataparsers using logic like this:
How should this be tested?
Since this branch makes it possible to share code between a metadata parser and a metadata manipulator, we should test both.
composer dump-autoload
or equivalent../mik -c issue_379_parser.ini
. Output files will be in /tmp/issue_379_output../mik -c issue_379_manipulator.ini
. Output files will be in /tmp/issue_379_output.issue_379.zip
Additional Notes
We should start a Cookbook entry that documents all of the MIK-specific Twig extenstions (currently there is only one).
Interested parties
@MarcusBarnes