Karinne Cyphers Posted February 21, 2019 Share Posted February 21, 2019 We've been trying to implement Profieldts TextBlocks as a method of giving content editors an easy means to use reusable text across a range of fields and inputs. We've run into issues around the way the tags need to be on their own line for the parser to grab the tag. Essentially we want the content folks to be able to put in a simple tag like show_sometext or something like ##sometext## that will replace that tag with some type of reusable text that the content folks define. We've considered possibly using Hanna Codes for this as well. Are there other methods that would work for this? The challenge is that we have a range of different types of text fields that we would like this to work on. Thanks Link to comment Share on other sites More sharing options...
dragan Posted February 21, 2019 Share Posted February 21, 2019 @Karinne Cyphers Did you see my response in your earlier thread? I still wonder why that Pro Field doesn't work for you (or at least not for all instances). Hanna Codes could probably work for your scenario. I can imagine a very basic setup that should work with a repeater setup like: repeater_shortcode = string repeater_content = anything (rich-text, plain-text...) You could save all that in one "settings" page, hidden from frontend-view etc. And in your ready.php you'd define a hook-rule to check if any such shortcodes are present, and do a simple search+replace on those (of course, you would have to tell authors what pseudo-tag it has to be wrapped in: [[address]] or ::address:: or whatever...) Link to comment Share on other sites More sharing options...
Karinne Cyphers Posted February 21, 2019 Author Share Posted February 21, 2019 Hi @dragan Yes, I saw your post on the other thread. I think the problem we are having with Profields Text Blocks is that a lot of the tags we use are inline, in a paragraph of other text, not on their own line. Also we'd like to use tags on non-textarea/ckeditor fields. My concern with the approach of using a hook in the ready file is that we already do quick a bit of hook processing and we're concerned about the performance is we also start doing a regex on the bulk of the site's fields. I'd love it if there was a text formatter that would work on regular text fields plus text areas/ckeditor fields and we could pick just the couple of dozen fields we need it to work with. Link to comment Share on other sites More sharing options...
horst Posted February 22, 2019 Share Posted February 22, 2019 Just a idea: build a textformatter module, attach it to all desired fields, plaintext and ckeditor fields. In the textformatter method, check what type the calling field is of, (HTML or plaintext). If plaintext, use the php function strip_tags() on your replacement content, otherwise leave as is. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now