Yoast_Form::index_switch()
Creates a toggle switch to define whether an indexable should be indexed or not.
Метод класса: Yoast_Form{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$Yoast_Form = new Yoast_Form(); $Yoast_Form->index_switch( $variable, $label, $help, $attr );
- $variable(строка) (обязательный)
- The variable within the option to create the radio buttons for.
- $label(строка) (обязательный)
- The visual label for the radio buttons group, used as the fieldset legend.
- $help(строка)
- Inline Help that will be printed out before the visible toggles text.
По умолчанию: '' - $attr(массив)
- Extra attributes to add to the index switch.
По умолчанию: []
Код Yoast_Form::index_switch() Yoast Form::index switch Yoast 22.3
public function index_switch( $variable, $label, $help = '', $attr = [] ) { $defaults = [ 'disabled' => false, ]; $attr = wp_parse_args( $attr, $defaults ); $index_switch_values = [ 'off' => __( 'On', 'wordpress-seo' ), 'on' => __( 'Off', 'wordpress-seo' ), ]; $is_disabled = ( isset( $attr['disabled'] ) && $attr['disabled'] ); $this->toggle_switch( $variable, $index_switch_values, sprintf( /* translators: %s expands to an indexable object's name, like a post type or taxonomy */ esc_html__( 'Show %s in search results?', 'wordpress-seo' ), $label ), $help, [ 'disabled' => $is_disabled ] ); }