Skip to content

Commit

Permalink
Prefix PHP constants and Gutenberg blocks for better encapsulation - …
Browse files Browse the repository at this point in the history
…WP.org review
  • Loading branch information
Vlad Olaru committed Jul 24, 2019
1 parent 9ccdfcf commit 473c4f6
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 46 deletions.
6 changes: 3 additions & 3 deletions dist/js/editor.blocks.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/frontend.blocks.js

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions lib/customify.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
add_filter( 'customify_filter_fields', 'novablocks_add_customify_section', 20, 1 );
add_filter( 'customify_filter_fields', 'novablocks_add_customify_style_manager_section', 20, 1 );

define( 'THEME_COLOR_PRIMARY', '#203AB6' ); // nova blue
define( 'THEME_COLOR_SECONDARY', '#FFE42E' ); // nova yellow
define( 'THEME_COLOR_TERTIARY', '#FFE42E' ); // nova yellow
define( 'NOVABLOCKS_THEME_COLOR_PRIMARY', '#203AB6' ); // blue
define( 'NOVABLOCKS_THEME_COLOR_SECONDARY', '#FFE42E' ); // yellow
define( 'NOVABLOCKS_THEME_COLOR_TERTIARY', '#FFE42E' ); // yellow

define( 'THEME_DARK_PRIMARY', '#000043' ); // nova blue darker
define( 'THEME_DARK_SECONDARY', '#272743' ); // nova text color
define( 'THEME_DARK_TERTIARY', '#323067' ); // nova blue dark
define( 'NOVABLOCKS_THEME_DARK_PRIMARY', '#000043' ); // blue darker
define( 'NOVABLOCKS_THEME_DARK_SECONDARY', '#272743' ); // text color
define( 'NOVABLOCKS_THEME_DARK_TERTIARY', '#323067' ); // blue dark

define( 'THEME_LIGHT_PRIMARY', '#FFFFFF' );
define( 'THEME_LIGHT_SECONDARY', '#EEF1F2' ); // nova gray
define( 'THEME_LIGHT_TERTIARY', '#EEF1F2' ); // nova gray
define( 'NOVABLOCKS_THEME_LIGHT_PRIMARY', '#FFFFFF' ); // white
define( 'NOVABLOCKS_THEME_LIGHT_SECONDARY', '#EEF1F2' ); // gray
define( 'NOVABLOCKS_THEME_LIGHT_TERTIARY', '#EEF1F2' ); // gray

