GithubHelp home page GithubHelp logo

[2010-05-04] Consistently use ShortcodeParser in Text/HTMLText value getters (breaking [sitetreelink_id] in SiteTree.Content) about silverstripe-framework HOT 4 CLOSED

silverstripe avatar silverstripe commented on July 18, 2024
[2010-05-04] Consistently use ShortcodeParser in Text/HTMLText value getters (breaking [sitetreelink_id] in SiteTree.Content)

from silverstripe-framework.

Comments (4)

tractorcow avatar tractorcow commented on July 18, 2024

This issue hasn't been touched for about 2 years but I'd like to elevate this as a bug impacting 3.1. At the very least, HTMLText should override any method that doesn't respect shortcodes with an appropriate replacement.

With the recent work on updating the blog module we should look at improving framework's support for these methods.

from silverstripe-framework.

tractorcow avatar tractorcow commented on July 18, 2024

Will try to address in #5653

from silverstripe-framework.

dhensby avatar dhensby commented on July 18, 2024

Context: At the moment the shortcodes are parsed only on HTMLText objects so a plain text object cannot have shortcodes parsed. HTMLText parses the shortcodes in the forTemplate method so it happens at the last possible moment (just before being output in the template) rather than when the value is set or get. Each have their advantages and pitfalls.

What is certain is that the shortcodes need to be parsed before any content-type encoding or other manipulation of the value is done.

I think adding the parser to thesetValue method makes instantiation of a HTMLText object too expensive, putting it on the getValue is inefficient (multiple runs) or too fragile to cache.

For now, it looks like @tractorcow's suggestion of overriding each of the functions (XML, Summary, etc) and having them parse the codes FIRST and then escape is best.

from silverstripe-framework.

tractorcow avatar tractorcow commented on July 18, 2024

Fixed with #5653 :D

from silverstripe-framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.