You are here

abstract class ShareUsageDataPluginBase in Open Social 8.6

Same name and namespace in other branches
  1. 8.9 modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPluginBase.php \Drupal\social_lets_connect_usage\Plugin\ShareUsageDataPluginBase
  2. 8.5 modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPluginBase.php \Drupal\social_lets_connect_usage\Plugin\ShareUsageDataPluginBase
  3. 8.7 modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPluginBase.php \Drupal\social_lets_connect_usage\Plugin\ShareUsageDataPluginBase
  4. 8.8 modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPluginBase.php \Drupal\social_lets_connect_usage\Plugin\ShareUsageDataPluginBase
  5. 10.3.x modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPluginBase.php \Drupal\social_lets_connect_usage\Plugin\ShareUsageDataPluginBase
  6. 10.0.x modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPluginBase.php \Drupal\social_lets_connect_usage\Plugin\ShareUsageDataPluginBase
  7. 10.1.x modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPluginBase.php \Drupal\social_lets_connect_usage\Plugin\ShareUsageDataPluginBase
  8. 10.2.x modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPluginBase.php \Drupal\social_lets_connect_usage\Plugin\ShareUsageDataPluginBase

Base class for Share usage data plugin plugins.

Hierarchy

Expanded class hierarchy of ShareUsageDataPluginBase

5 files declare their use of ShareUsageDataPluginBase
EntityTypeCount.php in modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPlugin/EntityTypeCount.php
ModulesInstalled.php in modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPlugin/ModulesInstalled.php
OpenSocialVersion.php in modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPlugin/OpenSocialVersion.php
SystemData.php in modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPlugin/SystemData.php
WebsiteUrl.php in modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPlugin/WebsiteUrl.php

File

modules/custom/social_lets_connect/modules/social_lets_connect_usage/src/Plugin/ShareUsageDataPluginBase.php, line 15

Namespace

Drupal\social_lets_connect_usage\Plugin
View source
abstract class ShareUsageDataPluginBase extends PluginBase implements ShareUsageDataPluginInterface, ContainerFactoryPluginInterface {
  use StringTranslationTrait;

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  public $entityTypeManager;

  /**
   * The config.
   *
   * @var \Drupal\Core\Config\ConfigFactory
   */
  public $config;

  /**
   * UserExportPluginBase constructor.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param \Drupal\Core\Config\ConfigFactory $config
   *   The configuration.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ConfigFactory $config) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->entityTypeManager = $entity_type_manager;
    $this->config = $config;
  }

  /**
   * The create method.
   *
   * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
   *   Container interface.
   * @param array $configuration
   *   An array of configuration.
   * @param string $plugin_id
   *   The plugin id.
   * @param mixed $plugin_definition
   *   The plugin definition.
   *
   * @return \Drupal\Core\Plugin\ContainerFactoryPluginInterface|\Drupal\social_user_export\Plugin\UserExportPluginBase
   *   Returns the UserExportPluginBase.
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('entity_type.manager'), $container
      ->get('config.factory'));
  }

  /**
   * Get the value.
   *
   * @return array
   *   $json array.
   */
  public function getValue() {
    return [];
  }

  /**
   * Check if this plugin should be enabled.
   */
  public function enabled() {
    $config = $this->config
      ->get('social_lets_connect_usage.settings');
    $usage_data_settings = $config
      ->get('usage_data');
    $plugin_definition = $this
      ->getPluginDefinition();
    if (in_array($plugin_definition['setting'], $usage_data_settings)) {
      return TRUE;
    }
    return FALSE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
ShareUsageDataPluginBase::$config public property The config.
ShareUsageDataPluginBase::$entityTypeManager public property The entity type manager.
ShareUsageDataPluginBase::create public static function The create method. Overrides ContainerFactoryPluginInterface::create
ShareUsageDataPluginBase::enabled public function Check if this plugin should be enabled. Overrides ShareUsageDataPluginInterface::enabled
ShareUsageDataPluginBase::getValue public function Get the value. Overrides ShareUsageDataPluginInterface::getValue 5
ShareUsageDataPluginBase::__construct public function UserExportPluginBase constructor. Overrides PluginBase::__construct
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.