You are here

class UserAnalyticsPrivateMessage in Open Social 8.9

Same name and namespace in other branches
  1. 8.3 modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php \Drupal\social_private_message\Plugin\UserExportPlugin\UserAnalyticsPrivateMessage
  2. 8.4 modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php \Drupal\social_private_message\Plugin\UserExportPlugin\UserAnalyticsPrivateMessage
  3. 8.5 modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php \Drupal\social_private_message\Plugin\UserExportPlugin\UserAnalyticsPrivateMessage
  4. 8.6 modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php \Drupal\social_private_message\Plugin\UserExportPlugin\UserAnalyticsPrivateMessage
  5. 8.7 modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php \Drupal\social_private_message\Plugin\UserExportPlugin\UserAnalyticsPrivateMessage
  6. 8.8 modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php \Drupal\social_private_message\Plugin\UserExportPlugin\UserAnalyticsPrivateMessage
  7. 10.3.x modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php \Drupal\social_private_message\Plugin\UserExportPlugin\UserAnalyticsPrivateMessage
  8. 10.0.x modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php \Drupal\social_private_message\Plugin\UserExportPlugin\UserAnalyticsPrivateMessage
  9. 10.1.x modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php \Drupal\social_private_message\Plugin\UserExportPlugin\UserAnalyticsPrivateMessage
  10. 10.2.x modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php \Drupal\social_private_message\Plugin\UserExportPlugin\UserAnalyticsPrivateMessage

Provides a 'UserAnalyticsPrivateMessage' user export row.

Plugin annotation


@UserExportPlugin(
 id = "user_private_message",
 label = @Translation("Number of Private messages"),
 weight = -180,
)

Hierarchy

Expanded class hierarchy of UserAnalyticsPrivateMessage

File

modules/social_features/social_private_message/src/Plugin/UserExportPlugin/UserAnalyticsPrivateMessage.php, line 17

Namespace

Drupal\social_private_message\Plugin\UserExportPlugin
View source
class UserAnalyticsPrivateMessage extends UserExportPluginBase {

  /**
   * {@inheritdoc}
   */
  public function getHeader() {
    return $this
      ->t('Number of Private messages');
  }

  /**
   * {@inheritdoc}
   */
  public function getValue(UserInterface $entity) {
    $value = '';

    /** @var \Drupal\private_message\Entity\PrivateMessage $storage */
    try {
      $storage = $this->entityTypeManager
        ->getStorage('private_message');
      if (!empty($storage)) {
        $query = $storage
          ->getQuery();
        $value = (int) $query
          ->condition('owner', $entity
          ->id())
          ->count()
          ->execute();
      }
    } catch (\Exception $e) {
    }
    return $value;
  }

}

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.
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.
UserAnalyticsPrivateMessage::getHeader public function Returns the header. Overrides UserExportPluginBase::getHeader
UserAnalyticsPrivateMessage::getValue public function Returns the value. Overrides UserExportPluginBase::getValue
UserExportPluginBase::$database public property The database.
UserExportPluginBase::$dateFormatter public property The date formatter.
UserExportPluginBase::$entityTypeManager public property The entity type manager.
UserExportPluginBase::create public static function The create method. Overrides ContainerFactoryPluginInterface::create 4
UserExportPluginBase::getProfile public function Get the Profile entity. Overrides UserExportPluginInterface::getProfile
UserExportPluginBase::profileGetAddressFieldValue public function Returns the value for the address field and element within address. Overrides UserExportPluginInterface::profileGetAddressFieldValue
UserExportPluginBase::profileGetFieldValue public function Returns the value of a field for a given profile. Overrides UserExportPluginInterface::profileGetFieldValue
UserExportPluginBase::profileGetTaxonomyFieldValue public function Returns the values of a taxonomy reference field. Overrides UserExportPluginInterface::profileGetTaxonomyFieldValue
UserExportPluginBase::__construct public function UserExportPluginBase constructor. Overrides PluginBase::__construct 4