ActivityActionBase.php in Open Social 10.1.x
Same filename and directory in other branches
- 8.9 modules/custom/activity_creator/src/Plugin/ActivityActionBase.php
- 8 modules/custom/activity_creator/src/Plugin/ActivityActionBase.php
- 8.2 modules/custom/activity_creator/src/Plugin/ActivityActionBase.php
- 8.3 modules/custom/activity_creator/src/Plugin/ActivityActionBase.php
- 8.4 modules/custom/activity_creator/src/Plugin/ActivityActionBase.php
- 8.5 modules/custom/activity_creator/src/Plugin/ActivityActionBase.php
- 8.6 modules/custom/activity_creator/src/Plugin/ActivityActionBase.php
- 8.7 modules/custom/activity_creator/src/Plugin/ActivityActionBase.php
- 8.8 modules/custom/activity_creator/src/Plugin/ActivityActionBase.php
- 10.3.x modules/custom/activity_creator/src/Plugin/ActivityActionBase.php
- 10.0.x modules/custom/activity_creator/src/Plugin/ActivityActionBase.php
- 10.2.x modules/custom/activity_creator/src/Plugin/ActivityActionBase.php
Namespace
Drupal\activity_creator\PluginFile
modules/custom/activity_creator/src/Plugin/ActivityActionBase.phpView source
<?php
namespace Drupal\activity_creator\Plugin;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Core\Entity\ContentEntityInterface;
/**
* Base class for Activity action plugins.
*/
abstract class ActivityActionBase extends PluginBase implements ActivityActionInterface {
/**
* {@inheritdoc}
*/
public function create($entity) {
if ($this
->isValidEntity($entity)) {
$this
->createMessage($entity);
}
}
/**
* {@inheritdoc}
*/
public function createMessage($entity) {
// Use the queue logger.
$activity_logger_factory = \Drupal::service('activity_logger.activity_factory');
// Create messages for all other types of content.
$activity_logger_factory
->createMessages($entity, $this->pluginId);
}
/**
* {@inheritdoc}
*/
public function isValidEntity($entity) {
// Turn off this feature for all non-content entities.
if (!$entity instanceof ContentEntityInterface) {
return FALSE;
}
return TRUE;
}
}
Classes
Name | Description |
---|---|
ActivityActionBase | Base class for Activity action plugins. |