function novablocks_add_customify_section( $config ) {

Expand All @@ -34,7 +34,7 @@ function novablocks_add_customify_section( $config ) {
'type' => 'color',
'live' => true,
'label' => esc_html__( 'Nova Primary Color', '__plugin_txtd' ),
'default' => THEME_COLOR_PRIMARY,
'default' => NOVABLOCKS_THEME_COLOR_PRIMARY,
'css' => array(
array(
'selector' => ':root',
Expand All @@ -46,7 +46,7 @@ function novablocks_add_customify_section( $config ) {
'type' => 'color',
'live' => true,
'label' => esc_html__( 'Nova Primary Color', '__plugin_txtd' ),
'default' => THEME_COLOR_SECONDARY,
'default' => NOVABLOCKS_THEME_COLOR_SECONDARY,
'css' => array(
array(
'selector' => ':root',
Expand All @@ -58,7 +58,7 @@ function novablocks_add_customify_section( $config ) {
'type' => 'color',
'live' => true,
'label' => esc_html__( 'Nova Primary Color', '__plugin_txtd' ),
'default' => THEME_COLOR_TERTIARY,
'default' => NOVABLOCKS_THEME_COLOR_TERTIARY,
'css' => array(
array(
'selector' => ':root',
Expand All @@ -70,7 +70,7 @@ function novablocks_add_customify_section( $config ) {
'type' => 'color',
'live' => true,
'label' => esc_html__( 'Nova Primary Dark Color', '__plugin_txtd' ),
'default' => THEME_DARK_PRIMARY,
'default' => NOVABLOCKS_THEME_DARK_PRIMARY,
'css' => array(
array(
'selector' => ':root',
Expand All @@ -82,7 +82,7 @@ function novablocks_add_customify_section( $config ) {
'type' => 'color',
'live' => true,
'label' => esc_html__( 'Nova Secondary Dark Color', '__plugin_txtd' ),
'default' => THEME_DARK_SECONDARY,
'default' => NOVABLOCKS_THEME_DARK_SECONDARY,
'css' => array(
array(
'selector' => ':root',
Expand All @@ -94,7 +94,7 @@ function novablocks_add_customify_section( $config ) {
'type' => 'color',
'live' => true,
'label' => esc_html__( 'Nova Tertiary Dark Color', '__plugin_txtd' ),
'default' => THEME_DARK_TERTIARY,
'default' => NOVABLOCKS_THEME_DARK_TERTIARY,
'css' => array(
array(
'selector' => ':root',
Expand All @@ -106,7 +106,7 @@ function novablocks_add_customify_section( $config ) {
'type' => 'color',
'live' => true,
'label' => esc_html__( 'Nova Primary Light Color', '__plugin_txtd' ),
'default' => THEME_LIGHT_PRIMARY,
'default' => NOVABLOCKS_THEME_LIGHT_PRIMARY,
'css' => array(
array(
'selector' => ':root',
Expand All @@ -118,7 +118,7 @@ function novablocks_add_customify_section( $config ) {
'type' => 'color',
'live' => true,
'label' => esc_html__( 'Nova Secondary Light Color', '__plugin_txtd' ),
'default' => THEME_LIGHT_SECONDARY,
'default' => NOVABLOCKS_THEME_LIGHT_SECONDARY,
'css' => array(
array(
'selector' => ':root',
Expand All @@ -130,7 +130,7 @@ function novablocks_add_customify_section( $config ) {
'type' => 'color',
'live' => true,
'label' => esc_html__( 'Nova Tertiary Light Color', '__plugin_txtd' ),
'default' => THEME_LIGHT_TERTIARY,
'default' => NOVABLOCKS_THEME_LIGHT_TERTIARY,
'css' => array(
array(
'selector' => ':root',
Expand Down Expand Up @@ -164,55 +164,55 @@ function novablocks_add_customify_style_manager_section( $options ) {
$options['sections']['style_manager_section'] = array_replace_recursive( $options['sections']['style_manager_section'], array(
'options' => array(
'sm_color_primary' => array(
'default' => THEME_COLOR_PRIMARY,
'default' => NOVABLOCKS_THEME_COLOR_PRIMARY,
'connected_fields' => array(
'nova_color_1'
),
),
'sm_color_secondary' => array(
'default' => THEME_COLOR_PRIMARY,
'default' => NOVABLOCKS_THEME_COLOR_PRIMARY,
'connected_fields' => array(
'nova_color_2'
),
),
'sm_color_tertiary' => array(
'default' => THEME_COLOR_PRIMARY,
'default' => NOVABLOCKS_THEME_COLOR_PRIMARY,
'connected_fields' => array(
'nova_color_3'
),
),
'sm_dark_primary' => array(
'default' => THEME_DARK_PRIMARY,
'default' => NOVABLOCKS_THEME_DARK_PRIMARY,
'connected_fields' => array(
'nova_color_dark_1'
),
),
'sm_dark_secondary' => array(
'default' => THEME_DARK_SECONDARY,
'default' => NOVABLOCKS_THEME_DARK_SECONDARY,
'connected_fields' => array(
'nova_color_dark_2'
),
),
'sm_dark_tertiary' => array(
'default' => THEME_DARK_TERTIARY,
'default' => NOVABLOCKS_THEME_DARK_TERTIARY,
'connected_fields' => array(
'nova_color_dark_3'
),
),
'sm_light_primary' => array(
'default' => THEME_LIGHT_PRIMARY,
'default' => NOVABLOCKS_THEME_LIGHT_PRIMARY,
'connected_fields' => array(
'nova_color_light_1'
),
),
'sm_light_secondary' => array(
'default' => THEME_LIGHT_SECONDARY,
'default' => NOVABLOCKS_THEME_LIGHT_SECONDARY,
'connected_fields' => array(
'nova_color_light_2'
),
),
'sm_light_tertiary' => array(
'default' => THEME_LIGHT_TERTIARY,
'default' => NOVABLOCKS_THEME_LIGHT_TERTIARY,
'connected_fields' => array(
'nova_color_light_3'
),
Expand Down
2 changes: 1 addition & 1 deletion lib/enqueue-scripts.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Handle the the scripts enqueue.
* Handle the scripts enqueue.
*/

// If this file is called directly, abort.
Expand Down
2 changes: 1 addition & 1 deletion nova-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function novablocks_add_blocks_category( $categories, $post ) {
return array_merge(
array(
array(
'slug' => 'nova-by-pixelgrade',
'slug' => 'nova-blocks',
'title' => 'Nova Blocks',
),
),
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/hero/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const updateBlocks = ( attributes ) => {
const blocks = editorData.getBlocks();

blocks.filter( block => {
return block.name === 'nova/hero';
return block.name === 'novablocks/hero';
} ).filter( ( block, heroBlockIndex ) => {
const { applyMinimumHeight, scrollIndicator } = { ...block.attributes, ...attributes };
const applyMinimumHeightBlock = applyMinimumHeight === 'first' && heroBlockIndex === 0 || applyMinimumHeight === 'all';
Expand Down
6 changes: 3 additions & 3 deletions src/blocks/hero/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ const { __ } = wp.i18n;
const { registerBlockType, } = wp.blocks;
const { InnerBlocks } = wp.blockEditor;

export default registerBlockType( 'nova/hero',
export default registerBlockType( 'novablocks/hero',
{
title: __( 'Hero of the Galaxy', '__plugin_txtd' ),
description: __( 'A great way to get your visitors acquainted with your content.', '__plugin_txtd' ),
category: "nova-by-pixelgrade",
category: 'nova-blocks',
icon: icons.hero,
edit,
save() {
Expand All @@ -28,4 +28,4 @@ export default registerBlockType( 'nova/hero',
} : {}
},
}
)
)
2 changes: 1 addition & 1 deletion src/blocks/hero/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function novablocks_hero_block_init() {
'show_in_rest' => true,
) );

register_block_type( 'nova/hero', array(
register_block_type( 'novablocks/hero', array(
'attributes' => array(
'blockIndex' => array(
'type' => 'number',
Expand Down
4 changes: 2 additions & 2 deletions src/blocks/media/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ const { __ } = wp.i18n;
const { registerBlockType, } = wp.blocks;
const { InnerBlocks } = wp.blockEditor;

export default registerBlockType( 'nova/media',
export default registerBlockType( 'novablocks/media',
{
title: __( 'Media Card Constellation', '__plugin_txtd' ),
description: __( 'Display media objects alongside short pieces of content.', '__plugin_txtd' ),
category: 'nova-by-pixelgrade',
category: 'nova-blocks',
icon: icons.media,
edit,
save() {
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/media/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
if ( ! function_exists( 'novablocks_media_block_init' ) ) {

function novablocks_media_block_init() {
register_block_type( 'nova/media', array(
register_block_type( 'novablocks/media', array(
'attributes' => array(
'mediaPosition' => array(
'type' => 'string',
Expand Down
4 changes: 2 additions & 2 deletions src/blocks/slideshow/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const { InnerBlocks } = wp.blockEditor;

export default registerBlockType( 'nova/slideshow',
export default registerBlockType( 'novablocks/slideshow',
{
title: __( 'Slideshow Me the Way', '__plugin_txtd' ),
description: __( 'Display more than one piece of content in a single, coveted space.', '__plugin_txtd' ),
category: 'nova-by-pixelgrade',
category: 'nova-blocks',
icon: icons.slideshow,
edit,
save() {
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/slideshow/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
if ( ! function_exists( 'novablocks_slideshow_block_init' ) ) {

function novablocks_slideshow_block_init() {
register_block_type( 'nova/slideshow', array(
register_block_type( 'novablocks/slideshow', array(
'attributes' => array(
'contentPadding' => array(
'type' => 'string',
Expand Down
4 changes: 2 additions & 2 deletions src/components/height-controls/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ subscribe( debouncedOnSubscribe );
const updateBlocks = ( attributes ) => {

select( 'core/block-editor' ).getBlocks().filter( block => {
return block.name === 'nova/hero';
return block.name === 'novablocks/hero';
} ).filter( ( block, index ) => {
const { applyMinimumHeight, scrollIndicator } = { ...block.attributes, ...attributes };
const applyMinimumHeightBlock = applyMinimumHeight === 'first' && index === 0 || applyMinimumHeight === 'all';
Expand Down Expand Up @@ -121,7 +121,7 @@ class ScrollIndicatorPanel extends Component {
} = this.props;

const heroBlocks = select( 'core/block-editor' ).getBlocks().filter( block => {
return block.name === 'nova/hero';
return block.name === 'novablocks/hero';
} );

const index = heroBlocks.findIndex( block => block.clientId === select( 'core/block-editor' ).getSelectedBlockClientId() );
Expand Down

0 comments on commit 473c4f6

Please sign in to comment.