What is extension?

Extension allows developers to change behaviour of certain things in core module. We have many hooks that provide a lot of posibilities.

Base structure

When we are creating own extension - we should use Typescript. However, it is not obligatory. Example starter:

import { WPExtension } from '@vue-wordpress/core/plugin/extension'

const plugin: WPExtension = {
  // ...

export default plugin

What keys do we have inside?

interface WPExtension {
  blocks?: Block,
  layouts?: Layouts,
  middleware?: {
    api?: {
      [propName: string]: (value: any) => any
    root?: {
      validator?: ValidatorFunc,
      interpret?: (value: any, chosenSection: String | Object, h: Function) => Array<any>
    section?: {
      interpret?: (data: any) => { columns: Array<any>, anyFilledColumn: Boolean, columnAmount: Number }

We will deep in possible hooks more in further parts.