Hello,
I am still new to Kirby and excited about the system. I’ve been trying for hours with this example here: Blocks | Kirby CMS I’ve searched the forum up and down but haven’t found anything that helps me.
I have copied the code 1:1 and only adjusted the name.
site/blueprints/blocks/button.yml
name: Button
icon: bolt
fields:
link:
type: url
text:
type: text
site/plugins/button/index.css
.k-block-type-button button {
border: 2px solid #000;
display: inline-flex;
border-radius: 3rem;
padding: .25rem 1.5rem;
cursor: pointer;
}
.k-block-type-button button:empty::after {
content: "Button text …";
color: var(--color-text-light);
}
.k-block-type-button button:focus {
outline: 0;
border-color: var(--color-focus);
}
site/plugins/button/index.js
panel.plugin("tmec/button-block", {
blocks: {
button: `
<button type="button" @click="open">
{{ content.text }}
</button>
`
}
});
site/plugins/button/index.php
<?php
Kirby::plugin('tmec/button-block', []);
What am I missing? For testing purposes, I have inserted a php error in the index.php. Nothing happens. I can create the buttons in the backend and they are also saved. But the preview remains the default view.
That looks totally ok and should work. If you put an error into index.php and that doesn’t have any effect, then your plugin doesn’t get loaded and something is not like it should be. Could you post a screenshot of your folder structure?
of course i use ddev
.
|-- accounts
|-- content
|-- kirby
| |-- assets
| |-- config
| | |-- api
| | | |-- models
| | | `-- routes
| | |-- blocks
| | | |-- code
| | | |-- gallery
| | | |-- heading
| | | |-- image
| | | |-- list
| | | |-- markdown
| | | |-- quote
| | | |-- table
| | | |-- text
| | | `-- video
| | |-- blueprints
| | | |-- blocks
| | | |-- files
| | | `-- pages
| | |-- fields
| | | `-- mixins
| | |-- presets
| | |-- sections
| | | `-- mixins
| | `-- templates
| | `-- emails
| | `-- auth
| |-- dependencies
| | |-- parsedown
| | `-- parsedown-extra
| |-- i18n
| | |-- rules
| | `-- translations
| |-- panel
| | `-- dist
| | |-- css
| | |-- img
| | `-- js
| |-- src
| | |-- Api
| | |-- Cache
| | |-- Cms
| | | `-- Auth
| | |-- Data
| | |-- Database
| | | `-- Sql
| | |-- Email
| | |-- Exception
| | |-- Form
| | | |-- Field
| | | `-- Mixin
| | |-- Http
| | | |-- Exceptions
| | | `-- Request
| | | `-- Auth
| | |-- Image
| | | `-- Darkroom
| | |-- Parsley
| | | `-- Schema
| | |-- Sane
| | |-- Session
| | |-- Text
| | `-- Toolkit
| `-- views
| `-- snippets
|-- plugins
| |-- editor
| | |-- examples
| | | |-- info-block
| | | | `-- snippets
| | | |-- intro-block
| | | | `-- snippets
| | | |-- table-block
| | | | `-- snippets
| | | `-- todo-block
| | | `-- snippets
| | |-- i18n
| | |-- lib
| | |-- snippets
| | |-- src
| | | `-- components
| | | |-- Blocks
| | | | `-- Options
| | | `-- ProseMirror
| | | |-- Dialogs
| | | |-- Editor
| | | |-- Keymaps
| | | |-- Marks
| | | `-- Schemas
| | `-- tests
| | |-- Blocks
| | `-- fixtures
| | `-- ParserTest
| `-- kirby-builder
| |-- lib
| |-- sandbox
| | |-- assets
| | | `-- css
| | | `-- blocks
| | `-- site
| | `-- snippets
| | `-- blocks
| |-- src
| | `-- components
| `-- templates
|-- sessions
|-- site
| |-- blueprints
| | |-- blocks
| | |-- fields
| | |-- files
| | |-- pages
| | |-- sections
| | `-- users
| |-- cache
| |-- collections
| |-- config
| |-- controllers
| |-- models
| |-- plugins
| | |-- blocks
| | |-- button
| | |-- editor
| | | |-- examples
| | | | |-- info-block
| | | | | `-- snippets
| | | | |-- intro-block
| | | | | `-- snippets
| | | | |-- table-block
| | | | | `-- snippets
| | | | `-- todo-block
| | | | `-- snippets
| | | |-- i18n
| | | |-- lib
| | | |-- snippets
| | | |-- src
| | | | `-- components
| | | | |-- Blocks
| | | | | `-- Options
| | | | `-- ProseMirror
| | | | |-- Dialogs
| | | | |-- Editor
| | | | |-- Keymaps
| | | | |-- Marks
| | | | `-- Schemas
| | | `-- tests
| | | |-- Blocks
| | | `-- fixtures
| | | `-- ParserTest
| | |-- kirby-builder
| | | |-- lib
| | | |-- sandbox
| | | | |-- assets
| | | | | `-- css
| | | | | `-- blocks
| | | | `-- site
| | | | `-- snippets
| | | | `-- blocks
| | | |-- src
| | | | `-- components
| | | `-- templates
| | `-- relationship
| |-- snippets
| | `-- blocks
| `-- templates
|-- vendor
`-- wwwroot
|-- assets
`-- media
i use ddev as server emulation. For reasons, the root directory is ./wwwroot the index.php looks like this.
<?php
require __DIR__ . '/../kirby/bootstrap.php';
$kirby = new Kirby([
'roots' => [
'index' => __DIR__,
'site' => __DIR__ . '/../site',
'content' => __DIR__ . '/../content',
'accounts' => __DIR__ . '/../accounts',
'plugins' => __DIR__ . '/../plugins',
'sessions' => __DIR__ . '/../sessions'
]
]);
echo $kirby->render();
Your plugins folder is set to the upper plugins folder instead of to the one inside the site
folder.
The editor plugin is not compatible with Kirby 3.5.x and should be removed.
Thank you very much. I must have been a bit blind then 