charcoal-contrib-sitemap 0.4.0
Complete commits list: 0.3.1...0.4.0
Breaking Changes:
- Refactor XML generation in
SitemapAction
.- ✨ Add support for children which was documented but only partially implemented.
- 🛠️ Replace
toXml()
method with decoupled builder methods that add to a shared XML element.
- Refactor loading and parsing of objects and children in
Builder
.- ⚡️ The
Builder
now transforms objects during the iteration of objects inbuildObject()
instead of transforming inrenderData()
. This reduces the number of times an object is transformed from 6–8 down to 1. - 🐛 Fix a child object's transformer being applied to the parent object when mutating the child's filters and orders.
- 🛠️ Ensure an empty object collection is excluded from the parent/sitemap collections.
- ⚡️ The
- Refactor the
renderData()
inBuilder
how transformers are resolved inSitemapPresenter
.- 🏗️ The
renderData()
method now accepts only two parameters:data
andcontext
(pre-transformed object). - 🛠️ The
renderData()
method now acceptsTraversable
andStringable
objects. - 🛠️ The
renderData()
method now explicitly returnsnull
instead ofvoid
.
- 🏗️ The
- Refactor and fix merging hierarchy/object options in
Builder
.- 🏗️ Replace method
defaultOptions()
withgetDefaultSitemapOptions()
andgetDefaultObjectOptions()
. - 🐛 Fix inconsistent merging of default hierarchy/object options with a hierarchy, objects and their children.
- 🏗️ Replace method
- Add
view
service toBuilder
instead of using each object'sview
handler.- 🏗️ This grants more control to the
Builder
and, by extension, developers integrating the Sitemap package. - ➕ Require Composer dependency locomotivemtl/charcoal-view.
- 🏗️ This grants more control to the
- Remove model factory from
Builder
.- ⚰️ The collection loader of the
Builder
has its own model factory that can instantiate the object from the class string/object type.
- ⚰️ The collection loader of the
- Replace renderer method
render()
withrenderTemplate()
inBuilder
since most examples of renderable data used template strings.- 🏗️ Given the ambiguity of the method names "render" and "renderTemplate" and with Mustache (the default templating engine of Charcoal) using the same method for both file paths and template strings, this led to widespread misuse which causes trouble with other templating engines such as Twig.
- ℹ️ The
render()
method is for template file paths (path/to/view.mustache
) and therenderTemplate()
method is for template strings ({{> path/to/view.mustache }}
).
Changes:
- Rename method
isValidUriHost
toisExternalHost
inSitemapAction
to cause less confusion about its purpose. - Rename language/locale variables in
Builder
to improve clarity. - Reduce duplicate logic for generating absolute/relative URLs in
Builder
. - Fix issues reported by PHPCS.