Bonds


Introduction

Bonds are the plugin architecture for the CMS. With bonds you can tap into various parts of the CMS.

{info} This is in the early stages. More functionality will be added in the near future.

All bonds should be registered in your service provider within the boot() method.

// Example
public function boot(){
    ...
    registerPackage($arr);
    ...
}

Package Registration

$arr = [
    'package_name' => 'My Package Name',
    'version' => '1.0.0',
    'description' => 'This is a packge',
    'website' => 'https://mypackagewebsite.io',
    'repo' => 'https://github.com/vendor/package',
    'image' => 'https://url-to-my-package-image/image.png' // optional
];

registerPackage($arr);

In addition to registering the package it's recommended to add a bond.json file to the root of your package. The bond.json file should have at least your package version. This will help admin users know if there is an update to your package. Semantic versioning is required. MAJOR.MINOR.PATCH

{
    "package_name": 'My Package Name',
    "version": "1.0.0"
}

Menu Bond

Add menu items to the admin.

$arr = [
    [
        'slot' => 4,
        'url' => '/admin/locations',
        'parent_title' => 'Locations',
        'named_route' => 'neutrino.locations',
        'fa-icon' => 'fa-map-marked',
        'children' => [
            [ 'url' => '/admin/locations', 'title' => 'All Locations' ],
            [ 'url' => '/admin/location', 'title' => 'Create Location' ],
        ]
    ]
];

registerAdminMenus($arr);

Asset Bond

Register styles and scripts for the website. More options coming soon to add attributes.

$arr = [
    '/vendor/newelement/packagename/css/app.css',
];

registerStyles($arr);
$arr = [
    '/vendor/newelement/packagename/js/app.js',
];

registerScripts($arr);

Register styles and scripts for admin.

registerAdminStyles($arr);
registerAdminScripts($arr);

Sitemap Bond

Register the model that will be used to include in the sitemap XML.

$arr = [ 
    'model' => '\\Newelement\\Locations\\Models\\Location', 
    'key' => 'locations'
];

function registerSiteMap($arr);