Method
Create a new instance.
__construct( string $name, array $args = array() )
public
Parameters
-
$namestring - The form name.
-
$argsarray Defaultarray() -
Optional. An array of arguments.
-
$actionstring - The form action. Default empty.
-
$methodstring - The form method. Default 'post'.
-
$attributesarray - The form attributes. Default empty array.
-
Source
public function __construct( $name, $args = array() ) {
$this->set_name( $name );
$args = wp_parse_args(
$args,
array(
'action' => '',
'method' => 'post',
'attributes' => array(),
)
);
$this->set_action( $args['action'] );
$this->set_method( $args['method'] );
$this->errors = new WP_Error();
// Add the default links
foreach ( tml_get_actions() as $action ) {
if ( $action->show_on_forms && $action->get_name() !== $this->get_name() ) {
$this->add_link(
$action->get_name(),
array(
'text' => true === $action->show_on_forms ? $action->get_title() : $action->show_on_forms,
'url' => $action->get_url(),
)
);
}
}
foreach ( (array) $args['attributes'] as $key => $value ) {
$this->add_attribute( $key, $value );
}
if ( ! empty( $args['render_args'] ) ) {
$this->render_args = (array) $args['render_args'];
}
} View src/includes/class-theme-my-login-form.php, line 89 on GitHub
Uses
Used by
Changelog
| Version | Description |
|---|---|
| 7.0 | Introduced. |