LLMS_Question::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.question.php
* * @param array $arr Array of data to be serialized. * @return array */ protected function toArrayAfter( $arr ) { unset( $arr['author'] ); unset( $arr['date'] ); unset( $arr['excerpt'] ); unset( $arr['modified'] ); unset( $arr['status'] ); $choices = array(); foreach ( $this->get_choices() as $choice ) { $choices[] = $choice->get_data(); } $arr['choices'] = $choices; if ( 'group' === $this->get( 'question_type' ) ) { $arr['questions'] = array(); foreach ( $this->get_questions() as $question ) { $arr['questions'][] = $question->toArray(); } }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.3.0 | |
3.16.0 | Introduced. |