diff --git a/_config/model.yml b/_config/model.yml index 804f801..00ee64d 100644 --- a/_config/model.yml +++ b/_config/model.yml @@ -15,6 +15,9 @@ SilverStripe\Core\Injector\Injector: class: SilverWare\ORM\FieldType\DBDimensions Viewports: class: SilverWare\ORM\FieldType\DBViewports + SilverWare\Extensions\Lists\ListSourceExtension: + class: SilverWare\Extensions\Lists\ListSourceExtension + type: prototype # Configure Fixture Factory: diff --git a/src/Extensions/Lists/ListItemExtension.php b/src/Extensions/Lists/ListItemExtension.php index 92d3c4c..241335c 100644 --- a/src/Extensions/Lists/ListItemExtension.php +++ b/src/Extensions/Lists/ListItemExtension.php @@ -44,13 +44,6 @@ class ListItemExtension extends Extension */ const DEFAULT_LIST_ITEM_TEMPLATE = 'SilverWare\Lists\ListItem'; - /** - * Holds the component instance responsible for rendering the extended object. - * - * @var Component - */ - protected $renderer; - /** * Defines the value of the renderer attribute. * @@ -60,7 +53,7 @@ class ListItemExtension extends Extension */ public function setRenderer(Component $renderer) { - $this->renderer = $renderer; + $this->owner->setField('renderer', $renderer); return $this; } @@ -72,7 +65,7 @@ public function setRenderer(Component $renderer) */ public function getRenderer() { - return $this->renderer; + return $this->owner->getField('renderer'); } /** @@ -124,7 +117,7 @@ public function getListItemClassNames() $classes, ViewTools::singleton()->getAncestorClassNames( $this->owner, - $this->ownerBaseClass + $this->owner->baseClass() ) ); diff --git a/src/Extensions/Lists/ListViewExtension.php b/src/Extensions/Lists/ListViewExtension.php index 46a8b0d..842dea8 100644 --- a/src/Extensions/Lists/ListViewExtension.php +++ b/src/Extensions/Lists/ListViewExtension.php @@ -561,6 +561,8 @@ public function getListClassOptions() */ public function getListObject() { + $this->owner->flushCache(); + return $this->owner->getComponent('ListObject'); } @@ -748,7 +750,7 @@ protected function getListOptionFields() * * @return FieldList */ - public function hideFields(FieldList $fields) + protected function hideFields(FieldList $fields) { if ($this->owner->ListInherit) { diff --git a/src/Extensions/StyleExtension.php b/src/Extensions/StyleExtension.php index 498b932..1fe1427 100644 --- a/src/Extensions/StyleExtension.php +++ b/src/Extensions/StyleExtension.php @@ -125,7 +125,7 @@ protected function apply() * * @return boolean */ - public function hasAppliedStyles() + protected function hasAppliedStyles() { return is_array($this->getAppliedStyles()); }