-
-
Save sjelfull/1493583 to your computer and use it in GitHub Desktop.
A better way to fetch EE parameters
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
| private function param($param, $default = FALSE, $boolean = FALSE, $required = FALSE) | |
| { | |
| if($required && !$param) show_error('You must define a "'.$param.'" parameter in the '.__CLASS__.' tag.'); | |
| $param = $this->EE->TMPL->fetch_param($param); | |
| if($param === FALSE && $default !== FALSE) | |
| { | |
| $param = $default; | |
| } | |
| else | |
| { | |
| if($boolean) | |
| { | |
| $param = strtolower($param); | |
| $param = ($param == 'true' || $param == 'yes') ? TRUE : FALSE; | |
| } | |
| } | |
| return $param; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment