Categories
CMS Drupal Mastering Development

How do I add a button with a custom redirect to a node view?

I’d like to add a "More info" button to the bottom of a node view. The button should redirect the user to a URL based on the current node, e.g. node/1/info: /** * Implements hook_node_view * * Add the "More Info" button to idea content */ function implementations_node_view(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) { […]

Categories
Mastering Development

Azure Function writing to CosmosDB and error handling

I have written an Azure Function that persists data to a Cosmos collection: const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> { try { if (req.body) { const body: Body = req.body context.bindings.cosmosDocument = JSON.stringify(body); context.res = { status: 200, body: ‘Successfully persisted document’ }; } } catch (error) { context.res = […]