protected function paramSearchMeta( array $search ) {

		// Book Metadata
		$request_metadata = new \WP_REST_Request( 'GET', '/pressbooks/v2/metadata' );
		$response_metadata = rest_do_request( $request_metadata );
		$book_metadata = $response_metadata->get_data();
		if ( $this->keyValueSearchInMeta( $search, $book_metadata ) ) {
			return true;
		}

		// Chapter Metadata
		$request_metadata = new \WP_REST_Request( 'GET', '/pressbooks/v2/toc' );
		$response_metadata = rest_do_request( $request_metadata );
		$toc = $response_metadata->get_data();
		foreach ( $toc['front-matter'] as $fm ) {
			if ( $this->keyValueSearchInMeta( $search, $fm['metadata'] ) ) {
				return true;
			}
		}
		foreach ( $toc['parts'] as $p ) {
			foreach ( $p['chapters'] as $ch ) {
				if ( $this->keyValueSearchInMeta( $search, $ch['metadata'] ) ) {
					return true;
				}
			}
		}
		foreach ( $toc['back-matter'] as $bm ) {
			if ( $this->keyValueSearchInMeta( $search, $bm['metadata'] ) ) {
				return true;
			}
		}

		return false;
	}
protected function paramSearchMeta( array $search ) {

		// Book Metadata
		$request_metadata = new \WP_REST_Request( 'GET', '/pressbooks/v2/metadata' );
		$response_metadata = rest_do_request( $request_metadata );
		$book_metadata = $response_metadata->get_data();
		if ( $this->keyValueSearchInMeta( $search, $book_metadata ) ) {
			return true;
		}

		// Chapter Metadata
		$request_metadata = new \WP_REST_Request( 'GET', '/pressbooks/v2/toc' );
		$response_metadata = rest_do_request( $request_metadata );
		$toc = $response_metadata->get_data();
		foreach ( $toc['front-matter'] as $fm ) {
			if ( $this->keyValueSearchInMeta( $search, $fm['metadata'] ) ) {
				return true;
			}
		}
		foreach ( $toc['parts'] as $p ) {
			foreach ( $p['chapters'] as $ch ) {
				if ( $this->keyValueSearchInMeta( $search, $ch['metadata'] ) ) {
					return true;
				}
			}
		}
		foreach ( $toc['back-matter'] as $bm ) {
			if ( $this->keyValueSearchInMeta( $search, $bm['metadata'] ) ) {
				return true;
			}
		}

		return false;
	}
protected function paramSearchMeta ( array $ search ) { // Book Metadata $ request_metadata = new \ WP_REST_Request ( 'GET' , '/pressbooks/v2/metadata' ) ; $ response_metadata = rest_do_request ( $ request_metadata ) ; $ book_metadata = $ response_metadata -> get_data ( ) ; if ( $ this -> keyValueSearchInMeta ( $ search , $ book_metadata ) ) { return true ; } // Chapter Metadata $ request_metadata = new \ WP_REST_Request ( 'GET' , '/pressbooks/v2/toc' ) ; $ response_metadata = rest_do_request ( $ request_metadata ) ; $ toc = $ response_metadata -> get_data ( ) ; foreach ( $ toc [ 'front-matter' ] as $ fm ) { if ( $ this -> keyValueSearchInMeta ( $ search , $ fm [ 'metadata' ] ) ) { return true ; } } foreach ( $ toc [ 'parts' ] as $ p ) { foreach ( $ p [ 'chapters' ] as $ ch ) { if ( $ this -> keyValueSearchInMeta ( $ search , $ ch [ 'metadata' ] ) ) { return true ; } } } foreach ( $ toc [ 'back-matter' ] as $ bm ) { if ( $ this -> keyValueSearchInMeta ( $ search , $ bm [ 'metadata' ] ) ) { return true ; } } return false ; }
Parameter based search

@param array $search

@return bool
Parameter based search