public function FeedbackMessageAddController::add in Feedback 3.x
Displays add links for available bundles/types for entity feedback_message.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request object.
Return value
array A render array for a list of the feedback_message 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
- src/
Controller/ FeedbackMessageAddController.php, line 54
Class
- FeedbackMessageAddController
- Class FeedbackMessageAddController.
Namespace
Drupal\feedback\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' => 'Feedback message',
'@link' => Link::fromTextAndUrl($this
->t('Go to the type creation page'), Url::fromRoute('entity.feedback_message_type.add_form')),
]),
];
}
return [
'#theme' => 'feedback_message_content_add_list',
'#content' => $types,
];
}