Skip to content

Commit

Permalink
implement pagetype_black/whitelist. Fixes #39
Browse files Browse the repository at this point in the history
  • Loading branch information
sheadawson committed Jun 16, 2016
1 parent 9df84b4 commit 567f573
Show file tree
Hide file tree
Showing 3 changed files with 562 additions and 517 deletions.
66 changes: 34 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,27 @@ Install via composer, run `dev/build`

``` yml
BlockManager:
themes:
simple:
areas:
Sidebar: true # a Sidebar area will be available on all page types in simple theme
BeforeContent:
only: HomePage # a BeforeContent area will be available only on HomePage page types in simple theme
AfterContent:
except: HomePage # a AfterContent area will be available on all page types except HomePage in simple theme
Footer: true # a Footer area will be available on all page types in simple theme

use_blocksets: false # Whether to use BlockSet functionality (default if undeclared: true)
use_extra_css_classes: true # Whether to allow cms users to add extra css classes to blocks (default if undeclared: false)
prefix_default_css_classes: 'myprefix--' # prefix the automatically generated CSSClasses based on class name (default if undeclared: false)
exclude_from_page_types: # Disable the Blocks tab completely on these pages of these types
- ContactPage
#disabled_blocks: #allows you to disable specific blocks
# - ContentBlock
use_default_blocks: false # Disable/enable the default Block types (ContentBlock) (default if undeclared: true)
block_area_preview: false # Disable block area preview button in CMS (default if undeclared: true)
themes:
simple:
areas:
Sidebar: true # a Sidebar area will be available on all page types in simple theme
BeforeContent:
only: HomePage # a BeforeContent area will be available only on HomePage page types in simple theme
AfterContent:
except: HomePage # a AfterContent area will be available on all page types except HomePage in simple theme
Footer: true # a Footer area will be available on all page types in simple theme

#use_blocksets: false # Whether to use BlockSet functionality (default if undeclared: true)
#use_extra_css_classes: true # Whether to allow cms users to add extra css classes to blocks (default if undeclared: false)
#prefix_default_css_classes: 'myprefix--' # prefix the automatically generated CSSClasses based on class name (default if undeclared: false)
#pagetype_whitelist: # Enable the Blocks tab only pages of these types (optional)
# - HomePage
#pagetype_blacklist: # Disable the Blocks tab on pages of these types (optional)
# - ContactPage
#disabled_blocks: #allows you to disable specific blocks (optional)
# - ContentBlock
#use_default_blocks: false # Disable/enable the default Block types (ContentBlock) (default if undeclared: true)
#block_area_preview: false # Disable block area preview button in CMS (default if undeclared: true)
```

Remember to run `?flush=1` after modifying your `.yml` config to make sure it gets applied.
Expand Down Expand Up @@ -153,10 +155,10 @@ If your running your SS instance "themeless", you can configure your blocks usin

``` yml
BlockManager:
themes:
default:
areas:
...
themes:
default:
areas:
...
```

### Remove the Blocks button from the main CMS menu
Expand All @@ -176,18 +178,18 @@ Here's an example that uses font awesome:
```php
public function getIcon()
{
return '<i class="fa fa-thumbs-up fa-3x" title="' . $this->singular_name() . '" aria-hidden="true"></i>';
return '<i class="fa fa-thumbs-up fa-3x" title="' . $this->singular_name() . '" aria-hidden="true"></i>';
}
public function getTypeForGridfield()
{
$icon = $this->getIcon();
if ($icon) {
$obj = HTMLText::create();
$obj->setValue($icon);
return $obj;
} else {
return parent::getTypeForGridfield();
}
$icon = $this->getIcon();
if ($icon) {
$obj = HTMLText::create();
$obj->setValue($icon);
return $obj;
} else {
return parent::getTypeForGridfield();
}
}
```

Expand Down
Loading

0 comments on commit 567f573

Please sign in to comment.