Last active
June 30, 2016 17:26
-
-
Save FMCorz/640423de761fa294cb36 to your computer and use it in GitHub Desktop.
Example of a simple renderable implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class \core\renderable\user_post implements renderable { | |
public function get_properties() { | |
return array( | |
'picture': \core\renderable\picture, | |
'name': \core\renderable\fullname, | |
'text': RENDERABLE_TYPE_LONGTEXT, | |
'intro': RENDERABLE_TYPE_SHORTTEXT | |
) | |
} | |
} | |
class \core\renderable\picture implements renderable { | |
public function get_properties() { | |
return array( | |
'url': RENDERABLE_TYPE_URL, | |
'width': RENDERABLE_TYPE_INT, | |
) | |
} | |
} | |
class \core\renderable\fullname implements renderable { | |
public function get_properties() { | |
return array( | |
'firstname': RENDERABLE_TYPE_FIRSTNAME, | |
'lastname': RENDERABLE_TYPE_LASTNAME, | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment