Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricewijnia committed May 21, 2019
1 parent 396ac31 commit 39ce350
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,26 +183,27 @@ class MyModel extends Model {
}
```

This adds multiple methods to your model that will help you with creating/updating/rendering the Gutenberg content.
This adds multiple attributes to your model that will help you with creating/updating/rendering the Gutenberg content.

```php
$content // This is the raw content from the Gutenberg editor
$model = new MyModel;

// Add or update the content & (if true is provided) call save() on the content object
$model->setContent($content, true);
// The model has to exist or else the link between your model and the content can't be made
$model->save();

// Get the rendered HTML inside of a container
// This is the function you should use for rendering the content on a page
$model->renderContent();
// Add or update the content
$model->lb_content = $content;

// Get the rendered content
$model->getRenderedContent();
// Get the rendered HTML
$model->lb_content;

// Get the raw content
$model->getRawContent();
// Get the raw Gutenberg output, this should be in the target textarea when updating content
$model->lb_raw_content;
```

> Note: The old renderContent, getRawContent, getRenderedContent and setContent methods from v0.0.4-beta and lower are deprecated and will be removed in a future release.
### Renaming Gutenbergable method names

There is always the possibility that your model already implements a method with the same name as one of the Gutenbergable methods. Luckily PHP Traits provide an easy way to rename the methods from a trait:
Expand All @@ -226,7 +227,7 @@ Rendering the Gutenberg content is very simple and happens like this:

```html
<div id="your_container"> <!-- The element you want to render the content in -->
{!! $page->renderContent() !!}
{!! $page->lb_content !!}
</div>
```

Expand Down

0 comments on commit 39ce350

Please sign in to comment.