function init() {
		$_option = 'pressbooks_theme_options_' . $this->getSlug();
		$_page = $_option;
		$_section = $this->getSlug() . '_options_section';
		$meta = new Metadata();

		if ( false === get_option( $_option ) ) {
			add_option( $_option, $this->defaults );
		}

		add_settings_section(
			$_section,
			$this->getTitle(),
			[ $this, 'display' ],
			$_page
		);

		add_settings_field(
			'social_media',
			__( 'Enable Social Media', 'pressbooks' ),
			[ $this, 'renderSocialMediaField' ],
			$_page,
			$_section,
			[
				__( 'Add buttons to cover page and each chapter so that readers may share links to your book through social media: Facebook, Twitter, Google+', 'pressbooks' ),
			]
		);

		add_settings_field(
			'webbook_width',
			__( 'Webbook Width', 'pressbooks' ),
			[ $this, 'renderWebbookWidthField' ],
			$_page,
			$_section,
			[
				'30em' => __( 'Narrow', 'pressbooks' ),
				'40em' => __( 'Standard', 'pressbooks' ),
				'48em' => __( 'Wide', 'pressbooks' ),
				'label_for' => 'webbook_width',
			]
		);

		add_settings_field(
			'paragraph_separation',
			__( 'Paragraph Separation', 'pressbooks' ),
			[ $this, 'renderParagraphSeparationField' ],
			$_page,
			$_section,
			[
				'indent' => __( 'Indent paragraphs', 'pressbooks' ),
				'skiplines' => __( 'Skip lines between paragraphs', 'pressbooks' ),
			]
		);

		add_settings_field(
			'part_title',
			__( 'Display Part Title', 'pressbooks' ),
			[ $this, 'renderPartTitle' ],
			$_page,
			$_section,
			[
				__( 'Display the Part title on each chapter', 'pressbooks' ),
			]
		);

		if ( Container::get( 'Styles' )->hasBuckram() ) {
			add_settings_field(
				'collapse_sections',
				__( 'Collapse Sections', 'pressbooks' ),
				[ $this, 'renderCollapseSections' ],
				$_page,
				$_section,
				[
					__( 'Collapse sections within front matter, chapters, and back matter', 'pressbooks' ),
				]
			);
		}

		if ( get_post_meta( $meta->getMetaPostId(), 'pb_is_based_on', true ) ) {
			add_settings_field(
				'enable_source_comparison',
				__( 'Enable Source Comparison', 'pressbooks' ),
				[ $this, 'renderEnableSourceComparison' ],
				$_page,
				$_section,
				[
					__( 'Add comparison tool to the end of each front matter, part, chapter, and back matter', 'pressbooks' ),
					__( 'Allows readers to compare content with the original book from which it was cloned.', 'pressbooks' ),
				]
			);
		}

		/**
		 * Add custom settings fields.
		 *
		 * @since 3.9.7
		 *
		 * @param string $arg1
		 * @param string $arg2
		 */
		do_action( 'pb_theme_options_web_add_settings_fields', $_page, $_section );

		register_setting(
			$_page,
			$_option,
			[ $this, 'sanitize' ]
		);
	}
function init() {
		$_option = 'pressbooks_theme_options_' . $this->getSlug();
		$_page = $_option;
		$_section = $this->getSlug() . '_options_section';
		$meta = new Metadata();

		if ( false === get_option( $_option ) ) {
			add_option( $_option, $this->defaults );
		}

		add_settings_section(
			$_section,
			$this->getTitle(),
			[ $this, 'display' ],
			$_page
		);

		add_settings_field(
			'social_media',
			__( 'Enable Social Media', 'pressbooks' ),
			[ $this, 'renderSocialMediaField' ],
			$_page,
			$_section,
			[
				__( 'Add buttons to cover page and each chapter so that readers may share links to your book through social media: Facebook, Twitter, Google+', 'pressbooks' ),
			]
		);

		add_settings_field(
			'webbook_width',
			__( 'Webbook Width', 'pressbooks' ),
			[ $this, 'renderWebbookWidthField' ],
			$_page,
			$_section,
			[
				'30em' => __( 'Narrow', 'pressbooks' ),
				'40em' => __( 'Standard', 'pressbooks' ),
				'48em' => __( 'Wide', 'pressbooks' ),
				'label_for' => 'webbook_width',
			]
		);

		add_settings_field(
			'paragraph_separation',
			__( 'Paragraph Separation', 'pressbooks' ),
			[ $this, 'renderParagraphSeparationField' ],
			$_page,
			$_section,
			[
				'indent' => __( 'Indent paragraphs', 'pressbooks' ),
				'skiplines' => __( 'Skip lines between paragraphs', 'pressbooks' ),
			]
		);

		add_settings_field(
			'part_title',
			__( 'Display Part Title', 'pressbooks' ),
			[ $this, 'renderPartTitle' ],
			$_page,
			$_section,
			[
				__( 'Display the Part title on each chapter', 'pressbooks' ),
			]
		);

		if ( Container::get( 'Styles' )->hasBuckram() ) {
			add_settings_field(
				'collapse_sections',
				__( 'Collapse Sections', 'pressbooks' ),
				[ $this, 'renderCollapseSections' ],
				$_page,
				$_section,
				[
					__( 'Collapse sections within front matter, chapters, and back matter', 'pressbooks' ),
				]
			);
		}

		if ( get_post_meta( $meta->getMetaPostId(), 'pb_is_based_on', true ) ) {
			add_settings_field(
				'enable_source_comparison',
				__( 'Enable Source Comparison', 'pressbooks' ),
				[ $this, 'renderEnableSourceComparison' ],
				$_page,
				$_section,
				[
					__( 'Add comparison tool to the end of each front matter, part, chapter, and back matter', 'pressbooks' ),
					__( 'Allows readers to compare content with the original book from which it was cloned.', 'pressbooks' ),
				]
			);
		}

		/**
		 * Add custom settings fields.
		 *
		 * @since 3.9.7
		 *
		 * @param string $arg1
		 * @param string $arg2
		 */
		do_action( 'pb_theme_options_web_add_settings_fields', $_page, $_section );

		register_setting(
			$_page,
			$_option,
			[ $this, 'sanitize' ]
		);
	}
