Created
February 11, 2019 21:10
-
-
Save techlemur/ea1c921516ce67ae0bceec30b872fd6e to your computer and use it in GitHub Desktop.
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
/* gets all available blocks and log them in console */ | |
wp.data.select( "core/blocks" ).getBlockTypes().forEach(function(element) { | |
console.log(element['name']); | |
}); | |
/* same thing but in a new window and formatted for php */ | |
var win = window.open("", "Title", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=200,top="+(screen.height-400)+",left="+(screen.width-840)); | |
var tmpContent = 'Block List<br><hr><br>array(<br>'; | |
wp.data.select( "core/blocks" ).getBlockTypes().forEach(function(element) { | |
tmpContent = tmpContent + "'" + element['name'] + "', //"+element['description']+"<br>"; | |
}); | |
tmpContent = tmpContent + ');'; | |
win.document.body.innerHTML = tmpContent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment