public function OrgAddController::add in RedHen CRM 8
Displays add links for available bundles/types for entity redhen_org .
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request object.
Return value
array A render array for a list of the redhen_org 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/
redhen_org/ src/ Controller/ OrgAddController.php, line 47
Class
- OrgAddController
- Class OrgAddController.
Namespace
Drupal\redhen_org\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 [
'#markup' => $this
->t('You have not created any %bundle types yet. @link to add a new type.', [
'%bundle' => 'Org',
'@link' => Link::createFromRoute($this
->t('Go to the type creation page'), 'entity.redhen_org_type.add_form'),
]),
];
}
return [
'#theme' => 'redhen_org_content_add_list',
'#content' => $types,
];
}