Composables
The composable provided by the module provides helpers to fetch page and menu data, handle errors, and render custom components.
useDrupalCe
This function exports a collection of utility methods to fetch data from drupal-ce.
List of methods:
fetchPage(path, query)
- Fetches a page by path.fetchMenu(name)
- Fetches a menu by name.getMessages()
- Returns the Drupal messages of the current page.renderCustomElement(elements)
- Renders one or multiple custom elements, when using JSON serialization.
Example usage
The following examples makes use of the fetchPage
method to get the current page:
<script setup>
const { fetchPage } = useDrupalCe()
const page = await fetchPage(useRoute().path)
</script>
Table of Contents