Can you add an input filters support to text field where admin enters a T&C?
I need a PHP-filter.
This is useful because I could add a links to other nodes to explain some terms etc.

Comments

beatnikdude’s picture

good idea, 2nd that

Tom Freudenberg’s picture

Hi you all,

we use localization modul for such things :-) Just enter a string like "legal:tc:1:text" to your legal text box. In case to "translate" english also you need to add english as language a second time, just use "en-EN" for that and disable standard "en".

Now you can go to localization and search for your term. Enter and fill in what you need, its normal HTML here :-)

The only thing, you can't use "HTML Textfield" as Representation for legal Text, but this is not the problem :-)

beatnikdude’s picture

6.x-2.2-beta4

"Full HTML" as a filter would be very useful, my clients give me heavily formated legal terms.

nancydru’s picture

The project page says it uses filter_xss_admin which is more permissive than any input filter. However, it appears to not be doing that as all my HTML is gone, including stuff that even the "Filtered HTML" filter allows.

deciphered’s picture

Version: 5.x-1.3 » 6.x-8.x-dev
Status: Active » Needs review
StatusFileSize
new395 bytes

A very simple patch, just replaces 'filter_xss_admin' with 'check_markup' which will process the legal text with the default input filter. It would be easy enough to add the ability to select an input filter, but I don't have the time at this point to do so, nor the need.

Hope someone finds this helpful.

deciphered’s picture

Version: 6.x-8.x-dev » 7.x-1.x-dev
StatusFileSize
new2.94 KB
new2.94 KB

New patch based on the previous version, but this time for Drupal 7 and it also adds the ability to select the input filter you wish to use.

Status: Needs review » Needs work

The last submitted patch, input_filter-226117-6.patch, failed testing.

deciphered’s picture

Status: Needs work » Needs review
StatusFileSize
new5.07 KB
new7.41 KB

Updated patch and tested tests.

thedavidmeister’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

seems good to me, still applies against 1.5

thedavidmeister’s picture

Status: Reviewed & tested by the community » Needs work

I spoke to soon. Actually, because of the way legal_conditions_updated() works, whenever you submit the form with this patch applies it creates a new revision and forces users to re-accept the T&Cs, even if nothing has changed in the conditions.

Something like this might work better:

/**
 * Check if T&Cs have been updated.
 */
function legal_conditions_updated($new) {
  $previous_same_language = legal_get_conditions($new['language']);
  $previous               = legal_get_conditions();

  if (($previous_same_language['conditions'] != $new['conditions']['value']) && ($previous['conditions'] != $new['conditions']['value'])) {
    return TRUE;
  }

  if (($previous_same_language['format'] != $new['conditions']['format']) && $previous['format'] != $new['conditions']['format']) {
    return TRUE;
  }

  $count = count($new['extras']);

  for ($counter = 1; $counter <= $count; $counter++) {
    $previous_same_language_extra = isset($previous_same_language['extras']['extras-' . $counter]) ? $previous_same_language['extras']['extras-' . $counter] : '';
    $previous_extra               = isset($previous['extras']['extras-' . $counter]) ? $previous['extras']['extras-' . $counter] : '';

    if (($previous_same_language_extra != $new['extras']['extras-' . $counter]) && ($previous_extra != $new['extras']['extras-' . $counter])) {
      return TRUE;
    }
  }

  return FALSE
}
geek-merlin’s picture

Issues #226117: Input filters support / #445308: Add support of text formats and WYSIWYG are duplicates and should be merged.
The patches are nearly identical (see the merge in my sandbox)
Although #226117: Input filters support is the older one, last patch from #445308: Add support of text formats and WYSIWYG looks a bit cleaner to me.
So i suggest to close #226117: Input filters support and join forces in #445308: Add support of text formats and WYSIWYG. Any objections?

avpaderno’s picture

Status: Needs work » Needs review