Skip to content

Commit

Permalink
Remove unused dynamicBlocks var.
Browse files Browse the repository at this point in the history
  • Loading branch information
miina committed May 21, 2018
1 parent dbc1c7c commit e3dab51
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
7 changes: 1 addition & 6 deletions assets/js/amp-editor-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ var ampEditorBlocks = ( function() {
* Holds data.
*/
data: {
dynamicBlocks: [],
ampLayoutOptions: [
{
value: 'nodisplay',
Expand Down Expand Up @@ -92,12 +91,8 @@ var ampEditorBlocks = ( function() {

/**
* Set data, add filters.
*
* @param {Array} data Data.
*/
component.boot = function boot( data ) {
_.extend( component.data, data );

component.boot = function boot() {
wp.hooks.addFilter( 'blocks.registerBlockType', 'ampEditorBlocks/addAttributes', component.addAMPAttributes );
wp.hooks.addFilter( 'blocks.getSaveElement', 'ampEditorBlocks/filterSave', component.filterBlocksSave );
wp.hooks.addFilter( 'blocks.BlockEdit', 'ampEditorBlocks/filterEdit', component.filterBlocksEdit );
Expand Down
16 changes: 1 addition & 15 deletions includes/admin/class-amp-editor-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,6 @@ public function add_editor_filters() {
true
);

$dynamic_blocks = array();
$block_type_registry = WP_Block_Type_Registry::get_instance();
$block_types = $block_type_registry->get_all_registered();

foreach ( $block_types as $block_type ) {
if ( $block_type->is_dynamic() ) {
$dynamic_blocks[] = $block_type->name;
}
}

wp_add_inline_script( 'amp-editor-blocks', sprintf( 'ampEditorBlocks.boot( %s );',
wp_json_encode( array(
'dynamicBlocks' => $dynamic_blocks,
) )
) );
wp_add_inline_script( 'amp-editor-blocks', sprintf( 'ampEditorBlocks.boot();' ) );
}
}

0 comments on commit e3dab51

Please sign in to comment.