You are here

WebformSharePreRender.php in Webform 6.x

Same filename and directory in other branches
  1. 8.5 modules/webform_share/src/WebformSharePreRender.php

File

modules/webform_share/src/WebformSharePreRender.php
View source
<?php

namespace Drupal\webform_share;

use Drupal\Core\Security\TrustedCallbackInterface;

/**
 * Implements trusted prerender callbacks for the Webform share module.
 *
 * @internal
 */
class WebformSharePreRender implements TrustedCallbackInterface {

  /**
   * Prerender callback for page.
   */
  public static function page($element) {
    if (!WebformShareHelper::isPage()) {
      return $element;
    }

    // Remove all theme wrappers from the page template.
    $element['#theme_wrappers'] = [];
    return $element;
  }

  /**
   * {@inheritdoc}
   */
  public static function trustedCallbacks() {
    return [
      'page',
    ];
  }

}

Classes

Namesort descending Description
WebformSharePreRender Implements trusted prerender callbacks for the Webform share module.