Code Monkey home page Code Monkey logo

Comments (6)

jhedstrom avatar jhedstrom commented on June 29, 2024

One option I thought of for the full text would be to add a __toString() method to the message entity, and leave getText() to return the array of outputs.

from message.

amitaibu avatar amitaibu commented on June 29, 2024

Can you give an example here , I'm not sure I follow.

The toString is a nice idea :)

from message.

jhedstrom avatar jhedstrom commented on June 29, 2024

I could find very few uses of the default getText() behavior in tests or in dependent contrib (message_notify). Rather, most actual usage passes in the ['text' => TRUE] setting.

The idea here is if folks still need the string output, then the __toString() method should suffice, and code can rely on getText() always returning an array.

I also realize that we can remove the language parameter from getText by adding a setLanguage method to the interface. That would allow __toString() to work with languages.

from message.

amitaibu avatar amitaibu commented on June 29, 2024

Rather, most actual usage passes in the ['text' => TRUE] setting.

Indeed, as far as I remember, this ['text' => TRUE] is needed in D7 to indicate if we want to sanitzie on not the text.

my (slight) problem with the change, is that getText() now returns an array, which is a (slight) WTF given it's name :)

There are several places where current methods return either a string or an array based on values in an options array.

I'm not sure about this?

from message.

jhedstrom avatar jhedstrom commented on June 29, 2024

By several, I think I just meant the two getText() methods on the Message and MessageType entities.

from message.

jhedstrom avatar jhedstrom commented on June 29, 2024

I've continued this work to add setLanguage(), so the __toString() method will properly work for all languages. I've also included some token fixes here as the code was too close to the other refactoring for a separate PR.

See #60

from message.

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.