Skip to content

Provides a Pattern Lab plugin to enable data from the data directory to be marked as safe.

Notifications You must be signed in to change notification settings

FabbDev/pattern-lab-php-safe-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Safe Data Pattern Lab PHP plugin

The Safe Data plugin allows data from the data directory to be marked as safe when used with PHP Pattern Lab and Twig.

One place it could be useful is if

  1. you want to use Pattern Lab with Drupal and have the same default autoescaping strategy in Pattern Lab as Drupal (html); and
  2. from Drupal you pass a variable to a template that contains a render array which returns safe markup (ie it won't get escaped when used in a template despite the autoescaping strategy) – an example of this might be a formatted text field.

You can use this plugin to create data variables that will get marked as safe and can be used for eg. formatted text field values.

Installation

To add the plugin to your project using Composer type:

compose config repositories.pattern-lab-safe-data '{"type": "vcs", "url": "https://github.com/FabbDev/pattern-lab-php-safe-data"}'
composer require fabb-dev/pattern-lab-safe-data

Usage

You can mark data as safe in your json or yml data files by using this format:

"key": "MarkSafe() > This will <em>not</em> get escaped."

Disabling the Plugin

To disable the plugin you can either directly edit ./config/config.yml or use the command line option:

php core/console --config --set plugins.safeData.enabled=false

Todo

  • Decide on final living place add to packagist.

About

Provides a Pattern Lab plugin to enable data from the data directory to be marked as safe.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages