Skip to content

Instantly share code, notes, and snippets.

@lots0logs
Last active March 26, 2018 08:55
Show Gist options
  • Save lots0logs/e027e6c903514838b73eec21861d723a to your computer and use it in GitHub Desktop.
Save lots0logs/e027e6c903514838b73eec21861d723a to your computer and use it in GitHub Desktop.
Module Setting Default Value Example 2
class SimpleHeader extends Component {
// Example 1: Text orientation has been set to the non-default value 'right'
render() {
console.log(this.props.text_orientation); // Outputs: 'right'
}
// Example 2: Text orientation has been set to the default value 'left'
render() {
console.log(this.props.text_orientation); // Outputs: ''
}
// Example 3: Text orientation setting definition included the 'default_on_front' parameter set to 'true'
// Text orientation has been set to the default value 'left'
render() {
console.log(this.props.text_orientation); // Outputs: 'left'
}
}
<?php
class SIMP_SimpleHeader extends ET_Builder_Module {
// Example 1: Text orientation has been set to the non-default value 'right'
public function render( $unprocessed_props, $content = null, $render_slug ) {
echo $this->props['text_orientation']; // Outputs: 'right'
}
// Example 2: Text orientation has been set to the default value 'left'
public function render( $unprocessed_props, $content = null, $render_slug ) {
echo $this->props['text_orientation']; // Outputs: ''
}
// Example 3: Text orientation setting definition included the 'default_on_front' parameter set to 'true'
// Text orientation has been set to the default value 'left'
public function render( $unprocessed_props, $content = null, $render_slug ) {
echo $this->props['text_orientation']; // Outputs 'left'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment