Jump to content

Module: Textarea Markup inputfield


teppo
 Share

Recommended Posts

Textarea Markup inputfield

Loosely based on core module InputfieldMarkup, InputfieldTextareaMarkup works with textareas (FieldtypeTextarea) and outputs plain text, markup and optionally values from other fields in Page Edit (backend). That output can be configured via field settings (Input tab) and then modified on a per-page basis, though only by superusers.

For an example this:

Hello World, I'm a {{template}}, my ID is {{id}} and my name is {{name}}!

Would result in a non-editable (except by superusers) "markup field" with content along these lines:

Hello World, I'm a basic-page, my ID is 1001 and my name is About!

Content pulled from other fields is sanitised using $sanitizer->text() with default options, so no markup should get through, max length for individual field value is 255 etc.

The module is available from GitHub. For more details check out README and/or modules directory page.

  • Like 16
Link to comment
Share on other sites

Ah, I had to browse code to grasp what it does. Now I get it (wohoo!).

After understanding the code, readme makes totally sense :) First I understood only the field parsing part...

Btw: I think the docs are pretty clear, it was just me taking own conclusions too early.

Link to comment
Share on other sites

Good to hear that it makes sense (at least after a while). Seriously speaking, should probably start doing screencasts for all the modules.. these things are so much easier to show than explain :)

  • Like 1
Link to comment
Share on other sites

Having an issue here with this - the markup field shows for the non-superusers, but they are not able to save the page, basically they get an error saying they are not able to edit that field, even though that field is not being edited...

this is such a great module, and so needed for inline help and instructions, notes etc.. hope this is not a hard fix!!

Link to comment
Share on other sites

Great! Would also be cool to have a similar syntax like in selectors for accessing properties of fields:

Hello World, I'm a {{template}} [...]. Oh, and my current relationship status is {{relationship.currentStatus}}.

Infinitely deep of course ^-^

Link to comment
Share on other sites

@Macrura: the issue you reported should be fixed now in version 1.0.2 of the module just pushed to GitHub.

@owzim: I'll take a look at that, seems to make sense but needs some additional logic :)

Link to comment
Share on other sites

@Macrura: you're welcome :)

@owzim: didn't realise that core already takes care of this, so it should pretty much work out of the box. At least that's true for Fieldtype Map Marker and repeaters (just tested).

For the record, there's now some very basic output formatting (CSV, basically) for array type values built-in. The need for this came up while outputting values from repeaters, i.e. "here's a list of my friends: {{friends.name }}" (which should now output something like "here's a list of my friends: Smith, Johnson, Williams, Jones").

  • Like 1
Link to comment
Share on other sites

this module is really helpful - here are some example use cases that i'm using for:

1.) i made a field at the top of a gallery item template which reminds the user to crop the frames and center the images prior to uploading, as well as some suggestions for naming conventions; so now when someone is adding an item they see those instructions right at the top of the editor; if there is a particular problem with any item in the gallery, i could as the superadmin go to that item and make a further note that this item has a problem..

2.) i have a template for a class session which is edited using the PageTable module, and when editing that info in the lightbox it can be hard to sometimes remember which class you are editing, so i have a field at the top that says "you are editing a session for {class.title}"

so i'm using this for context-aware inline help

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

we seem to be having the same issue again with non-superusers not being able to save (Only superusers can edit field)

even though the user didn't edit the textarea markup field, since it is not editable for their role; (using 1.0.3)

Link to comment
Share on other sites

@Macrura: I've just pushed 1.0.4 to GitHub. This version drops saveReady hook in favour of ___processInput() method. This actually eliminates the need to throw any exceptions, as the module can simply use current value and continue saving the page.

Hope this helps -- and hope it doesn't cause any additional issues either. I've tested it in my own environment and everything seems to work just fine, but please let me know if anything goes wrong!

  • Like 1
Link to comment
Share on other sites

hi teppo - many thanks, will update the module soon - for now i gave that user superadmin to get through the project, and this issue wasn't happening on all pages, just certain ones; i will update module, reset the role and report back asap...

  • Like 1
Link to comment
Share on other sites

  • 6 years later...

Hi, this is a blast from the past, 2014 the last time someone talked about this module in here! And what a great module it still is. Is this still the best place to discuss?

I've noticed today that {{id}} doesn't seem to return anything in the user template, could there be some obvious reason for that which I'm missing?

Thanks!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...