Skip to content

Commit

Permalink
other: group restricted blocks in an array
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed May 26, 2023
1 parent 1e26a94 commit b79680d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ import voltoCustomMiddleware from './middleware/voltoCustom';
import okMiddleware from './middleware/ok';
import installSlate from './slate';

const restrictedBlocks = [
'__grid', // Grid/Teaser block (kitconcept)
'imagesGrid',
'teaser',
];

const applyConfig = (config) => {
// EEA specific settings
config.settings.eea = {
Expand All @@ -34,6 +40,13 @@ const applyConfig = (config) => {
// Disable tags on View
config.settings.showTags = false;

// Disable some blocks
restrictedBlocks.forEach((block) => {
if (config.blocks.blocksConfig[block]) {
config.blocks.blocksConfig[block].restricted = true;
}
});

// Enable Title block
config.blocks.blocksConfig.title.restricted = false;

Expand Down Expand Up @@ -206,17 +219,6 @@ const applyConfig = (config) => {
},
];

// Grid/Teaser block (kitconcept)
if (config.blocks.blocksConfig.__grid) {
config.blocks.blocksConfig.__grid.restricted = true;
}
if (config.blocks.blocksConfig.imagesGrid) {
config.blocks.blocksConfig.imagesGrid.restricted = true;
}
if (config.blocks.blocksConfig.teaser) {
config.blocks.blocksConfig.teaser.restricted = true;
}

// layout settings
config = [installLayoutSettingsBlock].reduce(
(acc, apply) => apply(acc),
Expand Down

0 comments on commit b79680d

Please sign in to comment.