You are here

public function OpignoModuleAddActivity::execute in Opigno module 8

Same name and namespace in other branches
  1. 3.x src/Plugin/Action/OpignoModuleAddActivity.php \Drupal\opigno_module\Plugin\Action\OpignoModuleAddActivity::execute()

Executes the plugin.

Overrides ExecutableInterface::execute

File

src/Plugin/Action/OpignoModuleAddActivity.php, line 23

Class

OpignoModuleAddActivity
Add activities to Module.

Namespace

Drupal\opigno_module\Plugin\Action

Code

public function execute($entity = NULL) {

  // Get URL parameters.
  foreach (\Drupal::routeMatch()
    ->getParameters() as $param) {
    if ($param instanceof OpignoModuleInterface) {
      $opigno_module = $param;
    }
  }
  if ($opigno_module) {
    $opigno_module_obj = \Drupal::service('opigno_module.opigno_module');
    $save_acitivities = $opigno_module_obj
      ->activitiesToModule([
      $entity,
    ], $opigno_module);
  }
}