AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Block messages discord plugin1/3/2023 ![]() ![]() In addition to the files field we need for the audio file itself, we add some additional settings for the audio tag like the controls and the autoplay attributes. In the audio block blueprint, we define the fields for the block that will later show up in the drawer in the Panel. Let's start with the most important plugin file, the index.php, where we register the blueprints for the block, two file blueprints to restrict file uploads, and the snippet to render the audio block on the frontend. When you are unsure where to put what, you can come back to this overview. When we will be finished, the resulting folder structure of our plugin will look like this. A package.json file for the bundler (optional)Īfter finishing this tutorial, you should have a solid understanding about block types that will enable you to start building your own, even if you will never ever need an audio block at all.vue single component file (optional, requires build process) An index.js file to render a Panel preview (optional).A block snippet that renders the block on the frontend (required).A block yaml file that defines the fields available for the block type (required).An index.php to register the plugin (required for all plugins).We are going to use the example of an audio block type to show you how to create custom block types for the blocks field from scratch, complete with an inline editable preview for the Panel using a single file component with a build process.Ī block type plugin basically consists of the following files: What we will be building Preview of our amazing audio block in the Panel To bundle or not to bundle: differences of creating plugins with or without a build process.Probably a big pot of hot coffee and a cool head.But don't worry, we also show you how to build this block without such a build process (see link below). For the single file approach, Node 14+ and kirbyup.Basic understanding how to create plugins in Kirby.A Kirby Plainkit or Starterkit for testing.But you probably wouldn't be reading this if you wouldn't be striving for more, and this recipe will hopefully be a great first step into your bright future as a custom block type developer □. Kirby's blocks field comes with quite a few default block types that are great for most purposes and can be customized to your needs. ![]()
0 Comments
Read More
Leave a Reply. |