dnadesign / silverstripe-elemental-virtual

Allows Content Blocks to be reused between pages.
BSD 3-Clause "New" or "Revised" License
7 stars 26 forks source link

Available Globally doesn't default to true (but looks like it should) #20

Closed Hels666 closed 5 years ago

Hels666 commented 5 years ago

The code for BaseElementExtension.php contains:

private static $db = [ 'AvailableGlobally' => 'Boolean(1)' ];

which suggests that all elements should be set to Available Globally by default, but they are not.

Currently, it can be changed by yml file (although that isn't explained in the readme) but if they should be Available Globally by default then adding this works:

private static $defaults = [ 'AvailableGlobally' => 1 ];

robbieaverill commented 5 years ago

I assume you're correct - would you like to make a pull request to fix this?

Hels666 commented 5 years ago

I have done the pull request - it's #21

wilr commented 5 years ago

You need to opt into this via the config API.

DNADesign\Elemental\Models\BaseElement:
  default_global_elements: 1