Commit eaef9ff1 authored by Stephen Lucero's avatar Stephen Lucero
Browse files

Issue #3281936 by slucero, mariohernandez, johnle: Process text format filters for WYSIWYG fields

parent c4a2a3e5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
    "license": "MIT",
    "require": {
        "php": ">=7.1.3",
        "swaggest/json-schema": "^0.12",
        "symfony/finder": "^3.4 || ^4.0",
        "symfony/yaml": "^3.4 || ^4.0"
    },
+3 −0
Original line number Diff line number Diff line
@@ -7,6 +7,9 @@
  "properties": {
    "text": {
      "$ref": "@patternkit/atoms/example_ref/../example/src/example.json#/properties/text"
    },
    "nested_reference": {
      "$ref": "@patternkit/atoms/example_ref/../example/src/example.json"
    }
  }
}
+3 −1
Original line number Diff line number Diff line
Example twig template with include and reference.

{% include '@patternkit/atoms/example/src/example.twig' with _context %}
<div>{{- text|striptags('') -}}</div>

{% include '@patternkit/atoms/example/src/example.twig' with nested_reference %}

patternkit.api.php

0 → 100644
+22 −0
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Documentation for custom hooks defined in the Patternkit module.
 */

/**
 * Alter the list of registered field processor plugins.
 *
 * @param array $info
 *   The field processor plugin definitions to be altered.
 */
function hook_pattern_field_processor_info_alter(array &$info): void {
  // Override the class for a provided processor.
  if (isset($info['token'])) {
    $info['token']['class'] = '\My\Custom\ProcessorPluginClass';
  }

  // Unregister a provided processor.
  unset($info['wysiwyg']);
}

patternkit.polyfil.php

0 → 100644
+33 −0
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Polyfil functions for PHP version compatibility to be loaded if needed.
 */

if (!function_exists("array_is_list")) {

  /**
   * Test whether an array is associative or numerically indexed.
   *
   * @param array $array
   *   The array for testing.
   *
   * @return bool
   *   TRUE if all indexes are numeric and sequentially specified. FALSE if
   *   there are any non-numeric indices, or they are out of order.
   *
   * @see https://www.php.net/manual/en/function.array-is-list
   */
  function array_is_list(array $array): bool {
    $i = -1;
    foreach ($array as $k => $v) {
      ++$i;
      if ($k !== $i) {
        return FALSE;
      }
    }
    return TRUE;
  }

}
Loading