Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
CRAP
n/a
0 / 0
register_first_posts_stream_options_sync
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
20
1<?php
2/**
3 * First posts stream helpers
4 *
5 * @package automattic/jetpack-mu-wpcom
6 * @since 4.11.0
7 */
8
9/**
10 * Adds the required options to the sync list for the First Posts Stream feature.
11 *
12 * @param array $allowed_options The allowed options.
13 */
14function register_first_posts_stream_options_sync( $allowed_options ) {
15    // We are not either in Simple or Atomic.
16    if ( ! class_exists( 'Automattic\Jetpack\Status\Host' ) ) {
17        return $allowed_options;
18    }
19
20    if ( ! ( new Automattic\Jetpack\Status\Host() )->is_woa_site() ) {
21        return $allowed_options;
22    }
23
24    if ( ! is_array( $allowed_options ) ) {
25        return $allowed_options;
26    }
27
28    $launchpad_options = array(
29        'wpcom_has_first_post',
30    );
31
32    return array_merge( $allowed_options, $launchpad_options );
33}
34
35add_filter( 'jetpack_sync_options_whitelist', 'register_first_posts_stream_options_sync', 10, 1 );