You are here

Nonce.php in LTI Tool Provider 8

Same filename and directory in other branches
  1. 2.x src/Entity/Nonce.php

File

src/Entity/Nonce.php
View source
<?php

namespace Drupal\lti_tool_provider\Entity;

use Drupal\Core\Entity\Annotation\ContentEntityType;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;

/**
 * Defines the LTIToolProviderNonce entity.
 *
 * @ingroup lti_tool_provider
 *
 * @ContentEntityType(
 *   id = "lti_tool_provider_nonce",
 *   label = @Translation("LTI Tool Provider Nonce Entity"),
 *   base_table = "lti_tool_provider_nonce",
 *   fieldable = FALSE,
 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "nonce",
 *     "uuid" = "uuid",
 *   },
 * )
 */
class Nonce extends ContentEntityBase implements ContentEntityInterface {

  /**
   * {@inheritdoc}
   */
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) : array {
    $fields = parent::baseFieldDefinitions($entity_type);
    $fields['nonce'] = BaseFieldDefinition::create('string')
      ->setLabel(t('Nonce'))
      ->setSettings([
      'max_length' => 512,
      'text_processing' => 0,
    ]);
    $fields['consumer_key'] = BaseFieldDefinition::create('string')
      ->setLabel(t('Consumer Key'))
      ->setSettings([
      'max_length' => 512,
      'text_processing' => 0,
    ]);
    $fields['timestamp'] = BaseFieldDefinition::create('created')
      ->setLabel(t('Timestamp'));
    return $fields;
  }

}

Classes

Namesort descending Description
Nonce Defines the LTIToolProviderNonce entity.