public function StatusAddController::add in Heartbeat 8
Displays add links for available bundles/types for entity status .
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request object.
Return value
array A render array for a list of the status bundles/types that can be added or if there is only one type/bunlde defined for the site, the function returns the add page for that bundle/type.
File
- modules/
statusmessage/ src/ Controller/ StatusAddController.php, line 46
Class
- StatusAddController
- Class StatusAddController.
Namespace
Drupal\statusmessage\ControllerCode
public function add(Request $request) {
$types = $this->typeStorage
->loadMultiple();
if ($types && count($types) == 1) {
$type = reset($types);
return $this
->addForm($type, $request);
}
if (count($types) === 0) {
return array(
'#markup' => $this
->t('You have not created any %bundle types yet. @link to add a new type.', [
'%bundle' => 'Status',
'@link' => $this
->l($this
->t('Go to the type creation page'), Url::fromRoute('entity.status_type.add_form')),
]),
);
}
return array(
'#theme' => 'status_content_add_list',
'#content' => $types,
);
}