Allow html in description

This commit is contained in:
Mike Jolley 2017-01-17 15:50:19 +00:00
parent cb04d5985a
commit 17481af671
5 changed files with 10 additions and 10 deletions

View File

@ -362,7 +362,7 @@
onChangeShippingMethodSelector: function() {
var description = $( this ).find( 'option:selected' ).data( 'description' );
$( this ).parent().find( '.wc-shipping-zone-method-description' ).remove();
$( this ).after( '<p class="wc-shipping-zone-method-description">' + description + '</p>' );
$( this ).after( '<div class="wc-shipping-zone-method-description">' + description + '</div>' );
$( this ).closest( 'article' ).height( $( this ).parent().height() );
},
onTogglePostcodes: function( event ) {

File diff suppressed because one or more lines are too long

View File

@ -112,7 +112,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</td>
<td class="wc-shipping-zone-method-type">{{ data.method_title }}</td>
<td width="1%" class="wc-shipping-zone-method-enabled"><a href="#">{{{ data.enabled_icon }}}</a></td>
<td class="wc-shipping-zone-method-description">{{ data.method_description }}</td>
<td class="wc-shipping-zone-method-description">{{{ data.method_description }}}</td>
</tr>
</script>
@ -170,8 +170,7 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( ! $method->supports( 'shipping-zones' ) ) {
continue;
}
echo '<option data-description="' . esc_attr( $method->method_description ) . '" value="' . esc_attr( $method->id ) . '">' . esc_attr( $method->method_title ) . '</li>';
echo '<option data-description="' . esc_attr( wp_kses_post( wpautop( $method->get_method_description() ) ) ) . '" value="' . esc_attr( $method->id ) . '">' . esc_attr( $method->get_method_title() ) . '</li>';
}
?>
</select>

View File

@ -108,7 +108,7 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( ! $method->supports( 'shipping-zones' ) ) {
continue;
}
echo '<option data-description="' . esc_attr( $method->method_description ) . '" value="' . esc_attr( $method->id ) . '">' . esc_attr( $method->method_title ) . '</li>';
echo '<option data-description="' . esc_attr( wp_kses_post( wpautop( $method->get_method_description() ) ) ) . '" value="' . esc_attr( $method->id ) . '">' . esc_attr( $method->get_method_title() ) . '</li>';
}
?>
</select>

View File

@ -188,6 +188,7 @@ class WC_Shipping_Zone extends WC_Legacy_Shipping_Zone {
$methods[ $raw_method->instance_id ]->enabled = $raw_method->is_enabled ? 'yes' : 'no';
$methods[ $raw_method->instance_id ]->has_settings = $methods[ $raw_method->instance_id ]->has_settings();
$methods[ $raw_method->instance_id ]->settings_html = $methods[ $raw_method->instance_id ]->supports( 'instance-settings-modal' ) ? $methods[ $raw_method->instance_id ]->get_admin_options_html() : false;
$methods[ $raw_method->instance_id ]->method_description = wp_kses_post( wpautop( $methods[ $raw_method->instance_id ]->method_description ) );
}
}
}