LLMS_Quiz::toArrayAfter( array $arr )
Called before data is sorted and returned by $this->toArray().
Description Description
Extending classes should override this data if custom data should be added when object is converted to an array or json.
Parameters Parameters
- $arr
-
(array) (Required) Array of data to be serialized.
Return Return
(array)
Source Source
File: includes/models/model.llms.quiz.php
protected function toArrayAfter( $arr ) { $arr['questions'] = array(); // Builder lazy loads questions via ajax. global $llms_builder_lazy_load; if ( ! $llms_builder_lazy_load ) { foreach ( $this->get_questions() as $question ) { $arr['questions'][] = $question->toArray(); } } // If theme has legacy support quiz layouts, add theme metadata to the array. if ( get_theme_support( 'lifterlms-quizzes' ) && has_filter( 'llms_get_quiz_theme_settings' ) ) { $layout = llms_get_quiz_theme_setting( 'layout' ); if ( $layout ) { $arr[ $layout['id'] ] = get_post_meta( $this->get( 'id' ), $layout['id'], true ); } } return $arr; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.38.0 | Only add theme metadata to the quiz array when the llms_get_quiz_theme_settings filter is being used. |
3.3.0 | |
3.19.2 | Introduced. |