PHP Class Yoast_Form, wordpress-seo

ファイルを表示 Open project: yoast/wordpress-seo Class Usage Examples

Public Properties

Property Type Description
$instance Instance of this class
$option_name string
$options array

Public Methods

Method Description
admin_footer ( boolean $submit = true, boolean $show_sidebar = true ) Generates the footer for admin pages
admin_header ( boolean $form = true, string $option = 'wpseo', boolean $contains_files = false, boolean $option_long_name = false ) Generates the header for admin pages
admin_sidebar ( ) Generates the sidebar for admin pages.
checkbox ( string $var, string $label, boolean $label_left = false ) Create a Checkbox input field.
file_upload ( string $var, string $label ) Create a File upload field.
get_instance ( ) : Yoast_Form Get the singleton instance of this class
hidden ( string $var, string $id = '' ) Create a hidden input field.
label ( string $text, array $attr ) Output a label element
legend ( string $text, array $attr ) Output a legend element.
light_switch ( string $var, string $label, array $buttons = [], boolean $reverse = true ) Create a light switch input field.
media_input ( string $var, string $label ) Media input
radio ( string $var, array $values, string $legend = '', array $legend_attr = [] ) Create a Radio input field.
select ( string $field_name, string $label, array $select_options ) Create a Select Box.
set_option ( string $option_name ) Set the option used in output for form elements
textarea ( string $var, string $label, array $attr = [] ) Create a textarea.
textinput ( string $var, string $label, array | string $attr = [] ) Create a Text input field.
toggle_switch ( string $var, array $values, string $label ) Create a toggle switch input field.

Private Methods

Method Description
get_option ( ) : array Retrieve options based on whether we're on multisite or not.
get_plugin_banners ( ) : WPSEO_Admin_Banner_Spot Returns two random selected plugin banners.
get_service_banners ( ) : WPSEO_Admin_Banner_Spot Returns two random selected service banners.

Method Details

admin_header() public method

Generates the header for admin pages
public admin_header ( boolean $form = true, string $option = 'wpseo', boolean $contains_files = false, boolean $option_long_name = false )
$form boolean Whether or not the form start tag should be included.
$option string The short name of the option to use for the current page.
$contains_files boolean Whether the form should allow for file uploads.
$option_long_name boolean Group name of the option.

admin_sidebar() public method

Generates the sidebar for admin pages.
public admin_sidebar ( )

checkbox() public method

Create a Checkbox input field.
public checkbox ( string $var, string $label, boolean $label_left = false )
$var string The variable within the option to create the checkbox for.
$label string The label to show for the variable.
$label_left boolean Whether the label should be left (true) or right (false).

file_upload() public method

Create a File upload field.
public file_upload ( string $var, string $label )
$var string The variable within the option to create the file upload field for.
$label string The label to show for the variable.

get_instance() public static method

Get the singleton instance of this class
public static get_instance ( ) : Yoast_Form
return Yoast_Form

hidden() public method

Create a hidden input field.
public hidden ( string $var, string $id = '' )
$var string The variable within the option to create the hidden input for.
$id string The ID of the element.

label() public method

Output a label element
public label ( string $text, array $attr )
$text string Label text string.
$attr array HTML attributes set.

legend() public method

Output a legend element.
public legend ( string $text, array $attr )
$text string Legend text string.
$attr array HTML attributes set.

light_switch() public method

Create a light switch input field.
public light_switch ( string $var, string $label, array $buttons = [], boolean $reverse = true )
$var string The variable within the option to create the checkbox for.
$label string The label to show for the variable.
$buttons array Array of two labels for the buttons (defaults Off/On).
$reverse boolean Reverse order of buttons (default true).

media_input() public method

Media input
public media_input ( string $var, string $label )
$var string Option name.
$label string Label message.

radio() public method

Create a Radio input field.
public radio ( string $var, array $values, string $legend = '', array $legend_attr = [] )
$var string The variable within the option to create the radio button for.
$values array The radio options to choose from.
$legend string Optional. The legend to show for the field set, if any.
$legend_attr array Optional. The attributes for the legend, if any.

select() public method

Create a Select Box.
public select ( string $field_name, string $label, array $select_options )
$field_name string The variable within the option to create the select for.
$label string The label to show for the variable.
$select_options array The select options to choose from.

set_option() public method

Set the option used in output for form elements
public set_option ( string $option_name )
$option_name string Option key.

textarea() public method

Create a textarea.
public textarea ( string $var, string $label, array $attr = [] )
$var string The variable within the option to create the textarea for.
$label string The label to show for the variable.
$attr array The CSS class to assign to the textarea.

textinput() public method

Create a Text input field.
public textinput ( string $var, string $label, array | string $attr = [] )
$var string The variable within the option to create the text input field for.
$label string The label to show for the variable.
$attr array | string Extra class to add to the input field.

toggle_switch() public method

Create a toggle switch input field.
public toggle_switch ( string $var, array $values, string $label )
$var string The variable within the option to create the file upload field for.
$values array The radio options to choose from.
$label string The label to show for the variable.

Property Details

$instance public_oe static_oe property

Instance of this class
public static $instance

$option_name public_oe property

public string $option_name
return string

$options public_oe property

public array $options
return array