function setEbookStartPoint() {
		$_option = $this->getSlug();
		$options = get_option( 'pressbooks_theme_options_' . $_option, $this->defaults );

		$struct = \Pressbooks\Book::getBookStructure();

		foreach ( $struct['front-matter'] as $k => $v ) {
			if ( get_post_meta( $v['ID'], 'pb_ebook_start', true ) ) {
				$options['ebook_start_point'] = $v['ID'];
				break;
			}
		}

		if ( ! isset( $options['ebook_start_point'] ) ) {
			foreach ( $struct['part'] as $key => $value ) {
				foreach ( $value['chapters'] as $k => $v ) {
					if ( get_post_meta( $v['ID'], 'pb_ebook_start', true ) ) {
						$options['ebook_start_point'] = $v['ID'];
						break;
					}
				}
			}
		}

		if ( ! isset( $options['ebook_start_point'] ) ) {
			foreach ( $struct['back-matter'] as $k => $v ) {
				if ( get_post_meta( $v['ID'], 'pb_ebook_start', true ) ) {
					$options['ebook_start_point'] = $v['ID'];
					break;
				}
			}
		}

		update_option( 'pressbooks_theme_options_' . $_option, $options );
	}
function setEbookStartPoint() {
		$_option = $this->getSlug();
		$options = get_option( 'pressbooks_theme_options_' . $_option, $this->defaults );

		$struct = \Pressbooks\Book::getBookStructure();

		foreach ( $struct['front-matter'] as $k => $v ) {
			if ( get_post_meta( $v['ID'], 'pb_ebook_start', true ) ) {
				$options['ebook_start_point'] = $v['ID'];
				break;
			}
		}

		if ( ! isset( $options['ebook_start_point'] ) ) {
			foreach ( $struct['part'] as $key => $value ) {
				foreach ( $value['chapters'] as $k => $v ) {
					if ( get_post_meta( $v['ID'], 'pb_ebook_start', true ) ) {
						$options['ebook_start_point'] = $v['ID'];
						break;
					}
				}
			}
		}

		if ( ! isset( $options['ebook_start_point'] ) ) {
			foreach ( $struct['back-matter'] as $k => $v ) {
				if ( get_post_meta( $v['ID'], 'pb_ebook_start', true ) ) {
					$options['ebook_start_point'] = $v['ID'];
					break;
				}
			}
		}

		update_option( 'pressbooks_theme_options_' . $_option, $options );
	}
function setEbookStartPoint ( ) { $ _option = $ this -> getSlug ( ) ; $ options = get_option ( 'pressbooks_theme_options_' . $ _option , $ this -> defaults ) ; $ struct = \ Pressbooks \ Book :: getBookStructure ( ) ; foreach ( $ struct [ 'front-matter' ] as $ k => $ v ) { if ( get_post_meta ( $ v [ 'ID' ] , 'pb_ebook_start' , true ) ) { $ options [ 'ebook_start_point' ] = $ v [ 'ID' ] ; break ; } } if ( ! isset ( $ options [ 'ebook_start_point' ] ) ) { foreach ( $ struct [ 'part' ] as $ key => $ value ) { foreach ( $ value [ 'chapters' ] as $ k => $ v ) { if ( get_post_meta ( $ v [ 'ID' ] , 'pb_ebook_start' , true ) ) { $ options [ 'ebook_start_point' ] = $ v [ 'ID' ] ; break ; } } } } if ( ! isset ( $ options [ 'ebook_start_point' ] ) ) { foreach ( $ struct [ 'back-matter' ] as $ k => $ v ) { if ( get_post_meta ( $ v [ 'ID' ] , 'pb_ebook_start' , true ) ) { $ options [ 'ebook_start_point' ] = $ v [ 'ID' ] ; break ; } } } update_option ( 'pressbooks_theme_options_' . $ _option , $ options ) ; }
Update values to human-readable equivalents within Ebook options.
Update values to human - readable equivalents within Ebook options .