Method
Render the entire form with notices and links.
render( array $args = array() )
public
Parameters
-
$argsarray Defaultarray() -
Optional. An array of arguments for rendering a form.
-
$containerstring - The form container element.
-
$container_classstring - The form container class.
-
$container_idstring - The form container ID.
-
$beforestring - The content to render before the form.
-
$afterstring - The content to render after the form.
-
$show_linksbool - Whether to show the links or not.
-
Return
string
The form markup.
Source
public function render( $args = array() ) {
$defaults = wp_parse_args(
$this->render_args,
array(
'container' => 'div',
'container_class' => 'tml tml-%s',
'container_id' => '',
'before' => '',
'after' => '',
'show_links' => true,
'show_form' => true,
)
);
/**
* Fires before rendering a form.
*
* @since 7.0.13
*
* @param string $name The form name.
* @param Theme_My_Login_Form $form The form object.
*/
do_action( 'tml_render_form', $this->name, $this );
$args = wp_parse_args( $args, $defaults );
$output = $args['before'];
if ( ! empty( $args['container'] ) ) {
$output .= '<' . $args['container'];
if ( ! empty( $args['container_id'] ) ) {
$output .= ' id="' . esc_attr( sprintf( $args['container_id'], $this->name ) ) . '"';
}
if ( ! empty( $args['container_class'] ) ) {
$output .= ' class="' . esc_attr( sprintf( $args['container_class'], $this->name ) ) . '"';
}
$output .= ">\n";
}
/**
* Filter the content before the form.
*
* @since 7.0.13
*
* @param string $output The output.
* @param string $name The form name.
* @param Theme_My_Login_Form $form The form object.
*/
$output = apply_filters( 'tml_before_form', $output, $this->name, $this );
$output .= '<div class="tml-alerts">' . $this->render_errors() . '</div>';
if ( $args['show_form'] ) {
$output .= $this->render_form();
}
/**
* Filter the content after the form.
*
* @since 7.0.13
*
* @param string $output The output.
* @param string $name The form name.
* @param Theme_My_Login_Form $form The form object.
*/
$output = apply_filters( 'tml_after_form', $output, $this->name, $this );
if ( $args['show_links'] ) {
$output .= $this->render_links();
}
if ( ! empty( $args['container'] ) ) {
$output .= '</' . $args['container'] . ">\n";
}
$output .= $args['after'];
return $output;
} View src/includes/class-theme-my-login-form.php, line 579 on GitHub
Uses
Used by
Changelog
| Version | Description |
|---|---|
| 7.0 | Introduced. |