Script Object

 

Parameters

  • attributes = array()

 

Functions

  • add_js ($js_string)
  • add_js_by_file ($file_path)
  • get_native_js()
  • create_script_object_by_file( $file_path, $attributes)
  • create_script_object_by_sring( $string, $attributes)

 

Usage

 

$string = "console.log('Wonderful Relations')";

$object = new ScriptObject();
$object->create_script_object_by_string($string);

$object->get_template();

Output

<script>
  console.log('Wonderful Relations');
</script>