This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Block Filters
Jon McPartland edited this page Jan 15, 2019
·
1 revision
Starting with version 1.1.0 of Benenson, there are filters for modifying some of the available attributes for most of the Gutenblocks bundled with the theme. These are described below.
Filters can be added in your child theme in the following way:
const { __ } = wp.i18n;
const { addFilter } = wp.hooks;
addFilter('benenson.block.blockName.arrayOptionType', 'benenson', (options) => {
const newOptions = [...options];
newOptions.push({
label: __('New Option Name', 'benenson-child'),
value: 'new-option-value',
});
return newOptions;
});
addFilter('benenson.block.blockName.objectOptions', 'benenson', options => Object.assign({}, options, {
prop: 'value',
}));
- Action
- Appearance
- Blockquote
- Call to Action
- Columns
- Header
- Image
- Key Facts
- Link Block
- Links with Icons
- Logo List
- Menu
- Post List
- Section
- Slider
- Tweet Action
-
benenson.block.action.sizeOptions
Controls the width of the block.
// Initial Values:
[{
// Default.
label: __('Standard', 'benenson'),
value: 'standard',
}, {
label: __('Wide', 'benenson'),
value: 'wide',
}]
-
benenson.block.appearance.navigationOptions
Controls the types of background available on the navigation bar.
// Initial Values:
[{
// Default.
label: __('Global', 'benenson'),
value: 'global',
}, {
label: __('White', 'benenson'),
value: 'transparent-light',
}, {
label: __('Black', 'benenson'),
value: 'transparent-dark',
}]
-
benenson.block.appearance.thumbnailOptions
Controls the sizes of thumbnail available to be displayed on the blog index.
Visible only on thepost
post type.
// Initial Values:
[{
label: __('Half size', 'benenson'),
value: 'small',
}, {
label: __('Full Background', 'benenson'),
value: 'full',
}]
-
benenson.block.blockquote.sizeOptions
Controls the size options available for the block.
// Initial Values:
[{
label: __('Small', 'benenson'),
value: 'small',
}, {
label: __('Medium', 'benenson'),
value: 'medium',
}, {
// Default.
label: __('Large', 'benenson'),
value: '',
}]
-
benenson.block.blockquote.colorOptions
Controls the font colours available. Note: US English spelling.
// Initial Values:
[{
// Default.
label: __('Black', 'benenson'),
value: '',
}, {
label: __('Grey', 'benenson'),
value: 'grey',
}, {
label: __('White', 'benenson'),
value: 'white',
}]
-
benenson.block.cta.backgroundOptions
Controls the background colours available.
// Initial Values:
[{
// Default.
label: __('Light', 'benenson'),
value: '',
}, {
label: __('Grey', 'benenson'),
value: 'shade',
}]
-
benenson.block.cta.buttonOptions
Controls the button colours available.
// Initial Values;
[{
// Default.
label: __('Primary', 'benenson'),
value: '',
}, {
label: __('Dark', 'benenson'),
value: 'dark',
}, {
label: __('Light', 'benenson'),
value: 'white',
}]
-
benenson.block.columns.layouts
Controls the layout types available.
// Initial Values:
{
// Default.
'1/2|1/2': {
name: __('50% | 50%', 'benenson'),
icon: '',
columns: 2,
},
'2/3|1/3': {
name: __('66.6% | 33.3%', 'benenson'),
icon: '',
columns: 2,
},
'1/3|2/3': {
name: __('33.3% | 66.6%', 'benenson'),
icon: '',
columns: 2,
},
'1/3|1/3|1/3': {
name: __('33.3% | 33.3% | 33.3%', 'benenson'),
icon: '',
columns: 3,
},
'1/2|1/4|1/4': {
name: __('50% | 25% | 25%', 'benenson'),
icon: '',
columns: 3,
},
'1/4|1/2|1/4': {
name: __('25% | 50% | 25%', 'benenson'),
icon: '',
columns: 3,
},
'1/4|1/4|1/2': {
name: __('25% | 25% | 50%', 'benenson'),
icon: '',
columns: 3,
},
'1/4|1/4|1/4|1/4': {
name: __('25% | 25% | 25% | 25%', 'benenson'),
icon: '',
columns: 4,
},
}
-
benenson.block.header.alignmentOptions
Controls the alignment options available for the content within the block.
// Initial Values:
[{
label: __('Left', 'benenson'),
value: 'left',
}, {
// Default.
label: __('Centre', 'benenson'),
value: 'center',
}, {
label: __('Right', 'benenson'),
value: 'right',
}]
-
benenson.block.header.bgColorOptions
Controls the background colours available when no background image is set.
// Initial Values:
[{
// Default.
label: __('Translucent black', 'benenson'),
value: '',
}, {
label: __('None', 'benenson'),
value: 'none',
}, {
label: __('White', 'benenson'),
value: 'light',
}, {
label: __('Black', 'benenson'),
value: 'dark',
}]
-
benenson.block.header.bgTypeOptions
Controls the background types available.
// Initial Values:
[{
// Default.
label: __('Image', 'benenson'),
value: '',
}, {
label: __('Video', 'benenson'),
value: 'video',
}]
-
benenson.block.header.sizeOptions
Controls the background sizes available.
// Initial Values:
[{
// Default.
label: __('Normal', 'benenson'),
value: '',
}, {
label: __('Small', 'benenson'),
value: 'small',
}]
-
benenson.block.image.styleOptions
Controls the height options available.
// Initial Values:
[{
label: __('Fixed Height (600px)', 'benenson'),
value: 'fixed',
}, {
// Default.
label: __('Actual Height', 'benenson'),
value: 'loose',
}]
-
benenson.block.image.alignmentOptions
Controls the image alignment options. Only affects images that are smaller than the container width.
// Initial Values:
[{
// Default.
label: __('Default', 'benenson'),
value: 'default',
}, {
label: __('Left', 'benenson'),
value: 'left',
}, {
value: 'centre',
label: __('Centre', 'benenson'),
}, {
label: __('Right', 'benenson'),
value: 'right',
}]
-
benenson.block.keyFacts.backgroundOptions
Controls the background colours available.
// Initial Values:
[{
// Default.
label: __('None', 'benenson'),
value: '',
}, {
label: __('Grey', 'benenson'),
value: 'very-light-gray',
}]
-
benenson.block.keyFacts.quantityOptions
Controls the quantity of facts that can be added in an instance of the block.
// Initial Values:
{
min: 1,
max: 4,
}
-
benenson.block.link.styleOptions
Controls the button styles available.
// Initial Values:
[{
// Default.
label: __('Primary', 'benenson'),
value: '',
}, {
label: __('Primary Outline', 'benenson'),
value: 'btn--primaryOutline',
}, {
label: __('Primary Solid', 'benenson'),
value: 'btn--primarySolid',
}]
-
benenson.block.link.iconOptions
Controls the icons available.
// Initial Values:
[{
// Default.
label: __('None', 'benenson'),
value: '',
}, {
label: __('Up arrow', 'benenson'),
value: 'icon--upArrow',
}, {
label: __('Down arrow', 'benenson'),
value: 'icon--downArrow',
}]
-
benenson.block.link.alignmentOptions
Controls the link alignments available.
[{
// Default.
label: __('Left', 'benenson'),
value: 'u-textLeft',
}, {
label: __('Center', 'benenson'),
value: 'u-textCenter',
}, {
label: __('Right', 'benenson'),
value: 'u-textRight',
}]
-
benenson.block.linksWithIcons.backgroundOptions
Controls the block container background colour options.
// Initial Values:
[{
// Default.
label: __('None', 'benenson'),
value: '',
}, {
label: __('Grey', 'benenson'),
value: 'very-light-gray',
}]
-
benenson.block.linksWithIcons.orientationOptions
Controls the block orientations available.
// Initial Values:
[{
// Default.
label: __('Horizontal', 'benenson'),
value: 'horizontal',
}, {
label: __('Vertical', 'benenson'),
value: 'vertical',
}]
-
benenson.block.linksWithIcons.quantityOptions
Controls the quantity of items available per block instance.
// Initial Values:
{
min: 1,
max: 4,
}
-
benenson.block.linksWithIcons.styleOptions
Controls an item's available layout types.
// Initial Values:
[{
// Default.
label: __('Use Image', 'benenson'),
value: 'icon',
}, {
label: __('Use Text', 'benenson'),
value: 'text',
}, {
label: __('Plain', 'benenson'),
value: 'none',
}]
-
benenson.block.linksWithIcons.sizeOptions
Controls the size of an item's image. Visible only when style type is set to icon.
// Initial Values:
[{
label: __('Small', 'benenson'),
value: 'small',
}, {
// Default.
label: __('Medium', 'benenson'),
value: 'medium',
}, {
label: __('Large', 'benenson'),
value: 'large',
}]
-
benenson.block.logoGroup.backgroundOptions
Controls the background colours available for the container.
// Initial Values:
[{
// Default.
label: __('None', 'benenson'),
value: '',
}, {
label: __('Grey', 'benenson'),
value: 'very-light-gray',
}]
-
benenson.block.logoGroup.quantityOptions
Controls the quantity of logos available in a block instance.
// Initial Values:
{
min: 1,
max: 10,
}
-
benenson.block.logoGroup.sizeOptions
Controls the logo image sizes available.
// Initial Values:
[{
// Default.
label: __('Small', 'benenson'),
value: 'small',
}, {
label: __('Medium', 'benenson'),
value: 'medium',
}, {
label: __('Large', 'benenson'),
value: 'large',
}]
-
benenson.block.menu.colorOptions
Controls the available background colours for the menu's container. Note: US English spelling.
// Initial Values:
[{
// Default.
label: __('White', 'benenson'),
value: '',
}, {
label: __('Grey', 'benenson'),
value: 'dark',
}]
-
benenson.block.list.styleOptions
Controls the available layout styles.
// Initial Values:
[{
// Default.
label: __('Link List', 'benenson'),
value: 'list',
}, {
label: __('Grid', 'benenson'),
value: 'grid',
}, {
label: __('Post', 'benenson'),
value: 'post',
}, {
label: __('Split Grid', 'benenson'),
value: 'splitgrid',
}]
-
benenson.block.list.typeOptions
Controls the sources available.
// Initial Values:
[{
// Default.
label: __('Category', 'benenson'),
value: 'category',
}, {
label: __('Object Selection', 'benenson'),
value: 'select',
}, {
label: __('Custom', 'benenson'),
value: 'custom',
}]
-
benenson.block.list.quantityOptions
Controls the quantity of posts that can be added per instance.
// Initial Values:
{
min: 1,
max: 8,
}
-
benenson.block.section.backgroundOptions
Controls the available section background colours.
// Initial Values:
[{
// Default.
label: __('White', 'benenson'),
value: '',
}, {
label: __('Grey', 'benenson'),
value: 'grey',
}]
-
benenson.block.section.paddingOptions
Controls the vertical padding options available.
// Initial Values:
[{
// Default.
label: __('Normal', 'benenson'),
value: '',
}, {
label: __('Small', 'benenson'),
value: 'small',
}, {
label: __('None', 'benenson'),
value: 'no-padding',
}]
-
benenson.block.section.widthOptions
Controls the available container width options.
// Initial Values:
[{
// Default.
label: __('Normal', 'benenson'),
value: '',
}, {
label: __('Narrow', 'benenson'),
value: 'narrow',
}, {
label: __('Wide', 'benenson'),
value: 'wide',
}]
-
benenson.block.slider.backgroundOptions
Controls the background styles available for the content within a slide.
// Initial Values:
[{
// Default.
label: __('Opaque', 'benenson'),
value: '',
}, {
label: __('Translucent', 'benenson'),
value: 'opaque',
}, {
label: __('Transparent', 'benenson'),
value: 'transparent',
}]
-
benenson.block.slider.alignmentOptions
Controls the slide's content alignment options.
// Initial Values:
[{
// Default.
label: __('Left', 'benenson'),
value: '',
}, {
label: __('Centre', 'benenson'),
value: 'center',
}, {
label: __('Right', 'benenson'),
value: 'right',
}]
-
benenson.block.tweet.sizeOptions
Controls the available widths for the block.
// Initial Values:
[{
// Default.
label: __('Default', 'benenson'),
value: '',
}, {
label: __('Narrow', 'benenson'),
value: 'narrow',
}]