Unverified Commit a6952b66 authored by Mark Halliwell's avatar Mark Halliwell
Browse files

Issue #3135369 by markcarver: Add MarkdownAllowedHtml plugin



Signed-off-by: default avatarMark Carver <mark.carver@me.com>
parent 51be5437
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\bootstrap\Plugin\Markdown\AllowedHtml;

use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\Theme\ActiveTheme;
use Drupal\markdown\Plugin\Markdown\AllowedHtmlInterface;
use Drupal\markdown\Plugin\Markdown\ParserInterface;

/**
 * Provides additional Bootstrap specific allowed HTML for Markdown.
 *
 * @MarkdownAllowedHtml(
 *   id = "bootstrap",
 *   description = @Translation("Provide common global attributes that are useful when dealing with Bootstrap specific output."),
 * )
 */
class Bootstrap extends PluginBase implements AllowedHtmlInterface {

  /**
   * {@inheritdoc}
   */
  public function allowedHtmlTags(ParserInterface $parser, ActiveTheme $activeTheme = NULL) {
    return [
      '*' => [
        'data-complete-text' => TRUE,
        'data-container' => TRUE,
        'data-content' => TRUE,
        'data-dismiss' => TRUE,
        'data-loading-text' => TRUE,
        'data-parent' => TRUE,
        'data-placement' => TRUE,
        'data-ride' => TRUE,
        'data-slide' => TRUE,
        'data-slide-to' => TRUE,
        'data-spy' => TRUE,
        'data-target' => TRUE,
        'data-toggle' => TRUE,
      ],
    ];
  }

}