LLMS_Course::toArrayAfter( array $arr )
Add data to the course model when converted to array
Description Description
Called before data is sorted and returned by $this->jsonSerialize().
Parameters Parameters
- $arr
-
(array) (Required) Data to be serialized.
Return Return
(array)
Source Source
File: includes/models/model.llms.course.php
public function toArrayAfter( $arr ) {
$product = $this->get_product();
$arr['access_plans'] = array();
foreach ( $product->get_access_plans( false, false ) as $p ) {
$arr['access_plans'][] = $p->toArray();
}
$arr['sections'] = array();
foreach ( $this->get_sections() as $s ) {
$arr['sections'][] = $s->toArray();
}
$arr['categories'] = $this->get_categories(
array(
'fields' => 'names',
)
);
$arr['tags'] = $this->get_tags(
array(
'fields' => 'names',
)
);
$arr['tracks'] = $this->get_tracks(
array(
'fields' => 'names',
)
);
$arr['difficulty'] = $this->get_difficulty();
return $arr;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.8.0 | Unknown. |
| 3.3.0 | Introduced. |