| @@ -9,8 +9,9 @@ | ||
| 9 | 9 | namespace ContentControl\Controllers; |
| 10 | 10 | |
| 11 | 11 | use ContentControl\Base\Controller; |
| 12 | 12 | |
| 13 | +use function ContentControl\get_all_plugin_options; | |
| 13 | 14 | use function ContentControl\Rules\allowed_user_roles; |
| 14 | 15 | |
| 15 | 16 | defined( 'ABSPATH' ) || exit; |
| 16 | 17 | |
| @@ -46,8 +47,10 @@ | ||
| 46 | 47 | $wp_version = get_bloginfo( 'version' ); |
| 47 | 48 | // Strip last number from version as they won't be breaking changes. |
| 48 | 49 | $wp_version = preg_replace( '/\.\d+$/', '', $wp_version ); |
| 49 | 50 | |
| 51 | + $is_pro_installed = \ContentControl\is_plugin_installed( 'content-control-pro/content-control-pro.php' ); | |
| 52 | + | |
| 50 | 53 | $packages = [ |
| 51 | 54 | 'block-editor' => [ |
| 52 | 55 | 'handle' => 'content-control-block-editor', |
| 53 | 56 | 'styles' => true, |
| @@ -68,14 +71,24 @@ | ||
| 68 | 71 | ], |
| 69 | 72 | 'components' => [ |
| 70 | 73 | 'handle' => 'content-control-components', |
| 71 | 74 | 'styles' => true, |
| 75 | + 'deps' => [ | |
| 76 | + // This is required for tinymce components. | |
| 77 | + 'wp-tinymce', | |
| 78 | + // This is required for all tinyMCE plugins. | |
| 79 | + 'wp-block-library', | |
| 80 | + ], | |
| 72 | 81 | ], |
| 73 | 82 | 'core-data' => [ |
| 74 | - 'handle' => 'content-control-core-data', | |
| 75 | - 'deps' => [ | |
| 83 | + 'handle' => 'content-control-core-data', | |
| 84 | + 'deps' => [ | |
| 76 | 85 | 'wp-api', |
| 77 | 86 | ], |
| 87 | + 'varsName' => 'contentControlCoreData', | |
| 88 | + 'vars' => [ | |
| 89 | + 'currentSettings' => get_all_plugin_options(), | |
| 90 | + ], | |
| 78 | 91 | ], |
| 79 | 92 | 'data' => [ |
| 80 | 93 | 'handle' => 'content-control-data', |
| 81 | 94 | ], |
| @@ -98,17 +111,19 @@ | ||
| 98 | 111 | 'settings-page' => [ |
| 99 | 112 | 'handle' => 'content-control-settings-page', |
| 100 | 113 | 'varsName' => 'contentControlSettingsPage', |
| 101 | 114 | 'vars' => [ |
| 102 | - 'pluginUrl' => $this->container->get( 'url' ), | |
| 103 | - 'wpVersion' => $wp_version, | |
| 104 | - 'adminUrl' => admin_url(), | |
| 105 | - 'restBase' => 'content-control/v2', | |
| 106 | - 'userRoles' => allowed_user_roles(), | |
| 107 | - 'logUrl' => current_user_can( 'manage_options' ) ? $this->container->get( 'logging' )->get_file_url() : false, | |
| 108 | - 'rolesAndCaps' => wp_roles()->roles, | |
| 109 | - 'version' => $this->container->get( 'version' ), | |
| 110 | - 'permissions' => $permissions, | |
| 115 | + 'pluginUrl' => $this->container->get( 'url' ), | |
| 116 | + 'wpVersion' => $wp_version, | |
| 117 | + 'adminUrl' => admin_url(), | |
| 118 | + 'restBase' => 'content-control/v2', | |
| 119 | + 'userRoles' => allowed_user_roles(), | |
| 120 | + 'logUrl' => current_user_can( 'manage_options' ) ? $this->container->get( 'logging' )->get_file_url() : false, | |
| 121 | + 'rolesAndCaps' => wp_roles()->roles, | |
| 122 | + 'version' => $this->container->get( 'version' ), | |
| 123 | + 'permissions' => $permissions, | |
| 124 | + 'isProInstalled' => $is_pro_installed, | |
| 125 | + 'isProActivated' => $is_pro_installed && is_plugin_active( 'content-control-pro/content-control-pro.php' ), | |
| 111 | 126 | ], |
| 112 | 127 | 'styles' => true, |
| 113 | 128 | ], |
| 114 | 129 | 'utils' => [ |