Last active
November 12, 2018 18:18
-
-
Save itsdavidmorgan/788c04db131725e1ee420191c9e2d822 to your computer and use it in GitHub Desktop.
Register Profile Block For Gutenberg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
registerBlockType('organic/profile-block', { // The name of our block. Must be a string with prefix. Example: my-plugin/my-custom-block. | |
title: i18n.__('Profile'), // The title of our block. | |
description: i18n.__('A custom block for displaying personal profiles.'), // The description of our block. | |
icon: 'businessman', // Dashicon icon for our block. Custom icons can be added using inline SVGs. | |
category: 'common', // The category of the block. | |
attributes: { // Necessary for saving block content. | |
title: { | |
type: 'array', | |
source: 'children', | |
selector: 'h3' | |
}, | |
subtitle: { | |
type: 'array', | |
source: 'children', | |
selector: 'h5' | |
}, | |
bio: { | |
type: 'array', | |
source: 'children', | |
selector: 'p' | |
}, | |
mediaID: { | |
type: 'number' | |
}, | |
mediaURL: { | |
type: 'string', | |
source: 'attribute', | |
selector: 'img', | |
attribute: 'src' | |
}, | |
alignment: { | |
type: 'string', | |
default: 'center' | |
}, | |
facebookURL: { | |
type: 'url' | |
}, | |
twitterURL: { | |
type: 'url' | |
}, | |
instagramURL: { | |
type: 'url' | |
}, | |
linkedURL: { | |
type: 'url' | |
}, | |
emailAddress: { | |
type: 'text' | |
} | |
}, | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment