This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Error Warning Removed by adding one line of code

9 years ago · Last reply by Greg Priday 9 years ago

In the code of the class SiteOrigin_Widget_Field_Link
add the line in red to remove a warning, could you include this correction in your code for future updates ?

/**
* Class SiteOrigin_Widget_Field_Link
*/
class SiteOrigin_Widget_Field_Link extends SiteOrigin_Widget_Field_Text_Input_Base {

/**
* An array of post types to use in the query for posts when the ‘Select Content’ button is clicked.
*
* @access protected
* @var array
*/
protected $post_types;

protected function render_before_field( $value, $instance ) {
parent::render_before_field( $value, $instance );
if(!is_array($this->post_types)) $this->post_types=array();
?>

<input type="text" class="content-text-search"
data-post-types="post_types ) ) ?>”
placeholder=””/>

<?php
parent::render_after_field( $value, $instance );
}

protected function sanitize_field_input( $value, $instance ) {
$sanitized_value = trim( $value );
if ( preg_match( '/^post: *([0-9]+)/', $sanitized_value, $matches ) ) {
$sanitized_value = 'post: ' . $matches[1];
} else {
$sanitized_value = sow_esc_url_raw( $sanitized_value );
}

return $sanitized_value;
}

}

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

1
  1. Greg Priday Staff 9 years, 21 days ago

    Thanks for the recommendation Arnaud. I’ve implemented something like this in the development version. It’ll be available in the next update.

Replies on this thread are closed.

Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Have a different question or issue?

Start New Thread