You are here

TcaPluginBase.php in Token Content Access 8

Same filename and directory in other branches
  1. 2.0.x src/Plugin/TcaPluginBase.php

Namespace

Drupal\tca\Plugin

File

src/Plugin/TcaPluginBase.php
View source
<?php

namespace Drupal\tca\Plugin;

use Drupal\Component\Plugin\PluginBase;

/**
 * Base class for TCA plugins.
 */
abstract class TcaPluginBase extends PluginBase implements TcaPluginInterface {

  /**
   * {@inheritdoc}
   */
  public function isFieldable() {
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function getFormSubmitHandlerAttachLocations() {
    return [
      [
        'actions',
        'submit',
        '#submit',
      ],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getBundleFormSubmitHandlerAttachLocations() {
    return [
      [
        'actions',
        'submit',
        '#submit',
      ],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getEntityTokenMap() {
    $map = [];
    $map[$this->pluginDefinition['entityType']] = $this->pluginDefinition['entityType'];
    $bundle = \Drupal::entityTypeManager()
      ->getDefinition($this->pluginDefinition['entityType'])
      ->getBundleEntityType();
    if (!empty($bundle)) {
      $map[$bundle] = $bundle;
    }
    return $map;
  }

}

Classes

Namesort descending Description
TcaPluginBase Base class for TCA plugins.