You are here

class CreateActivityAction in Open Social 8.2

Same name and namespace in other branches
  1. 8.9 modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php \Drupal\activity_basics\Plugin\ActivityAction\CreateActivityAction
  2. 8 modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php \Drupal\activity_basics\Plugin\ActivityAction\CreateActivityAction
  3. 8.3 modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php \Drupal\activity_basics\Plugin\ActivityAction\CreateActivityAction
  4. 8.4 modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php \Drupal\activity_basics\Plugin\ActivityAction\CreateActivityAction
  5. 8.5 modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php \Drupal\activity_basics\Plugin\ActivityAction\CreateActivityAction
  6. 8.6 modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php \Drupal\activity_basics\Plugin\ActivityAction\CreateActivityAction
  7. 8.7 modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php \Drupal\activity_basics\Plugin\ActivityAction\CreateActivityAction
  8. 8.8 modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php \Drupal\activity_basics\Plugin\ActivityAction\CreateActivityAction
  9. 10.3.x modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php \Drupal\activity_basics\Plugin\ActivityAction\CreateActivityAction
  10. 10.0.x modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php \Drupal\activity_basics\Plugin\ActivityAction\CreateActivityAction
  11. 10.1.x modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php \Drupal\activity_basics\Plugin\ActivityAction\CreateActivityAction
  12. 10.2.x modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php \Drupal\activity_basics\Plugin\ActivityAction\CreateActivityAction

Provides a 'CreateActivityAction' acitivy action.

Plugin annotation


@ActivityAction(
 id = "create_entitiy_action",
 label = @Translation("Action that is triggered when a entity is created"),
)

Hierarchy

Expanded class hierarchy of CreateActivityAction

File

modules/custom/activity_basics/src/Plugin/ActivityAction/CreateActivityAction.php, line 16

Namespace

Drupal\activity_basics\Plugin\ActivityAction
View source
class CreateActivityAction extends ActivityActionBase {

  /**
   * {@inheritdoc}
   */
  public function create($entity) {
    if ($this
      ->isValidEntity($entity)) {

      // For nodes we make an exception, since they are potentially placed in
      // groups, which we cannot know here yet.
      if ($entity instanceof Node) {
        $data['entity_id'] = $entity
          ->id();
        $queue = \Drupal::queue('activity_logger_message');
        $queue
          ->createItem($data);
      }
      else {
        $this
          ->createMessage($entity);
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ActivityActionBase::createMessage public function Dumb function that can be called to create the message. Overrides ActivityActionInterface::createMessage
ActivityActionBase::isValidEntity public function Checks if this is a valid entity for the action. Overrides ActivityActionInterface::isValidEntity
CreateActivityAction::create public function Creates a new message on the action with some logic behind it. Overrides ActivityActionBase::create
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.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. 92