Skip to content

Instantly share code, notes, and snippets.

@acrosman
Created January 8, 2017 19:21
Show Gist options
  • Save acrosman/67c42ca4aec9306ea0820e9f1bc29977 to your computer and use it in GitHub Desktop.
Save acrosman/67c42ca4aec9306ea0820e9f1bc29977 to your computer and use it in GitHub Desktop.
<?php
public function runTask($task_id, $site_name) {
$plugin = $this->pluginManagerService->createInstance($task_id);
$site = Site::load($site_name);
$status = $plugin->run($site);
if ($status == 'Success') {
$output = $plugin->getTaskOutput();
} else {
$output = [
'#type' => 'html_tag',
'#tag' => 'span',
'#attributes' => [
'class' => ['error'],
],
'#value' => $this->t('Task failed'),
];
}
$response = new AjaxResponse();
$response->addCommand(new HtmlCommand(
".details-display[site='" . $site->getName() . "']",
$output));
return $response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment