Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to register private blocks, sets and presets #28

Draft
wants to merge 59 commits into
base: main
Choose a base branch
from

Conversation

robdekort
Copy link
Contributor

@robdekort robdekort commented Jan 24, 2025

This PR by @marcorieser and me is a refactor of the commands addon that adds the ability to register custom private locations for blocks, sets and presets.

To register custom content:

  1. Publish the config file.
  2. Add paths for either blocks, sets or presets.
  3. Make sure each block, set or preset contains a config.php using the following pattern.
<?php

return [
    'handle' => 'pricing',
    'name' => 'Pricing tiers & features',
    'description' => 'Create and list pricing tiers and feature tables.',
    'operations' => [
        // Adds the ability to rename a collection handle. Use `{{ handle }}` in your files.
        [
            'type' => 'rename'
        ],
        // Runs a custom CLI command.
        [
            'type' => 'run',
            'command' => 'composer require vendor/package',
            'processing_message' => 'Installing vendor/package',
            'success_message' => 'Package installed.'
        ],
        // Copy a file, optionallly add the option to skip the operation.
        [
            'type' => 'copy',
            'input' => 'source.file',
            'output' => 'destination.file',
            'skippable' => false // Default.
        ],
        // Update the page builder with a new block.
        [
            'type' => 'update_page_builder',
            'block' => [
                'name' => 'Title',
                'instructions' => 'Instructions',
                'icon' => 'icon',
                'handle' => 'handle',
            ]
        ],
        // Update Bard with a new set.
        [
            'type' => 'update_article_sets',
            'block' => [
                'name' => 'Title',
                'instructions' => 'Instructions',
                'icon' => 'icon',
                'handle' => 'handle',
            ]
        ],
        // Add permissions to role. Use `{{ handle }}` when working with a renamable collection.
        [
            'type' => 'update_role',
            'role' => 'role_handle',
            'permissions' => ['view {{ handle }} entries', 'edit {{ handle }} entries', 'create {{ handle }} entries', 'delete {{ handle }} entries', 'publish {{ handle }} entries', 'reorder {{ handle }} entries', 'edit other authors {{ handle }} entries', 'publish other authors {{ handle }} entries', 'delete other authors {{ handle }} entries']
        ],
        // Notify the user with a message in the CLI. The user has to hit enter to continue.
        [
            'type' => 'notify',
            'content' => "All done."
        ],
    ]
];

@robdekort robdekort marked this pull request as draft January 24, 2025 08:50
@marcorieser marcorieser force-pushed the feature/refactor-install-commands branch from e853b2b to e8e7b16 Compare February 17, 2025 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants