I'm bit confused about the meaning of this line:
$show_title = Ninja_Forms()->form( $form_id )->get_setting( 'show_title' );
Is ->
available in PHP, or it used only within WordPress.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI'm bit confused about the meaning of this line:
$show_title = Ninja_Forms()->form( $form_id )->get_setting( 'show_title' );
Is ->
available in PHP, or it used only within WordPress.
NO ->
is not wordpress specific, it is object operator in php.
When you want to call a method of an instance then you call the method with ->
Class SomeClass{
function example(){
return 'This is an example function'
}
}
$obj = new SomeClass();
$obj->example(); // we are calling example function with -> operator
Additional Info: there is one more operator :: which is used to call for static methods of a class.
Ninja_Forms()->form( $form_id )->get_setting( 'show_title' );
Ninja_Forms()
is a function which returns an object instance. so calling an method of it is form($form_id)
and now this too returns an object instance. finally calling the method get_setting('show_title');
– WPTC-Troop
Nov 27 '15 at 11:27