Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML text can be passed easily to Text #2040

Open
mvorisek opened this issue May 8, 2023 · 2 comments · May be fixed by #2043
Open

HTML text can be passed easily to Text #2040

mvorisek opened this issue May 8, 2023 · 2 comments · May be fixed by #2043

Comments

@mvorisek
Copy link
Member

mvorisek commented May 8, 2023

Example:

$t = Text::addTo($parentView)->set('Name <b>popup');
var_dump($t->render());

image

Text class should be probably removed completely in favor of View only.

@DarkSide666
Copy link
Member

DarkSide666 commented May 10, 2023

I don't see reason why to remove this class. Text is quite standard thing to do even if it can easily be done by using View.

I think set() should not allow HTML and should probably use strip_tags to clean it up.
And there should be setHtml() method, in addition to addHtml() which we already have, to allow developer to intentionally set html text there.

Also could think about moving addParagraph functionality to separate class Paragraph extends Text because of same reason - kind of simple View <p> tag class, but could be useful in many cases so it's good to have some shortcut classes too.

@mvorisek mvorisek linked a pull request May 14, 2023 that will close this issue
@mvorisek
Copy link
Member Author

mvorisek commented Sep 7, 2023

one solution can be to rework every HTML string to be wrapped using HtmlTemplate\Value, as this would imply a frequent imports, rename also the class to HtmlValue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants