<?php

defined( 'ABSPATH' ) || exit;

/**
 * Notification emails.
 */
class Nelio_Content_Series_Metadata_Setting extends Nelio_Content_Abstract_React_Setting {

	public function __construct() {
		parent::__construct( 'series_metadata', 'SeriesMetadataSetting' );
	}

	// @Implements
	public function sanitize( $input ) {

		$value = isset( $input[ $this->name ] ) ? $input[ $this->name ] : $this->default_value;
		$value = is_string( $value ) ? json_decode( $value, true ) : $value;
		$value = is_array( $value ) && is_array( $this->default_value ) ? wp_parse_args( $value, $this->default_value ) : $this->default_value;

		$input[ $this->name ] = $value;
		return $input;
	}
}
