Create a gist now

Instantly share code, notes, and snippets.

<?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