Skip to content

Instantly share code, notes, and snippets.

Created November 26, 2014 16:49
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 anonymous/fffefd3e7ece5f537054 to your computer and use it in GitHub Desktop.
Save anonymous/fffefd3e7ece5f537054 to your computer and use it in GitHub Desktop.
public function getColour() {
// Try returning banners for this page
$colour = $this->getField('HexColor');
if ( $colour ) {
return $colour;
}
// No colour for this page? Loop through the parents.
$parent = $this->Parent();
if ( $parent->ID ) {
return $parent->getColour();
}
// Still need a fallback position (handled by template)
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment