Skip to content

charcoal-contrib-sitemap 0.4.0

Compare
Choose a tag to compare
@mcaskill mcaskill released this 01 Nov 21:13
· 1 commit to master since this release
0.4.0
3250b22

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 in buildObject() instead of transforming in renderData(). 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.
  • Refactor the renderData() in Builder how transformers are resolved in SitemapPresenter.
    • 🏗️ The renderData() method now accepts only two parameters: data and context (pre-transformed object).
    • 🛠️ The renderData() method now accepts Traversable and Stringable objects.
    • 🛠️ The renderData() method now explicitly returns null instead of void.
  • Refactor and fix merging hierarchy/object options in Builder.
    • 🏗️ Replace method defaultOptions() with getDefaultSitemapOptions() and getDefaultObjectOptions().
    • 🐛 Fix inconsistent merging of default hierarchy/object options with a hierarchy, objects and their children.
  • Add view service to Builder instead of using each object's view handler.
    • 🏗️ This grants more control to the Builder and, by extension, developers integrating the Sitemap package.
    • ➕ Require Composer dependency locomotivemtl/charcoal-view.
  • 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.
  • Replace renderer method render() with renderTemplate() in Builder 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 the renderTemplate() method is for template strings ({{> path/to/view.mustache }}).

Changes:

  • Rename method isValidUriHost to isExternalHost in SitemapAction 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.