You are here

public function Blocks::execute in DRD Agent 8.3

Same name and namespace in other branches
  1. 4.0.x src/Agent/Action/Blocks.php \Drupal\drd_agent\Agent\Action\Blocks::execute()

Execute an action.

Return value

mixed The response of the action as an array which will be encrypted before returned to DRD.

Overrides Base::execute

File

src/Agent/Action/Blocks.php, line 69

Class

Blocks
Provides a 'Blocks' code.

Namespace

Drupal\drd_agent\Agent\Action

Code

public function execute() {
  if (!$this->moduleHandler
    ->moduleExists('block')) {
    return [];
  }
  $args = $this
    ->getArguments();
  if (!empty($args['module']) && !empty($args['delta'])) {
    return [
      'data' => $this
        ->renderBlock($args['delta']),
    ];
  }
  return $this
    ->listBlocks();
}