Noptin_Abstract_Integration::get_checkbox_markup( array $html_attrs = array() )
Returns the subscription checkbox markup.
Parameters Parameters
- $html_attrs
(array) (Optional) An array of HTML attributes.
Default value: array()
Return Return
(string)
Source Source
File: includes/integrations/class-noptin-abstract-integration.php
function get_checkbox_markup( array $html_attrs = array() ) { // Abort if we're not displaying a checkbox. if ( ! $this->can_show_checkbox() ) { return ''; } ob_start(); // Checkbox opening wrapper. echo '<!-- Noptin Newsletters - https://noptin.com/ -->'; do_action( 'noptin_integration_before_subscription_checkbox_wrapper', $this ); do_action( 'noptin_integration_' . $this->slug . '_before_subscription_checkbox_wrapper', $this ); // Prepare the label attributes. $html_attrs['class'] = empty( $html_attrs['class'] ) ? '' : $html_attrs['class']; $html_attrs['class'] = $html_attrs['class'] . sprintf( ' noptin-integration-subscription-checkbox noptin-integration-subscription-checkbox-%s', $this->slug ); // Convert them to strings. $html_attr_str = ''; foreach ( $html_attrs as $key => $value ) { $html_attr_str .= sprintf( '%s="%s" ', $key, esc_attr( $value ) ); } // usefull when wrapping the checkbox in an element. $this->before_checkbox_wrapper(); echo "<label $html_attr_str>"; echo sprintf( '<input %s />', $this->get_checkbox_attributes() ); echo sprintf( '<span>%s</span>', $this->get_label_text() ); echo '</label>'; // usefull when wrapping the checkbox in an element. $this->after_checkbox_wrapper(); // Checkbox closing wrapper. do_action( 'noptin_integration_after_subscription_checkbox_wrapper', $this ); do_action( 'noptin_integration_' . $this->slug . '_after_subscription_checkbox_wrapper', $this ); echo '<!-- / Noptin Newsletters -->'; return ob_get_clean(); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.2.6 | Introduced. |