var = $variable;
$this->label = $label;
$this->buttons = $buttons;
$this->name = $name;
$this->value = $value;
$this->reverse = $reverse;
$this->help = $help;
$this->strong = $strong;
$this->disabled_attribute = $disabled_attribute;
}
/**
* Presents the light switch toggle.
*
* @return string The light switch's HTML.
*/
public function present() {
if ( empty( $this->buttons ) ) {
$this->buttons = [ \__( 'Disabled', 'wordpress-seo' ), \__( 'Enabled', 'wordpress-seo' ) ];
}
list( $off_button, $on_button ) = $this->buttons;
$class = 'switch-light switch-candy switch-yoast-seo';
if ( $this->reverse ) {
$class .= ' switch-yoast-seo-reverse';
}
$help_class = ! empty( $this->help ) ? ' switch-container__has-help' : '';
$strong_class = ( $this->strong ) ? ' switch-light-visual-label__strong' : '';
$output = '
';
$output .= \sprintf(
'
%3$s%4$s',
$strong_class, // phpcs:ignore WordPress.Security.EscapeOutput -- Reason: $strong_class output is hardcoded.
\esc_attr( $this->var . '-label' ),
\esc_html( $this->label ),
$this->help, // phpcs:ignore WordPress.Security.EscapeOutput -- Reason: The help contains HTML.
);
$output .= '
';
return $output;
}
}