function init ( ) { $ _option = 'pressbooks_theme_options_' . $ this -> getSlug ( ) ; $ _page = $ _option ; $ _section = $ this -> getSlug ( ) . '_options_section' ; $ meta = new Metadata ( ) ; if ( false === get_option ( $ _option ) ) { add_option ( $ _option , $ this -> defaults ) ; } add_settings_section ( $ _section , $ this -> getTitle ( ) , [ $ this , 'display' ] , $ _page ) ; add_settings_field ( 'social_media' , __ ( 'Enable Social Media' , 'pressbooks' ) , [ $ this , 'renderSocialMediaField' ] , $ _page , $ _section , [ __ ( 'Add buttons to cover page and each chapter so that readers may share links to your book through social media: Facebook, Twitter, Google+' , 'pressbooks' ) , ] ) ; add_settings_field ( 'webbook_width' , __ ( 'Webbook Width' , 'pressbooks' ) , [ $ this , 'renderWebbookWidthField' ] , $ _page , $ _section , [ '30em' => __ ( 'Narrow' , 'pressbooks' ) , '40em' => __ ( 'Standard' , 'pressbooks' ) , '48em' => __ ( 'Wide' , 'pressbooks' ) , 'label_for' => 'webbook_width' , ] ) ; add_settings_field ( 'paragraph_separation' , __ ( 'Paragraph Separation' , 'pressbooks' ) , [ $ this , 'renderParagraphSeparationField' ] , $ _page , $ _section , [ 'indent' => __ ( 'Indent paragraphs' , 'pressbooks' ) , 'skiplines' => __ ( 'Skip lines between paragraphs' , 'pressbooks' ) , ] ) ; add_settings_field ( 'part_title' , __ ( 'Display Part Title' , 'pressbooks' ) , [ $ this , 'renderPartTitle' ] , $ _page , $ _section , [ __ ( 'Display the Part title on each chapter' , 'pressbooks' ) , ] ) ; if ( Container :: get ( 'Styles' ) -> hasBuckram ( ) ) { add_settings_field ( 'collapse_sections' , __ ( 'Collapse Sections' , 'pressbooks' ) , [ $ this , 'renderCollapseSections' ] , $ _page , $ _section , [ __ ( 'Collapse sections within front matter, chapters, and back matter' , 'pressbooks' ) , ] ) ; } if ( get_post_meta ( $ meta -> getMetaPostId ( ) , 'pb_is_based_on' , true ) ) { add_settings_field ( 'enable_source_comparison' , __ ( 'Enable Source Comparison' , 'pressbooks' ) , [ $ this , 'renderEnableSourceComparison' ] , $ _page , $ _section , [ __ ( 'Add comparison tool to the end of each front matter, part, chapter, and back matter' , 'pressbooks' ) , __ ( 'Allows readers to compare content with the original book from which it was cloned.' , 'pressbooks' ) , ] ) ; } /**
		 * Add custom settings fields.
		 *
		 * @since 3.9.7
		 *
		 * @param string $arg1
		 * @param string $arg2
		 */ do_action ( 'pb_theme_options_web_add_settings_fields' , $ _page , $ _section ) ; register_setting ( $ _page , $ _option , [ $ this , 'sanitize' ] ) ; }
Configure the web options tab using the settings API.
Configure the web options tab using the settings API .