Castopod Plugins
Este conteúdo não está disponível em sua língua ainda.
Plugins let you extend Castopod with new features and custom functionality.
Each plugin lives in the plugins/
directory under its vendor’s folder (the
organization or person who created it):
Directoryplugins
Directoryacme
Directoryhello-world/ # “hello-world/” is a plugin authored by the vendor “acme”.
- …
- …
Directoryatlantis/
- …
Castopod automatically detects valid plugins in the plugins/
directory.
Discovering Castopod plugins
Section titled “Discovering Castopod plugins”🧩👉 Browse and download plugins from the official plugin repository: plugins.castopod.org.
This official open source repository includes plugins developed and maintained by the Castopod team and contributions from community developers, so you can easily add new features and enhancements to your podcasting setup!
Anatomy of a Castopod plugin
Section titled “Anatomy of a Castopod plugin”Directoryhello-world
Directoryi18n
- en.json
- fr.json
- …
- icon.svg
- manifest.json // required
- LICENSE.md
- Plugin.php // required
- README.md
Plugin manifest (required)
Section titled “Plugin manifest (required)”The plugin manifest is a JSON file containing the plugin’s metadata and technical declarations.
This file will determine whether a plugin is valid or not. The minimal required data being:
{ "name": "acme/hello-world", "version": "1.0.0", "minCastopodVersion": "2.0.0"}
Checkout the manifest.json reference.
Plugin class (required)
Section titled “Plugin class (required)”This is where the plugin’s logic lives.
The Plugin class extends Castopod’s BasePlugin class and implements one or more Hooks (methods) intended to be run throughout Castopod’s codebase.
<?php
declare(strict_types=1);
use Modules\Plugins\Core\BasePlugin;
class AcmeHelloWorldPlugin extends BasePlugin{ // this rssBeforeChannel method is a Hook public function rssBeforeChannel(Podcast $podcast): void { // … }}
Plugin README
Section titled “Plugin README”The README.md
file should contain with any additional information to help
guide the user in using the plugin.
It is loaded on Castopod’s admin area when the plugin is installed.
Plugin LICENSE
Section titled “Plugin LICENSE”In addition to specifying the license in the manifest, you
may add a LICENSE.md
file.
Just like the README.md
file, its contents will be loaded into Castopod’s
admin area, in the plugin’s view page for the user to read.
Plugin icon
Section titled “Plugin icon”Generally, the plugin icon is displayed next to its title, it is an SVG file intended to give a graphical representation of the plugin.
The icon should be squared, and be legible in a 64px by 64px circle.
Internationalization (i18n)
Section titled “Internationalization (i18n)”Plugins can be translated. Translation strings live inside the i18n
folder.
Translation files are JSON files named as locale keys:
Directoryi18n
- en.json // default locale
- fr.json
- de.json
- …
Supported locales are:
br
,ca
,de
,en
,es
,fr
,nn-no
,pl
,pt-br
,sr-latn
,zh-hans
.
The translation strings allow you to translate the title, description and settings keys (ie. labels, hints, helpers, etc.).
{ "title": "Hello, World!", "description": "A Castopod plugin to greet the world!", "settings": { "general": { "field-key": { "label": "Enter a text", "hint": "You can enter any type of character." } }, "podcast": {}, "episode": {} }}
{ "title": "Bonjour, le Monde !", "description": "Un plugin castopod pour saluer le monde !", "settings": { "general": { "field-key": { "label": "Saisissez un texte", "hint": "Vous pouvez saisir n'importe quel type de caractère." } }, "podcast": {}, "episode": {} }}