PHPackages                             cyber-duck/silverstripe-block-page - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. cyber-duck/silverstripe-block-page

ActiveSilverstripe-vendormodule[Framework](/categories/framework)

cyber-duck/silverstripe-block-page
==================================

A modular approach to building pages in SilverStripe

4.10.2(2y ago)1417.4k5[2 issues](https://github.com/Cyber-Duck/Silverstripe-Block-Page/issues)[1 PRs](https://github.com/Cyber-Duck/Silverstripe-Block-Page/pulls)MITPHPPHP &gt;=8.0

Since Nov 24Pushed 1y ago3 watchersCompare

[ Source](https://github.com/Cyber-Duck/Silverstripe-Block-Page)[ Packagist](https://packagist.org/packages/cyber-duck/silverstripe-block-page)[ Docs](http://github.com/cyber-duck/silverstripe-block-page)[ RSS](/packages/cyber-duck-silverstripe-block-page/feed)WikiDiscussions develop Synced 3w ago

READMEChangelog (10)Dependencies (2)Versions (44)Used By (0)

SilverStripe 4 Block Page
=========================

[](#silverstripe-4-block-page)

[![Latest Stable Version](https://camo.githubusercontent.com/ba0978940dfa3060cb4fa150d666da1de4758ccd78acae7f6d88b78ef7967286/68747470733a2f2f706f7365722e707567782e6f72672f63796265722d6475636b2f73696c7665727374726970652d626c6f636b2d706167652f762f737461626c65)](https://packagist.org/packages/cyber-duck/silverstripe-block-page)[![Latest Unstable Version](https://camo.githubusercontent.com/c45771c9e4f107f774c7c6cece7de6ee1a251c6ad0b2e6a13b72ab1ee5ba0d5d/68747470733a2f2f706f7365722e707567782e6f72672f63796265722d6475636b2f73696c7665727374726970652d626c6f636b2d706167652f762f756e737461626c65)](https://packagist.org/packages/cyber-duck/silverstripe-block-page)[![Total Downloads](https://camo.githubusercontent.com/5c7b0fc5c7d5b8cfc00c364942088610340de9d5840bf429b362427233697004/68747470733a2f2f706f7365722e707567782e6f72672f63796265722d6475636b2f73696c7665727374726970652d626c6f636b2d706167652f646f776e6c6f616473)](https://packagist.org/packages/cyber-duck/silverstripe-block-page)[![License](https://camo.githubusercontent.com/e73b04ddda7fc7de2828ef888497e3797622ff9563e267bf82b516995ab87d0c/68747470733a2f2f706f7365722e707567782e6f72672f63796265722d6475636b2f73696c7665727374726970652d626c6f636b2d706167652f6c6963656e7365)](https://packagist.org/packages/cyber-duck/silverstripe-block-page)

Author: [Andrew Mc Cormack](https://github.com/Andrew-Mc-Cormack)

Features
--------

[](#features)

A modular approach to building pages in SilverStripe which allows model based page components.

- Custom model based blocks
- No limit to number of blocks
- Easily block selection and editing
- Use drag and drop GridField functionality to change and re-order blocks easily
- Apply complex logic like forms to blocks
- Versioning across blocks

Screen Shots
------------

[](#screen-shots)

- [Block Selection](/docs/images/block-selection.jpeg)

Installation
------------

[](#installation)

Add the following to your composer.json file and run /dev/buid?flush=all

```
{
    "require": {
        "cyber-duck/silverstripe-block-page": "4.0.*"
    }
}
```

Setup
-----

[](#setup)

### Add Extension and Template Loop

[](#add-extension-and-template-loop)

The first step to adding block functionality is to apply the block page extension to your DataObject. This can be a normal DataObject or a Page.

```
Page:
  extensions:
    - BlockPageExtension
```

This will add a new tab to the CMS called content blocks. The second step is to apply the loop within your template for the blocks:

```

$Template

```

### Add Block Model and Template

[](#add-block-model-and-template)

The next step is to create a block. A block consists of 2 parts; a DataObject and a .ss template. Both these should have the same name.

- EditorBlock.php
- EditorBlock.ss

The model file can reside anywhere inside your code folder and should extend ContentBlock The base template for a block DataObject is as follows:

```
use CyberDuck\BlockPage\Model\ContentBlock;
use SilverStripe\Forms\HeaderField;
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;

class EditorBlock extends ContentBlock
{
    private static $title = 'Editor';

    private static $description = 'Simple WYSIWYG editor block';

    private static $preview = '/themes/{YourTheme}/img/block/EditorBlock.png';

    private static $db = [
        'Content' => 'HTMLText'
    ];

    public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        # HEADER - THIS FIELD IS REQUIRED
        $fields->insertBefore(HeaderField::create('BlockHeader', self::$title), 'Title')

        # FIELDS - YOUR FIELDS HERE
        $fields->addFieldToTab('Root.Main', HTMLEditorField::create('Content')); // example field

        return $fields;
    }
}
```

In the example above 1 custom block field is created called Content. You can replace this / add any other fields you want. There are 3 config properties used for a block used in the block selection screen:

- $title - Block title
- $description - Block description
- $preview - Preview image for the block. You can point this to an image folder in your theme or similar. 360w x 150h.

Next in your theme folder create a folder at themes/{YourTheme}/templates/Block/ and add the EditorBlock.ss template within with the following content:

```

    $Content

```

### Add Block YML Config

[](#add-block-yml-config)

The final step to configuring your blocks is to set up the block YML config:

```
---
Name: block config
---
CyberDuck\BlockPage\Model\ContentBlock:
  blocks:
    - EditorBlock
  restrict:
```

Visit /dev/build?flush=all

### Add Blocks in the CMS

[](#add-blocks-in-the-cms)

Go the the CMS and visit your Page / Object editing screen and you will see a new tab called Content Blocks. Here you can create new blocks, edit blocks, and re-order blocks.

---

Extra Config
------------

[](#extra-config)

### Restricting Blocks

[](#restricting-blocks)

You can restrict certain block selections to a particular page type by passing a restrict option

```
CyberDuck\BlockPage\Model\ContentBlock:
  blocks:
    - EditorBlock
    - HomeFeaturedBlock
  restrict:
    HomePage:
      - HomeFeaturedBlock
```

### Creating a Block Holder Template

[](#creating-a-block-holder-template)

If you wish to wrap all blocks within a certain template you can create a ContentBlock\_holder.ss template within the /Block/ folder.

```

    $Template

```

The loop within your page needs to change slightly and call $TemplateHolder instead of template.

```

$TemplateHolder

```

Todo
----

[](#todo)

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance25

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~66 days

Recently: every ~8 days

Total

39

Last Release

967d ago

Major Versions

1.1.3 → 3.x-dev2017-09-15

3.x-dev → 4.0.02017-10-26

PHP version history (3 changes)1.0.7PHP &gt;=5.4.0

4.0.0PHP &gt;=5.6

4.10.1PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c45a99726cc30692bc4821cfc198df1f5de85b1a15f9b66a0bf739acbac0309?d=identicon)[cyber-duck](/maintainers/cyber-duck)

---

Top Contributors

[![claire-cyber-duck](https://avatars.githubusercontent.com/u/146204474?v=4)](https://github.com/claire-cyber-duck "claire-cyber-duck (7 commits)")[![jelicanin](https://avatars.githubusercontent.com/u/692844?v=4)](https://github.com/jelicanin "jelicanin (3 commits)")[![waiyanheincyberduck](https://avatars.githubusercontent.com/u/43062909?v=4)](https://github.com/waiyanheincyberduck "waiyanheincyberduck (3 commits)")[![worzy](https://avatars.githubusercontent.com/u/1092417?v=4)](https://github.com/worzy "worzy (2 commits)")

---

Tags

blocksmodularmodulephpsilverstripesilverstripe-4pagesilverstripesilverstripe 4modular pageblock page

### Embed Badge

![Health badge](/badges/cyber-duck-silverstripe-block-page/health.svg)

```
[![Health](https://phpackages.com/badges/cyber-duck-silverstripe-block-page/health.svg)](https://phpackages.com/packages/cyber-duck-silverstripe-block-page)
```

###  Alternatives

[composer/installers

A multi-framework Composer library installer

1.4k141.0M6.6k](/packages/composer-installers)[silverstripe/framework

The SilverStripe framework

7223.7M2.7k](/packages/silverstripe-framework)[silverstripe/cms

The SilverStripe Content Management System

5163.5M1.3k](/packages/silverstripe-cms)[dnadesign/silverstripe-elemental

Elemental pagetype and collection of Elements

1101.1M295](/packages/dnadesign-silverstripe-elemental)[silverstripe/behat-extension

SilverStripe framework extension for Behat

31577.6k5](/packages/silverstripe-behat-extension)[cwp/cwp

CWP features module. We strongly recommend using it for all new sites. Future features will be delivered here.

11224.8k7](/packages/cwp-cwp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
