-
-
Save nathanbrauer/0c17435524101374670a 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
<?php | |
/** | |
* mysite/code/SomeExtension.php | |
* | |
* @author Nathan J. Brauer http://NathanBrauer.com | |
* @package SilverStripe-SomeExtension | |
*/ | |
class SomeDataObject extends DataObject { | |
static $extensions = array( | |
'SomeExtension', | |
); | |
function MethodOptionA() { | |
return "<p>Option <strong>A</strong></p>"; | |
} | |
function MethodOptionB() { | |
return "<p>Option <strong>B</strong></p>"; | |
} | |
} |
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
<?php | |
/** | |
* mysite/code/SomeExtension.php | |
* | |
* @author Nathan J. Brauer http://NathanBrauer.com | |
* @package SilverStripe-SomeExtension | |
*/ | |
class SomeExtension extends DataExtension { | |
function MethodOptionA() { | |
$Data = $this->owner->MethodOptionA(); | |
return ($Data) ? strip_tags($Data) : false; | |
} | |
function MethodOptionB() { | |
$Data = parent::MethodOptionB(); | |
return ($Data) ? strip_tags($Data) : false; | |
} | |
} |
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
<?php | |
$Some = new SomeDataObject; | |
//Which will work? | |
var_dump($Some->MethodOptionA()); | |
// Option A | |
var_dump($Some->MethodOptionB()); | |
// Option B | |
//Or is there a better way? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment