lots0logs
3/26/2018 - 8:44 AM

Module Setting Default Value Example 2

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'
	}
}