: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Sidebar generator custom field created for Redux Framework
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
if ( ! class_exists( 'ReduxFramework_sidgen' ) ) {
* Main ReduxFramework_sidgen class
class ReduxFramework_sidgen {
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
function __construct( $field = array(), $value = '', $parent ) {
* Takes the vars and outputs the HTML for the field in the settings
public function render() {
$this->add_text = ( isset( $this->field['add_text'] ) ) ? $this->field['add_text'] : esc_html__( 'Add Sidebar', 'opinion' );
echo '<ul id="' . $this->field['id'] . '-ul" class="redux-multi-text">';
if ( isset( $this->value ) && is_array( $this->value ) ) {
foreach ( $this->value as $k => $value ) {
echo '<li><input type="text" id="' . $this->field['id'] . '-' . $k . '" name="' . $this->field['name'] . $this->field['name_suffix'] . '['.$k.']' . '" value="' . esc_attr( $value ) . '" class="regular-text ' . $this->field['class'] . '" /> <a href="javascript:void(0);" class="deletion redux-multi-text-remove">X</a></li>';
echo '<li style="display:none;"><input type="text" id="' . $this->field['id'] . '" name="" value="" class="regular-text" /> <a href="javascript:void(0);" class="deletion redux-multi-text-remove">X</a></li>';
echo '<span style="clear:both;display:block;height:0;" /></span>';
echo '<a href="javascript:void(0);" class="button button-secondary redux-multi-text-add" data-id="' . $this->field['id'] . '-ul" data-name="' . $this->field['name'] . $this->field['name_suffix'] . '">' . $this->add_text . '</a>';
echo '<input type="hidden" class="lastkey" name="' . $this->field['name'] . $this->field['name_suffix'] . '[lastkey]'.'" value="' . esc_attr( $lastkey ) . '">';
* If this field requires any scripts, or css define this function and register/enqueue the scripts/css
public function enqueue() {
get_template_directory_uri().'/core/admin/options-custom-fields/sidgen/field_sidgen.js',
array( 'jquery', 'redux-js' ),