Created
November 26, 2014 16:49
-
-
Save anonymous/fffefd3e7ece5f537054 to your computer and use it in GitHub Desktop.
This file contains 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
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