Skip to content

Instantly share code, notes, and snippets.

@FMCorz
Last active June 30, 2016 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FMCorz/640423de761fa294cb36 to your computer and use it in GitHub Desktop.
Save FMCorz/640423de761fa294cb36 to your computer and use it in GitHub Desktop.
Example of a simple renderable implementation
<?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