Inherit
Inherit from Document
(s).
Description
$this Document::inherit(Document $parent [, int $mode = Document::INHERIT_CONFIG])
Parameters
$parent
: The document to be inherited from.$mode
: Mode to be used while inheritin. Default modeDocument::INHERIT_CONFIG
Modes
| Mode Constant | Mode Description | |-------------------------|----------------------------------------------------------------------------------| | INHERITCONFIG | Inherit only config. | | INHERITCONTENTREPLACE | Inherit only content. Replaces current content with that form parent document. | | INHERITCONTENTAPPEND | Inherit only content. Prepends content from parent document to current document. | | INHERITALLREPLACE | Inherit both config and content. Same as `INHERITCONTENTREPLACE` | | INHERITALLAPPEND | Inherit both config and content. Same as `INHERITCONTENT_APPEND` |
Return Value
- Current instance of document (
$this
). Makes Method Chainable.
Usage
$parent = new Document('Lorem Ipsum dol sidur.....', ['title'=> 'Not A Random Title', 'layout' => 'grid']);
$document = new Document('Lorem Ipsum.....', ['title'=> 'Random Title', 'category' => 'just another category']);
$document->inherit($parent);
$document->getConfig();
//['title'=> 'Random Title', 'layout'=> 'grid', 'category' => 'just another category']