API Documentation
DruxtBlockRegion
Modules
- DruxtBlockRegion
The DruxtBlockRegion component renders visible blocks based on region and theme.
All blocks, including those not visible, are provided as slots for the Druxt Wrapper component.
Typedefs
- ComponentOptions :
Array.<array>
Provides the available naming options for the Wrapper component.
- PropsData :
object
Provides propsData for use in the Wrapper component.
- ScopedSlots :
object
Provides scoped slots for use in the Wrapper component.
DruxtBlockRegion
The DruxtBlockRegion component renders visible blocks based on region and theme.
All blocks, including those not visible, are provided as slots for the Druxt Wrapper component.
Example
<DruxtBlockRegion name="header" theme="umami" />
Example (DruxtBlockRegion Wrapper component boilerplate)
<template>
<DruxtDebug :json="blocks" />
</template>
<script>
import { DruxtBlocksRegionMixin } from 'druxt-blocks'
export default {
mixins: [DruxtBlocksRegionMixin]
}
Example (DruxtBlockRegion with template injection)
<DruxtBlock id="umami_branding">
<template #default="{ block }">
<!-- Do whatever you want here -->
<DruxtDebug :json="block" />
</template>
</DruxtBlock>
- DruxtBlockRegion
boolean
.isVisible(block) ⇒ Checks if a given block shoud be visible.
Uses Request Path visibility details if available with the DruxtRouter.
Kind: instance method of DruxtBlockRegion
Param | Type | Description |
---|---|---|
block | object | The Block entity object. |
.props
Kind: static property of DruxtBlockRegion
string
.name : The Block regions machine name.
Kind: static property of props
Default: "content"
Example
<DruxtBlockRegion name="header" :theme="theme" />
string
.theme : A Drupal theme machine name.
Kind: static property of props
Required:
Example
<DruxtBlockRegion theme="umami" />
.langcode
The resource langcode.
Kind: static property of props
Example
<DruxtBlockRegion langcode="en" />
.v-model
The module component model value.
Used to bypass the Drupal JSON:API fetch, setting the module data directly.
Kind: static property of props
Example
<DruxtBlockRegion v-model="{ foo: bar }" />
.wrapper
The wrapper component configuration.
Used to set the wrapper component, class, style and propsData.
Kind: static property of props
Example
<DruxtBlockRegion
:wrapper="{
component: 'MyWrapper',
class: 'wrapper',
propsData: { foo: 'bar' }
}"
/>
.computed
Kind: static property of DruxtBlockRegion
object
.route : The current Route from the DruxtRouter vuex store.
Kind: static property of computed
.druxt
DruxtModule configuration.
Kind: static property of DruxtBlockRegion
.template
Druxt development template tool configuration.
Kind: static property of druxt
ComponentOptions
.componentOptions(context) ⇒ Provides the available component naming options for the DruxtWrapper.
Kind: static method of druxt
Param | Type | Description |
---|---|---|
context | object | The module component ViewModel. |
.fetchConfig()
Fetches all blocks by region and theme.
Kind: static method of druxt
PropsData
.propsData(context) ⇒ Provides propsData for the DruxtWrapper.
Kind: static method of druxt
Param | Type | Description |
---|---|---|
context | object | The module component ViewModel. |
ScopedSlots
.slots() ⇒ Provides the scoped slots object for the Module render function.
A scoped slot is provided for each block in the region, regardless of visibility.
The default
slot will render all blocks, filtered by route visibility.
Kind: static method of druxt
Returns: ScopedSlots
- The Scoped slots object.
Example (DruxtBlockRegionName.vue)
<template>
<div v-if="default">
<slot />
</div>
<div v-else>
<slot name="umami_branding" />
</div>
</template>
.data()
Kind: static method of DruxtBlockRegion
Properties
Name | Type | Description |
---|---|---|
blocks | Array.<objects> | The Block JSON:API resources. |
Array.<array>
ComponentOptions : Provides the available naming options for the Wrapper component.
Kind: global typedef
Example
[
'DruxtBlockRegion[Name][Theme][Langcode]',
'DruxtBlockRegion[Name][Theme]',
'DruxtBlockRegion[Name][Langcode]',
'DruxtBlockRegion[Name]',
'DruxtBlockRegion[Default][Langcode]',
'DruxtBlockRegion[Default]',
]
Example (Banner top - Umami)
[
'DruxtBlockRegionBannerTopUmamiEn',
'DruxtBlockRegionBannerTopUmami',
'DruxtBlockRegionBannerTopEn',
'DruxtBlockRegionBannerTop',
'DruxtBlockRegionDefaultEn',
'DruxtBlockRegionDefault',
]
object
PropsData : Provides propsData for use in the Wrapper component.
Kind: global typedef
Param | Type | Description |
---|---|---|
blocks | Array.<object> | The Block JSON:API resources. |
name | string | The Block regions machine name. |
theme | string | A Drupal theme machine name. |
Example
{
blocks: [{
attributes: {},
id: '59104acd-88e1-43c3-bd5f-35800f206394',
links: {},
relationships: {},
type: 'block--block',
}],
name: 'banner_top,
theme: 'umami',
}
object
ScopedSlots : Provides scoped slots for use in the Wrapper component.
Kind: global typedef
Param | Type | Description |
---|---|---|
[drupal_internal__id] | function | Slot per block. |
default | function | All blocks, filtered by route visibility. |
Example (DruxtBlockRegionName.vue)
<template>
<div v-if="default">
<slot />
</div>
<div v-else>
<slot name="umami_branding" />
</div>
</template>