public function Elements() { $result = $this->getComponents('Widgets'); $list = new HasManyList('BaseElement', $result->getForeignKey()); $list->setDataModel($this->model); $list->sort('Sort ASC'); $list = $list->forForeignID($this->ID); return $list; }
public function Elements() { $result = $this->getComponents('Widgets'); if ($result instanceof UnsavedRelationList) { return array(); } $list = new HasManyList('BaseElement', $result->getForeignKey()); $list->setDataModel($this->model); $list->sort('Sort ASC'); $list = $list->forForeignID($this->ID); $list = $list->filter(array('Enabled' => 1)); return $list; }
/** * Returns all the {@link BaseElement} instances in this area, regardless if * they are enabled or not. * * @return HasManyList */ public function AllElements() { $result = $this->getComponents('Widgets'); if ($result instanceof UnsavedRelationList) { // Setup a proper UnsavedRelationList so that a page using this extension can be created // programmatically and have unsaved/saved BaseElement records attached to it. // NOTE(SilbinaryWolf): Able to set protected var 'dataClass' due to ViewableData using magic get/set for properties $result->dataClass = 'BaseElement'; // Change from 'Widget' to 'BaseElement' return $result; } $list = new HasManyList('BaseElement', $result->getForeignKey()); $list->setDataModel($this->model); $list->sort('Sort ASC'); $list = $list->forForeignID($this->ID); return $list; }