Download the PHP package oblik/kirby-outsource without Composer
On this page you can find all versions of the php package oblik/kirby-outsource. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package kirby-outsource
Walker
Plugin that allows you to walk, export, and import all site data according to specified blueprints. It is created with the intention of being used as a dependency for other plugins. Features:
- Serialize content on a per-field basis (parse YAML in structures, turn comma-separated tags fields to arrays, etc.)
- Convert KirbyTags to XML and back (for consumption by another API that doesn't understand KirbyTag syntax)
- Convert Markdown to HTML and back (for APIs that don't work with Markdown)
- Export entire site, page, and file models
- Import content using the same schema as the exports
- Traverse blocks and structures according to their
id
fields (if they have such) - Easy extensibility of the PHP classes for implementing custom behavior
- Support for the now deprecated Kirby Editor
Installation
With Composer from oblik/kirby-walker on Packagist:
Usage
Exporting
You can use the Exporter
class to export content:
Importing
You can use the Importer
class to merge input content with the current model content.
After merging the data, you can use the resulting array to apply the changes to the model:
Options
There are a few options that allow you to transform the raw content to make it more suitable for other systems. Then, the plugin can turn that reformatted content back to its original format, while keeping any changes made to it.
Parse KirbyTags
Turns KirbyTags to XML:
By default, KirbyTag attributes are encoded as XML attributes. If the consuming system needs to operate on those values (e.g. translate them), you might need to put their contents out of the tags. Instead of this:
…you might need this:
To do this, just use the externalAttributes
setting:
Parse Markdown
If the consuming system doesn't understand Markdown, you can turn it to HTML:
Note: This applies only to textarea
field types.
Parse templates
Turns content enclosed in curly braces to XML:
Extending
You can easily extend the base classes to add custom behaviors. For example, you could return the character lengths of each field like so:
You could also use values from each field's blueprint:
The cool part is that parsing YAML for structure fields and JSON for layout and blocks fields is already handled. Your custom logic will work in all nested fields automatically.
Separate logic for field types
You can have different logic for different field types by adding a walkField{{ field type }}
method. For example, you can change the behavior for just the gap
fields by adding walkFieldGap
:
All versions of kirby-outsource with dependencies
getkirby/composer-installer Version ^1.1
league/html-to-markdown Version ^4.8