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

What are the available config options for blocks? #63

Open
amenk opened this issue Apr 10, 2021 · 4 comments
Open

What are the available config options for blocks? #63

amenk opened this issue Apr 10, 2021 · 4 comments

Comments

@amenk
Copy link

amenk commented Apr 10, 2021

After a bit digging I found, that I can group blocks into categories like this .

But are there more options?

How can I define the option palette for a block, i.e. I want to include a map and let the editing user define the location.

@amenk
Copy link
Author

amenk commented Apr 10, 2021

I figured something out - you can specify a settings array, which is parsed in https://github.com/HansSchouten/PHPageBuilder/blob/master/src/Modules/GrapesJS/Block/BlockAdapter.php#L113

  • the block has to be a PHPblock (view.php) instead of view.html

  • config.php can be like

      <?php       
      return [
          'title' => 'Hello World',
          'category' => 'Demo Stuff',
          'icon' => 'fa fa-hand-peace-o',
          'settings' => [
              'test' => [
                  'label' => 'testsetting',
              ],
          ]
      ];
    
  • Now in the block you can use <?= $block->setting('test') ?>

@HansSchouten
Copy link
Owner

Hi Alexander, yes that is correct. You can find some examples here and here.

@amenk
Copy link
Author

amenk commented Apr 11, 2021 via email

@amenk
Copy link
Author

amenk commented Apr 11, 2021

In addition to HansSchouten/Laravel-Pagebuilder#73 (comment) there is also the trait / setting type "image" which is pretty useful.

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

No branches or pull requests

2 participants