You are here

EntityformType.php in Entityform 8.2

File

lib/Drupal/entityform/Entity/EntityformType.php
View source
<?php

/**
 * @file
 * Contains \Drupal\entityform\Entity\EntityformType.
 */
namespace Drupal\entityform\Entity;

use Drupal\Core\Config\Entity\ConfigEntityBase;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\Core\Entity\Annotation\EntityType;
use Drupal\Core\Annotation\Translation;

/**
 * Defines the Entityform type configuration entity.
 *
 * @EntityType(
 *   id = "entityform_type",
 *   label = @Translation("Entityform type"),
 *   module = "entityform",
 *   controllers = {
 *     "storage" = "Drupal\Core\Config\Entity\ConfigStorageController",
 *     "access" = "Drupal\Core\Entity\EntityAccessController",
 *     "form" = {
 *       "add" = "Drupal\entityform\EntityformTypeFormController",
 *       "edit" = "Drupal\entityform\EntityformTypeFormController",
 *     },
 *     "list" = "Drupal\entityform\EntityformTypeListController",
 *   },
 *   admin_permission = "administer entityform types",
 *   config_prefix = "entityform.type",
 *   bundle_of = "entityform_submission",
 *   entity_keys = {
 *     "id" = "type",
 *     "label" = "label",
 *     "uuid" = "uuid"
 *   },
 *   links = {
 *     "edit-form" = "admin/structure/entityform-types/manage/{entityform_type}"
 *   }
 * )
 */
class EntityformType extends ConfigEntityBase {

  /**
   * The machine name of this entityform type.
   *
   * @var string
   *
   * @todo Rename to $id.
   */
  public $type;

  /**
   * The UUID of the entityform type.
   *
   * @var string
   */
  public $uuid;

  /**
   * The human-readable name of the entityform type.
   *
   * @var string
   *
   * @todo Rename to $label.
   */
  public $label;

  /**
   * The title to use for the form.
   *
   * @var string
   */
  public $form_title = 'Title';

  /**
   * A brief description of this entityform type.
   *
   * @var string
   */
  public $description;

  /**
   * Help information shown to the user when creating a Entityform of this type.
   *
   * @var string
   */
  public $help;

  /**
   * Module-specific settings for this entityform type, keyed by module name.
   *
   * @var array
   *
   * @todo Pluginify.
   */
  public $settings = array();

  /**
   * {@inheritdoc}
   */
  public function id() {
    return $this->type;
  }

  /**
   * {@inheritdoc}
   */
  public function getModuleSettings($module) {
    if (isset($this->settings[$module]) && is_array($this->settings[$module])) {
      return $this->settings[$module];
    }
    return array();
  }

  /**
   * {@inheritdoc}
   */
  public function isLocked() {
    $locked = \Drupal::state()
      ->get('entityform.type.locked');
    return isset($locked[$this
      ->id()]) ? $locked[$this
      ->id()] : FALSE;
  }

}

Classes

Namesort descending Description
EntityformType Defines the Entityform type configuration entity.