Skip to content

Commit

Permalink
Merge pull request #193 from open-sausages/pulls/2/docs-better-defaul…
Browse files Browse the repository at this point in the history
…t-type

DOCS More copy/paste friendly instructions
  • Loading branch information
robbieaverill committed Feb 26, 2018
2 parents be7c88b + 71d4fc4 commit afbf56e
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ For a SilverStripe 3.x compatible version of this module, please see the [1 bran
composer require dnadesign/silverstripe-elemental 2.x-dev
```

Extend any page type with the ElementalPageExtension and define allowed elements. This can be done with SilverStripe
YAML config:
The following YAML config will enable elements on every `Page` object,
replacing the standard `Content` rich text field.

**mysite/\_config/elements.yml**

```yaml
ElementPage:
Page:
extensions:
- DNADesign\Elemental\Extensions\ElementalPageExtension
```
Expand All @@ -57,6 +57,28 @@ a look at some other modules:

## Configuration

### Limit to specific page type

If you want to use elements alongside traditional page types,
you can define an "empty" page type and assign the extension only to this type.

**mysite/src/MyElementPage.php**

```php
<?php
class MyElementPage extends Page
{
}
```

**mysite/\_config/elements.yml**

```yaml
MyElementPage:
extensions:
- DNADesign\Elemental\Extensions\ElementalPageExtension
```

### Customize HTML and markup

The basic element area is rendered into the `DNADesign/Elemental/Models/ElementalArea.ss` template. This loops over
Expand All @@ -69,15 +91,15 @@ You may wish to only enable certain elements for the CMS authors to choose from
done according to various page types:

```yaml
ElementPage:
Page:
allowed_elements:
- DNADesign\Elemental\Models\ElementContent
```

Likewise, you can exclude certain elements from being used.

```yaml
ElementPage:
Page:
disallowed_elements:
- YourCompany\YourModule\Elements\ElementContact
```
Expand Down

0 comments on commit afbf56e

Please sign in to comment.