You are here

WebformRevisionsFormAlter.php in Config Entity Revisions 8.2

File

modules/webform_revisions/src/WebformRevisionsFormAlter.php
View source
<?php

namespace Drupal\webform_revisions;

use Drupal\config_entity_revisions\ConfigEntityRevisionsFormAlterBase;
use Drupal\config_entity_revisions\ConfigEntityRevisionsFormAlterInterface;

/**
 * Class WebformRevisionsFormAlter.
 *
 * @package Drupal\webform_revisions
 */
class WebformRevisionsFormAlter extends ConfigEntityRevisionsFormAlterBase implements ConfigEntityRevisionsFormAlterInterface {

  /**
   * Route parameter name.
   *
   * @return string
   *   The name of the route parameter used to access the config entity.
   */
  public static function getRouteParameterName() {
    return 'webform';
  }

  /**
   * WebformRevisions routes that provide an add form.
   *
   * @return array
   *   WebformRevisions routes that provide an add form.
   */
  public static function getAddFormRoutes() {
    return [
      'entity.webform.add_form',
    ];
  }

  /**
   * WebformRevisions routes that provide add or edit forms.
   *
   * @return array
   *   WebformRevisions routes that provide add or edit forms.
   */
  public static function getEditFormRoutes() {
    return [
      'entity.webform.edit_form',
      'entity.webform.source_form',
    ];
  }

  /**
   * WebformRevisions routes that get new revision form fields.
   *
   * @return array
   *   WebformRevisions routes that provide add or edit forms.
   */
  public static function getNewRevisionRoutes() {
    return [
      'entity.webform.edit_form',
      'entity.webform.source_form',
    ];
  }

  /**
   * Additional routes (to $add_edit_form_routes) that need a revision id.
   *
   * @return array
   *   Additional routes (to $add_edit_form_routes) that need a revision id.
   */
  public static function getRevisionRoutes() {
    return array_merge(self::getAddFormRoutes(), self::getEditFormRoutes(), []);
  }

}

Classes

Namesort descending Description
WebformRevisionsFormAlter Class WebformRevisionsFormAlter.