You are here

class ConfigEntityRevisionFields in Config Entity Revisions 8

Same name and namespace in other branches
  1. 8.2 src/ConfigEntityRevisionFields.php \Drupal\config_entity_revisions\ConfigEntityRevisionFields
  2. 1.x src/ConfigEntityRevisionFields.php \Drupal\config_entity_revisions\ConfigEntityRevisionFields

Hierarchy

Expanded class hierarchy of ConfigEntityRevisionFields

2 files declare their use of ConfigEntityRevisionFields
ViewsRevisionFields.php in modules/views_revisions/src/ViewsRevisionFields.php
WebformRevisionFields.php in modules/webform_revisions/src/WebformRevisionFields.php

File

src/ConfigEntityRevisionFields.php, line 5

Namespace

Drupal\config_entity_revisions
View source
class ConfigEntityRevisionFields implements ConfigEntityRevisionFieldsInterface {

  /**
   * Should new revisions created by default?
   *
   * @return bool
   *   No new revision by default.
   */
  public static function getNewRevisionDefault() {
    return FALSE;
  }

  /**
   * Adds the revision form fields to the form.
   *
   * @param &$form
   *   The form to which the fields should be added.
   */
  public static function addRevisionFormFields(&$form) {

    // Add a log field if the "Create new revision" option is checked, or if the
    // current user has the ability to check that option.
    $new_revision_default = self::getNewRevisionDefault();
    $form['revision'] = [
      '#type' => 'checkbox',
      '#title' => t('Create new revision'),
      '#default_value' => $new_revision_default,
      '#group' => 'revision_information',
    ];
  }

}

Members