Blocks
Below is a list of modified core blocks, resources for understanding the custom PMC blocks, and helpful tips and recommendations for React Component best practices.
Modified Core Blocks
Most core blocks are passed through a render callback or have some modification done to make it more useful in the PMC context. Those can be found in the builtin (opens in a new tab) directory.
All blocks would include, at minimu, an index.js which modifies some aspect of the block registration.
Some may include a block.php which would run the block through a render callback (PHP) method which allows us to modify the markup before output.
Global Core Overrides
The blocks directory contains a core-overrides class (CoreOverrides) which adds settings modifications for all core blocks.
getModifiedSettings
Get the settings object with block-specific modifications or the defualt modifications object.
name: string — Block name.settings: Object — Block settings.
Modifing a Block's Settings Object
- Add a
settings.jsfile to the builtin block directory which exports a settings object. - Import the settings object and add to the switch in the
getModifiedSettingsfunction.
Each block should contain a block.json which may contain overrides accessed in the settings.js file.
Additionally, any modifications should be passed through a settings function and returned to the core-overrides method.
Custom Blocks
All custom blocks can be found here (opens in a new tab) grouped by brand or feature.
The global directory includes blocks that are available to all brands.
Localize Block Script
Blocks uses enqueue_block_editor_assets filter to localize the config/data. Each block either contains JSON config in src/config/brands or block.php has a get_block_config method which is implemented from With_Config interface.
Theme Settings Data To Use in Block
Themes can filter configuration for Gutenberg blocks. To pass data to blocks, pmc_gutenberg_[BLOCK_NAME]_block_config filter hook can be used inside theme's pmc-gutenberg.php configuration file. In both JS & PHP, [BLOCK_NAME] will be used in snake_case (e.g block_name, post_excerpt).
For example:
add_filter( 'pmc_gutenberg_block_name_block_config', [ $this, 'filter_pmc_gutenberg_block_name_block_config' ] );
/**
* Add block configuration to global block configuration.
*
* @param array $blocks_config Block configuration.
* @return array Updated block configuration.
*/
public function filter_pmc_gutenberg_block_name_block_config( array $blocks_config ) : array {
return array_merge(
$blocks_config,
[
'sample_data' => 'something',
]
);
}Now the relavent data can be localized to JS files and can be accessed by blocks using getBlockConfigKey & getBlockConfig functions from src/config/localized-scripts.js. To pass the data key, pmc/ suffix needs to be added.
For Example:
/**
* Internal dependencies.
*/
import { getBlockConfig } from '../services/localize-script';
const getData = getBlockConfig( 'pmc/`block_name`' );Components
The pmc-gutenberg plugin contains many reusable components in the src/components (opens in a new tab) directory.
Building Components
A component should be added when the render contains bit of functionality or markup is intended to be or is reused. They should be accompanied by documentation providing any information about the feature, usage, and props.
See the coding standards documentation.
Profile Landing Page
Class for Profile_Landing_Page block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Story Influencers
Registers the pmc/story-influencers block.
- Extends: Story_Block_Engine
Top200
Class for Top200 block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Additional Related Content
Class for Additional_Related_Content block.
- Extends: Block_Base
- Implements: With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Core Button
Registers the core/button block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Core Column
Registers the core/column block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
build_custom_colors_style
Return the Styles if the Custom Colors are to be used for Borders.
$replacement: string — Replacement String for Column Block.$attrs: array — Array of Block Attributes.$styles: array — Array of Styles.
settings
Modifies the settings object for the core/column block.
defaults: Function — Settings defaults.
Core Columns
Registers the core/columns block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
settings
Modifies the settings object for the core/columns block.
defaults: Object — Default settings object.
CoreOverrides
External dependencies. /import { pick } from 'lodash';// Issues with the import verification in some IDEs, ignore.// eslint-disable-next-line import/no-extraneous-dependenciesimport merge from 'deepmerge';/ WordPress dependencies.
settings
Modifies the settings object for the core/column block.
defaults: Object — Settings object.
Core Group
Registers the core/group block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
settings
Modifies the settings object for the core/group block.
defaults: Function — Settings defaults.
Core Heading
Registers the core/heading block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
modify_content_inline_styles
Modify the content and add a style attribute if custom colors are chosen.
$content: string — Block content.$attrs: array — Block attributes.$classes: array — Block Style Classes.
settings
Modifies the settings object for the core/heading block.
defaults: Object — Default settings object.
Core Image
Registers the core/image block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
settings
Modifies the settings object for the core/column block.
defaults: Function — Settings defaults.
Core List
Registers the core/list block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Core Navigation
Registers the core/navigation block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
_build_model_class_attributes_for_gutenberg_ui
Generate style and classes from block attributes. Support styles and classes in the Gutenberg UI. This support is considered patchy. Ideally we would use the core/navigation block's HTML render.
$attrs: array — Block attributes.$key: string — Key for the objects we're mapping to.$supports: array — Array of block attribute keys to parse.
_populate_menu_items
Populate array of menu-item component data.
$attributes: array — Navigation block attributes.
_populate_submenu_items
Populate array of submenu items.
$menu_item: array — Navigation submenu block attributes.
removeDisplayOptions
Remove the panel if the display element exists along with the overlay menu value.
Core Paragraph
Registers the core/paragraph block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
modify_content_inline_styles
Modify the content and add a style attribute if custom colors are chosen.
$content: string — Block content.$inner_pattern: string — Regex to match Inner HTML.$inner_html: string — Inner HTML Content.$attrs: array — Block attributes.$classes: array — Block Style Classes.
isRichTextFormatRegistered
Function to check if RichText format is registered or not.
format: string — RichText format type.
registerExtendedControlFormats
Function to register all paragraph extended controls.
settings
Modifies the settings object for the core/paragraph block.
defaults: Function — Settings defaults.
Core Post Excerpt
Class for Post_Excerpt block.
- Extends: Block_Base
- Implements: Without_Render_Callback, With_Config
get_block_config
Return block specific configs.
settings
Modifies the settings object for the core/post-excerpt block.
defaults: Function — Settings defaults.
Core Pullquote
Registers the core/pullquote block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
settings
Modifies the settings object for the core/pullquote block.
defaults: Function — Settings defaults.
Core Separator
Registers the core/separator block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
settings
Modifies the settings object for the core/separator block.
defaults: Function — Settings defaults.
settings
Modifies the settings object for the core/spacer block.
registerProsAndConsVariation
Function to register props and cons variations.
Dirt Details
Class for Dirt_Details block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Pilot Details
Class for Pilot_Details block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Pilot Item
Class for Pilot_Item block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Pilots
Class for Pilot block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Ad
Registers the pmc/ad block.
- Extends: Block_Base
- Implements: With_Dependencies, With_Render_Callback, With_Nova_Render_Callback
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
get_dependent_classes
Specify classes that must be loaded for this block to be available.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Bottom Block
Registers the pmc/bottom-block block.
- Extends: Block_Base
- Implements: With_Render_Callback, With_Config
pmc_vertical_is_enabled
Wrap this in a filter so we can properly test methods that use it.
apply_dynamic_category_block_defaults
Filter the default bottom blocks to determine if the pmc/post-term-selector or pmc/breadcrumbs block should be used (based on the pmc-vertical plugin).
$blocks: array — Default blocks.
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
get_block_config
Return block specific configs.
Filters
pmc_gutenberg_default_bottom_blocks
Filter default bottom blocks array.
$blocks: array — default top blocks.$post_type: string — post type slug.
Breadcrumbs
Class for Breadcrumbs block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Buy Now
Class for Buy_Now block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
filter_pmc_buy_now_data
Filter to override buy now template.
$buy_now_data: array — Buy now shortcode data.
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.$is_nova: boolean — Used by nova to determine output.
get_supported_attributes
Get only supported attributes from an array of data for a shortcode.
$data: array — array of shortcode attributes for the buy-now button.$shortcode: string — shortcode slug.
Filters
pmc_filter_buy_now_supported_attributes
Filter the supported buy now shortcode attributes.
$supported_attributes: array — Array of supported attributes.
get_shortcode_attributes_string
Turn attributes array into string of shortcode attributes.
$attributes: array — array of key/value pairs for buy-now shortcode.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Buy Now Button
Class for Buy_Now_Button block. NOTE: This block exists as a placeholder for the block editor and does not output anything. Attributes are passed to the parent and rendered there.
- Extends: Block_Base
- Implements: Without_Render_Callback, With_Config
get_block_config
Return block specific configs.
Byline Block
This block allows a user to manage the byline and additional sets of users.
This block cannot be inserted, and must be included as part of a template.
Variations
In addition to the byline, our brands sometimes require additional sets of CoAuthors Plus authors to provide accurate attributation for contributions to content.
We currently support three versions of the block,
byline- Default variation. The custom CoAuthors Plus store is leveraged for data management. Also saved as an array of slugs under theauthorskey.contributors- Stored as an array of CoAuthors Plus author slugs. Accessible using thecontributorsmeta key.additionalAuthors- Stored as an array of CoAuthors Plus author slugs. Accessible using thestyled_bymeta key.
Development
- To create a new variation, update
variations.js. See existing examples for reference. - Expose your new meta key in
classes/class-meta.php.
By default, any new variations will store slugs in post meta using the value of metaKey.
determineDisabledRowUIState
Determine the UI states for a given author row in the authors selection component.
props: Object — Current index for the list.props.index: number — Current index for the list.props.numberOfAuthors: number — Total number of rows.props.canBeEmpty: number — Are we allowed to delete the last entry.
Byline
Registers the pmc/byline block.
- Extends: Block_Base
- Implements: With_Dependencies, With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
get_byline_markup
Render bylines.
_get_coauthor_markup_by_slugs
Get HTML markup for a given list of CAP author slugs. Output can be customized using the $format parameter.
$slugs: array — Array of CAP author slugs.$format: null|string — Optional. A format string forsprintf().
get_dependent_classes
Specify classes that must be loaded for this block to be available.
getVariationTitleBySlug
Helper to get the title of a variation.
variantSlug: string — Variation slug.
moveItem
Move an item up or down in an array.
targetItem: string — Item to move.itemsArr: Array — Array in which to move the item.direction: string — 'up' or 'down'.
removeItem
Remove an item from the array.
targetItem: Object — Target item object.itemsArr: Array — Array of items.
addItemByValue
Get the author object from the list of available authors, then add it to the selected authors.
newAuthorValue: string — New author string.currAuthors: Array — Current authors array.dropDownAuthors: Array — Authors in the dropdown.
formatAuthorData
Format the author option object.
props: Object — An author object from the API endpoint.props.displayName: Object — Name to display in the UI.props.userNicename: Object — The unique username.props.email: Object — Email string.
Callout
Registers the pmc/callout block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Carousel
Registers the pmc/carousel block.
- Extends: Block_Base
- Implements: With_Dependencies, With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
_render_carousel_grid
Retrieve data for Carousel Grid.
$num_posts: int — Number of posts to render.
_nova_render_feature_cards
Retrieve data for Nova feature cards.
$num_posts: int — Number of posts to render.$layout: string — Featured cards layout.stackorinline.
_nova_render_gallery
Retrieve data for Nova gallery style.
_nova_render_story_river_cards
Retrieve data for Nova story river style.
$num_posts: int — Number of posts to render.
_nova_render_news_river_cards
Retrieve data for Nova news river style.
$num_posts: int — Number of posts to render.
_render_gallery
Retrieve data for gallery style.
_render_inline_video
Retrieve data for inline-video-player style.
_render_story_river
Retrieve data for story-river style.
$num_posts: int — Number of Posts to Render.
_render_news_river
Retrieve data for news-river style.
$num_posts: int — Number of posts.
Filters
pmc_gutenberg_story_grid_render_news_river
Allow theme to override.
$title: string — news river title.$posts: array — array of posts.$attributes: array — array of block attributes.
_get_carousel_posts
Retrieve PMC Carousel posts for rendering with different modules/variations.
$qty: int — Number of posts to retrieve.
_get_featured_videos
Get featured videos in playlist.
get_dependent_classes
Specify classes that must be loaded for this block to be available.
ItemsPreview
Items preview component.
props: Object — Props object.props.items: Array — Items array.props.curationTaxonomy: string — Curated taxonomy string.props.currentStyleName: string — Style slug.
Collapsable
Class for Collapsable block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Fact List
Class for Fact_List block.
- Extends: Block_Base
- Implements: With_Render_Callback
_format_dl_content
Formats the description list content into HTML markup.
$attrs: array — Block attributes.$content: string — Block content.
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Fact List Item
Class for Fact_List_Item block.
- Extends: Block_Base
- Implements: With_Render_Callback
_generate_dd_markup
Generate the dd markup for given content, itemtype, itemprop, and term markups.
$attrs: array — Block attributes.$content: string — String inner block content.
_generate_dt_markup
Generate the dt markup for a given dt content.
$attrs: array — Block attributes.
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Fact List Menu
Class for Fact_List_Menu block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Faq
Class for Faq block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Faq Item
Class for Faq_Item block.
- Extends: Block_Base
- Implements: With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Featured Article Inline Gallery
Class for Featured_Article_Inline_Gallery block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
enqueue_assets_for_inline_featured_gallery
Enqueue scripts for inline gallery.
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Video Information
We were supposed to create a new feature or it would be correct to say need to replicate the existing video information metabox from classic-editor to Gutenberg block-editor. So for this, we decided to leverage the existing featured-media block UI to get the work done with ease.
- Video-information block is only allowed for all video post-types only.
- This feature is rendered based on post-type rather than not counting on a different variation of featured-media block.
- Supports for this feature can be edited through config.js file.
- To enable this support just ensure that the featured-media block is added in the brand config file and that post-type needs to be set true in config.js with its supported source and duration meta keys.
config.js -> Contains the different post-types source and duration meta keys needed to set by this variation to set the information of video just the classic editor.
video-information.js -> Component that renders the video-information block/UI to allow the users to set the source and duration fields to get them listed on the front-end
edit.js -> Main component that merges the video-information feature with existing featured-media.
Featured Media
Registers the pmc/featured-media block.
- Extends: Block_Base
- Implements: With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
useGetAttachment
Hooks for the featured image attachment and attachment ID.
Inline Gallery Slider With Text
Registers the pmc/inline-gallery-slider-with-text block. Render inline gallery with accompanying rich text.
- Extends: Block_Base
- Implements: With_Larva_Data
register_image_sizes
Register image sizes for this block.
set_image_aspect_ratios
Specify aspect ratio for custom image sizes.
$editor_args: array — Thumbnail editor arguments.
larva_data
Populate Larva data.
$block_content: string — The block content about to be appended.$block: array — The full block, including name and attributes.
_get_gallery_ids
Extract image IDs from gallery block. Prior to WP 5.9, IDs were available in the gallery block's attributes under an ids key. Starting with WP 5.9, IDs must be extracted from the image blocks contained within the gallery.
$inner_blocks: array — Blocks nested within our custom block.
JW Player
Registers the pmc/jw-player block.
- Extends: Block_Base
- Implements: With_Render_Callback
remove_legacy_admin_items
Suppress JW Player's legacy metabox when post type supports our block.
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
_id_is_valid
Validate a video, playlist, or player ID using same regex pattern applied by JW Player's shortcode.
$id: string — ID to check.
Kicker
Registers the pmc/kicker block.
- Extends: Block_Base
- Implements: With_Render_Callback, With_Config
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
render_kicker
Renders the kicker block in the theme template. This is separate from the render_callback, because the kicker block is edited in the Top Block, but gets rendered in the single.php template.
$variant: string — Default Kicker variant to load.
Filters
pmc_kicker_meta
Filter to modify kicker meta.
get_badge_options
Get badge options from theme config.
filter_pmc_gutenberg_register_meta_config
Set meta config required to register the meta key.
$config: array — Meta config.$meta_key: string — Meta key in use.
get_block_config
Return block specific configs.
Linked Gallery
Registers the pmc/linked-gallery block.
- Extends: Block_Base
- Implements: With_Render_Callback, With_Nova_Render_Callback, With_Config
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
render_linked_gallery
Render linked gallery block varition.
render_gallery_slider
Render gallery slider block variation.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
get_block_config
Return block specific configs.
SliderPreview
Gallery preview function for gallery slider variation of linked gallery block.
props: Object — Root props.props.galleryImages: Array — Gallery images to loop through for preview.
List Item
Class for List_Item block.
- Extends: Block_Base
- Implements: Without_Render_Callback
List Items
Class for List_Items block.
- Extends: Block_Base
- Implements: Without_Render_Callback
One Off
Registers the pmc/one-off block.
- Extends: Block_Base
- Implements: With_Render_Callback
localize_data
Expose the one off data for usage by the block JavaScript.
set_theme_one_offs
Set the one offs.
$theme_one_offs: array — Array of one offs.
set_theme_one_offs_template_path
Set the template path.
$path: string — New path.
get_theme_one_offs_template_path
Get the template path.
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
formatSelectOptions
Get selection options from config.
themeConfig: Array — Theme config array.
Post Date
Registers the pmc/post-date block.
- Extends: Block_Base
- Implements: Without_Render_Callback
rest_after_insert
Rest handling for this block.
$prepared_post: \stdClass — An object representing a single post prepared for inserting|updating the database.
get_manual_date
Get the manualDate value from the pmc/post-date block.
$prepared_post: \WP_Post — save post object.
Post Term Selector
Class for Post_Term_Selector block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Post Title
Class for Post_Title block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Preview Auto Injected Content
Registers the pmc/preview-auto-injected-content block.
- Extends: Block_Base
- Implements: Without_Render_Callback, With_Config
filter_block_categories
Add new block category.
$block_categories: array — Array of registered block categories.
get_block_config
Return block specific configs.
stopPreview
Disables the preview of blocks.
startPreview
Adds blocks on toggle active.
createPreviewBlock
Create preview for block.
blockType: string — Block type.count: int — Count value.
getTrendingTargetIndex
Get target index for the trending preview block.
blocks: Array — List of blocks.trending: Object — Trending block config.
getTargetingIndex
Get target index for the number of paragraphs.
paragraphs: Array — Paragraph blocks objects.charLimit: int — Character limit.
getBlockIndex
Get a block index for a given name.
blocks: Array — Array of current blocks.blockType: string — Block type slug.index: int — Current index.
updateAdBlockPosition
Update ad block position by index.
blocks: Array — Array of blocks.targetIndex: int — Target index of insertion.existingIndex: int — Existing index of block.count: int — Number of blocks to insert.
updateRelatedBlockPosition
Update Related block position.
blocks: Array — Array of blocks.targetIndex: int — Target index of insertion.existingIndex: int — Existing index of block.AdTargetIndex1: int — Ad index 1.
updateTrendingBlockPosition
Updates the position of the trending preview block.
blocks: Array — Post Blocks.existingIndex: int — Existing index of the preview block.trendingConfig: Object — Trending block config.
Pros And Cons
Class for Pros_And_Cons block.
- Extends: Block_Base
- Implements: With_Render_Callback, With_Nova_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
get_list_markup
Populate list block markup.
$block: \WP_Block — List Block.
_get_inner_block_data
Get inner blocks data.
$block: WP_Block — Block object.
Protected Embed Block
This block allows a user to embed iframes from allowlisted sources.
This block is mostly a Gutenberg interface that uses its attributes to generate a protected embed shortcode, as seen in the pmc-protected-embeds plugin folder.
Setup
- Ensure that the
pmc-protected-embedsplugin is being loaded. - Navigate to
Settings->Theme Settings, then to theGlobal Theme Optionstab. - Look for the
Protected embeds domain allowlist:setting, and update/modify according to the fields instructions.
Protected Embed
Class for Protected_Embed block.
- Extends: Block_Base
- Implements: With_Render_Callback
get_allowed_domains
Helper to get an array of allowed domains.
localize_allowlist
Localize the protected embed url allowlist.
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
urlAllowListed
Helper function to ensure a domain is allow listed by the theme.
source: string — The iframe source url.allowedDomains: Array — An array of allowed domain.
normalizeStyleLengthValue
Helper to normalize a length measurement. Ex. 100 => 100px 100px => 100px 100rem => 100rem 100% => 100% anything else => no change.
value: string — Raw length value.
Related Content
Registers the pmc/related-content block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback, With_Config
validate_post_type_support
Validate post type support.
$allowed_post_types: array — allowed post types for search.
update_related_links_url
Update the related links URL broken by permalink structure changes.
$linked_data: array — Related links data.
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
maybe_hide_related_content
Hide related content if the option is selected.
$items: array — Related links.
nova_render_callback
Render block via Nova Declaration must be compatible with nova interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_template_render
Template render for the nova callback and shortcode.
$related_content: array — related content array.
add_nova_related_links_template
Update the related links template for nova classic.
$template: string — default template.
get_block_config
Return block specific configs.
Reviews
Class for Reviews block.
- Extends: Block_Base
- Implements: Without_Render_Callback, With_Config
get_block_config
Return block specific configs.
getReviewTypeOptions
Get Review Type options.
generateOptions
Generate select options for the given data.
data: Object — Object to be converted to select options.
getRatingOptions
Get Rating Select Options.
getRatingOutOfOptions
Get rating out of select options.
getLabelByReviewType
Get Field Label by Review Type.
reviewType: string — Type of review.fieldName: string — Name of Field.
SEO
Registers the pmc/seo block.
- Extends: Block_Base
- Implements: Without_Render_Callback
seo_tweaks_robots_override
Robots meta tag override.
$meta_value: bool|string — Robots meta value.
get_single_page_post_title
Set title from seo meta box.
$title: array — post title.
Slug
Registers the pmc/slug block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Special Coverage
Registers the pmc/special-coverage block.
- Extends: Block_Base
- Implements: With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Special Report
Class for Special_Report block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Story
Registers the pmc/story block.
- Extends: Story_Block_Engine
set_story_blocks_config_from_theme
Function to filter the default story blocks config from the theme.
larva_data
Inject additional block-specific data.
$block_content: string — The block content about to be appended.$block: array — The full block, including name and attributes.
_get_larva_module_with_variant
Determine Larva module and variant to use. Horizontal, left, without-borders corresponds to the prototype.
$attrs: array — Block attributes.
getPostTypeSelectOptions
Get options for post type select from the config object.
blockConfig: Object — The block configuration added via localized data on window.
Story Video
Registers the pmc/story-video block.
- Extends: Story_Block_Engine
larva_data
Inject additional block-specific data.
$block_content: string — The block content about to be appended.$block: array — The full block, including name and attributes.
_add_common_data
Add post data shared across all variations.
$data: array — Larva Pattern data.
Sub Headline
Class for Sub_Headline block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Table Of Contents
Class for Table_Of_Contents block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
filter_block_editor_settings
Modify the block editor settings. Adds auto-generated anchors for headings.
$editor_settings: array — Default editor settings.$block_editor_context: WP_Block_Editor_Context — The current block editor context.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Tag List
Class for Tag_List block.
- Extends: Block_Base
- Implements: With_Render_Callback
_generate_term_markups
Generates HTML markups for given terms.
$terms_arr: array — Array of term data.
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Top Block
Registers the pmc/top-block block.
- Extends: Block_Base
- Implements: With_Render_Callback, With_Config
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
get_block_config
Return block specific configs.
Filters
pmc_gutenberg_default_top_blocks
Filter default top blocks array.
$blocks: array — default top blocks.$post_type: string — post type slug.
Transcript
Class for Transcript block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Utility Grid
Class for Utility_Grid block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Utility Grid Item
Class for Utility_Grid_Item block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Video Playlist
Class for Video_Playlist block.
- Extends: Block_Base
- Implements: With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Profile
Class for Profile block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Section Heading
Class for Section_Heading block.
- Extends: Block_Base
- Implements: With_Render_Callback, With_Nova_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Ad Unit Gallery
Class for Nova_Ad_Unit_Gallery block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards
Class for Nova_Cards block.
- Extends: Block_Base
- Implements: With_Render_Callback, With_Nova_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Card
Class for Nova_Cards_Card block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Feature
Class for Nova_Cards_Feature block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Grid
Class for Nova_Cards_Grid block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Module A
Class for Nova_Cards_Module_A block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Module C
Class for Nova_Cards_Module_C block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Multi Feature
Class for Nova_Cards_Multi_Feature block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Ribbon
Class for Nova_Cards_Ribbon block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards River
Class for Nova_Cards_River block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Row
Class for Nova_Cards_Row block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Rows
Class for Nova_Cards_Rows block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Sidebar
Class for Nova_Cards_Sidebar block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Special Coverage
Class for Nova_Cards_Special_Coverage block.
- Extends: Block_Base
- Implements: With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Stacks
Class for Nova_Cards_Stacks block.
- Extends: Block_Base
- Implements: With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Video Highlight
Class for Nova_Cards_Video_Highlight block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Video Player
Class for Nova_Cards_Video_Player block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Cards Widget
Class for Nova_Cards_Widget block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Column
Class for Nova_Column block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Ecom
Class for Nova_Ecom block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
has_product_data
Determine if the product attributes array has at least a title and current price.
$attributes: array — array of product attributes.
money_format
Prepend the dollar sign to the value if it doesn't exist.
$value: string — money value string.
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Ecom Card
Class for Nova_Ecom_Card block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Homepage Template Utility
Class for Nova_Locked_Utility block.
- Extends: Block_Base
- Implements: With_Render_Callback, With_Nova_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Hub Header
Class for Nova_Hub_Header block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Images Grid
Class for Nova_Images_Grid block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Most Commented Widget
Class for Nova_Most_Commented_Widget block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Block: Newsletter
The newsletter block for Nova is a simple placeholder with a select dropdown allowing you to select a newsletter from a pre-defined list of newsletters.json in the nova theme.
Location: pmc-nova-theme/config/nova/newsletters.js.
Options
By default the newsletter block provides the option to select a newsletter. In situations in which we want to define a newsletter, but lock the block we can leverage the "locked" attribute. If true the ability to select or reset the selection is disabled.
The name of the newsletter and description (if it exists) is always visible after selection.
Filters
A user can filter the list of newsletters using the pmc_nova_filter_newsletters filter just before
the data is localized to the global config. This has a single param, the array of configs by key.
Nova Newsletter
Class for Nova_Newsletter block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
add_newsletter_config
Localize script for accessing newsletter json.
$config: array — config script for gutenberg.
Filters
pmc_filter_nova_newsletters
Filter newsletters that can be selected in this block.
$newsletters: array — Theme's configured newsletters.
render_callback
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Promotion
Class for Nova_Promotion block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Template Utility
Class for Nova_Template_Utility block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Nova Video Playlist
Class for Nova_Video_Playlist block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
render_callback
Render block.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Content Recirculation
Class for Content_Recirculation block.
- Extends: Block_Base
- Implements: With_Render_Callback
get_selected_posts
Retrieve PMC Content Recirculation posts for rendering with different modules/variations.
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Credits
Class for Credits block.
- Extends: Block_Base
- Implements: With_Nova_Render_Callback, With_Render_Callback
set_title_from_theme
Holds default credits title to load from the theme.
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block with Nova. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Home Container Block
Registers the pmc/home-container-block block.
- Extends: Block_Base
- Implements: With_Render_Callback, With_Config
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
get_block_config
Return block specific configs.
Product Card
Class for Product_Card block.
- Extends: Block_Base
- Implements: With_Render_Callback, With_Nova_Render_Callback, With_Config
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
_get_product_data
Helper function to populate product data.
$attrs: array — Block attributes.
Filters
pmc_product_card_button_text
Filter button text output.
$button_text: string — final button text.$text: string — button text.$current_price: string — current price.$original_price: string — original price.$discount: string — discount calculated.$button_data: array — entire button data array.
get_block_config
Return block specific configs.
Story Arc
Class for Story_Arc block.
- Extends: Block_Base
- Implements: With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
get_story_arc_data
Get story arc block data.
$post_id: int — Post id to fetch related story arc data.$exclude: array — Post ids to exclude from result.
Trending Widget Block
Class for Trending_Widget_Block block.
- Extends: Block_Base
- Implements: With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Last Updated
Class for Last_Updated block.
- Extends: Block_Base
- Implements: Without_Render_Callback
update_the_last_updated_date_on_publish
Function to update the last updated date meta on post publish.
$new_status: string — Post new status.$old_status: string — Post old status.$post: object — Post object.
Multiple Products
Class for Multiple_Products block.
- Extends: Block_Base
- Implements: With_Render_Callback, With_Nova_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
nova_render_callback
Render block method for nova.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
_get_products_data
Get Products Data.
$attrs: array — Attributes.
Product Grid
Class for Product_Grid block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Product Grid Item
Class for Product_Grid_Item block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Deprecation notice
spy-faq block should not be used for any new themes, instead please use the faq block.
This block utilizes post meta rather than props due to legacy content. This limits the post to using only one FAQ block per post. Any theme (Spy) using this block should at some point move to the new block and run a CLI script to update legacy content to the new block.
Spy Faq
Class for Spy_Faq block. NOTE: This block exists as a placeholder for the block editor and does not output anything. Attributes are passed to the meta data and rendered there.
- Extends: Block_Base
- Implements: Without_Render_Callback
render_callback
Render block. Declaration must be compatible with interface.
render_faq
Renders the Spy Faq block in the theme template. This is separate from the render_callback, because the Spy block is edited as a Block, but gets rendered in the single.php template.
$variant: string — Default Faq variant to load.
check_faq_block
Checks if the block exists and removes the meta fields, if the block has been removed.
Deprecation notice
spy-faq-item block should not be used for any new themes, instead please use the faq-item block.
This block utilizes post meta rather than props due to legacy content. This limits the post to using only one FAQ block per post. Any theme (Spy) using this block should at some point move to the new block and run a CLI script to update legacy content to the new block.
Spy Faq Item
Class for Spy_Faq_Item block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Stylized Review
Class for Stylized_Review block.
- Extends: Block_Base
- Implements: With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Why Trust Spy
Class for Why_Trust_Spy block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Cast And Crew
Class for Cast_And_Crew block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Key Takeaways
Class for Key_Takeaways block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Takeaway
Class for Takeaway block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Tease
Class for Tease block.
- Extends: Block_Base
- Implements: Without_Render_Callback
Digital Daily Polar Ad
Registers the pmc/ditial-daily-polar-ad block.
- Extends: Block_Base
- Implements: With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Fullscreen Cover
Registers the pmc/fullscreen-cover block.
- Extends: Block_Base
- Implements: With_Larva_Data
larva_data
Populate Larva data.
$block_content: string — The block content about to be appended.$block: array — The full block, including name and attributes.
ItemSelects
Item Selects component.
props: Object — Props object.props.props: Object — Props object child.props.props.items: Array — Items array.props.props.storyOptions: Object — Story options object.props.props.setAttributes: Function — Attributes setter.props.props.isSelected: bool — Is block/feature selected.props.props.classNameGridWrapper: string — Class string.props.props.classNameGridItem: string — Class string.
Group Slider
Registers the pmc/group-slider block. Render slider using Groups block to contain each slide.
- Extends: Block_Base
- Implements: With_Render_Callback
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Story Digital Daily
Registers the pmc/story-digital-daily block. Story block for Digital Daily feature.
- Extends: Story_Block_Engine
- Implements: With_Dependencies
_get_larva_module_with_variant
Return block's Larva module and variant.
$attrs: array — Block attributes.
larva_data
Populate pattern from post data.
$block_content: string — The block content about to be appended.$block: array — The full block, including name and attributes.
_add_common_data
Add post data shared across all variations.
$data: array — Larva Pattern data.
_add_o_figure
Populate the o-figure object regardless of its key name in prototype.
$data: array —o_figurePattern data.
_parse_image_size
Determine image size from Larva crop class.
$crop_classes: string — Larva cropping classes.
_apply_brand_overrides
Allow brands to override specific keys in the block's pattern data. The supported keys are generally those that pertain to brand-specific features and rely on classes that are only present in the brand's theme. As a defensive measure, only explicitly-allowed keys can be modified via the provided filter.
$data: array — Pattern data.
get_dependent_classes
Specify classes that must be loaded for this block to be available.
InspectorControlCropOverride
Add to Story Block's Display Settings InspectorControls.
Controls: Function — Additional inspector controls.
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
larva_data
Called by the render_block method of the main Gutenberg class. Method signature must match parent method. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$block_content: string — The block content about to be appended.$block: array — The full block, including name and attributes.
Story Digital Daily Special Edition Cover
Registers the pmc/story-digital-daily-special-edition-cover block. Cover block for Digital Daily Special Edition articles.
- Extends: Story_Block_Engine
- Implements: With_Dependencies
larva_data
Called by the render_block method of the main Gutenberg class.
$block_content: string — The block content about to be appended.$block: array — The full block, including name and attributes.
_get_permalink
Build permalink that links to Special Edition article block on the current view. Unlike all other permalinks, on the Landing Page view, we do not link to the Full View, but rather to the SEA block in the current view.
_get_larva_module_with_variant
Return block's Larva module and variant. Digital_Daily_Common_Elements trait overrides this method to toggle Larva module for full view, which this block does not have. PHP provides no way to bypass trait method for the parent it overrides, so we have to duplicate the method here. Method signature must match parent. phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.
$attrs: array — Block attributes.
get_dependent_classes
Specify classes that must be loaded for this block to be available.
Story Gallery
Registers the pmc/fullscreen-cover block. Story block for PMC Gallery v4.
- Extends: Story_Block_Engine
- Implements: With_Dependencies
larva_data
Populate pattern from post data.
$block_content: string — The block content about to be appended.$block: array — The full block, including name and attributes.
_get_images
Get gallery items.
_add_common_data
Add post data shared across all variations.
$data: array — Larva Pattern data.
_add_images
Populate gallery images in o-figure elements.
$data: array — Pattern data.
get_dependent_classes
Specify classes that must be loaded for this block to be available.
Story Runway Review
Registers the pmc/story-runway-review block.
- Extends: Story_Block_Engine
- Implements: With_Dependencies
larva_data
Populate pattern from post data.
$block_content: string — The block content about to be appended.$block: array — The full block, including name and attributes.
_get_images
Get runway's linked gallery items.
_add_common_data
Add post data shared across all variations.
$data: array — Larva Pattern data.
_add_images
Populate gallery images in o-figure elements.
$data: array — Pattern data.
_add_image_credit
Populate image credit elements.
$data: array — Pattern data.
get_dependent_classes
Specify classes that must be loaded for this block to be available.
Story Top Video
Registers the pmc/story-top-video block. Story block for PMC Top Videos V2.
- Extends: Story_Block_Engine
- Implements: With_Dependencies
larva_data
Populate pattern from post data.
$block_content: string — The block content about to be appended.$block: array — The full block, including name and attributes.
_add_common_data
Add post data shared across all variations.
$data: array — Larva Pattern data.
get_dependent_classes
Specify classes that must be loaded for this block to be available.
SVG
Registers the pmc/svg block.
- Extends: Block_Base
- Implements: With_Render_Callback
register
Register an SVG for use with this block.
$name: string — Display name of SVG.$url: string — Source URL.$post_types: array — Post types where SVG can appear.
localize_script_with_options
Convert registered SVGs to array for use with SelectControl component.
sort_by_label
Sort registered SVGs by their labels.
$first: array — First SVG to compare.$second: array — Second SVG to comapre.
get_details
Retrieve details for a registered SVG.
$slug: string — SVG slug (filename without extension).
render_callback
Render block. Declaration must be compatible with interface.
$attrs: array — Block attributes.$content: string — Block content.$block: WP_Block — Block object.
Wwd Relationships
Class for Wwd_Relationships block.
- Extends: Block_Base
- Implements: Without_Render_Callback