This repository has been archived by the owner on Jul 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
ca-design-system-gutenberg-blocks.php
100 lines (88 loc) · 5.18 KB
/
ca-design-system-gutenberg-blocks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/**
* Plugin Name: ca.gov Design System Headless Wordpress
* Plugin URI: https://github.com/cagov/ca-design-system-gutenberg-blocks
* Description: Create content with the California Design System.
* Author: Office of Data and Innovation
* Author URI: https://innovation.ca.gov
* Version: 1.1.7
* License: MIT
* License URI: https://opensource.org/licenses/MIT
* Text Domain: ca-design-system
*
* @package CAGOVDesignSystemHeadlessWordPress
* @author Office of Data and Innovation <[email protected]>
* @license https://opensource.org/licenses/MIT MIT
* @link https://github.com/cagov/ca-design-system-gutenberg-blocks#README
*/
if (!defined('ABSPATH')) {
exit;
}
// Plugin Constants.
define('CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__VERSION', '1.1.7');
define('CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH', plugin_dir_path(__FILE__));
define('CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__ADMIN_URL', plugin_dir_url(__FILE__));
define('CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__FILE', __FILE__);
/**
* Plugin API/Action Reference
* Actions Run During an Admin Page Request.
*
* @link https://codex.wordpress.org/Plugin_API/Action_Reference#Actions_Run_During_an_Admin_Page_Request
*/
add_action('admin_init', 'cagov_design_system_headless_wordpress_admin_init');
/**
* Admin Init
*
* Triggered before any other hook when a user accesses the admin area.
* Note, this does not just run on user-facing admin screens.
* It runs on admin-ajax.php and admin-post.php as well.
*
* This pings the latest GitHub release and makes it available to plugin users to pull down changes.
* For scheduling updates, please refer to GitHub.
* https://github.com/cagov/ca-design-system-gutenberg-blocks#README
* @NOTE will rename to https://github.com/cagov/cagov-design-system-headless-wordpress
*
* @category add_action( 'init', 'cagov_design_system_headless_wordpress_admin_init' );
* @link https://codex.wordpress.org/Plugin_API/Action_Reference/admin_init
* @return void
*/
function cagov_design_system_headless_wordpress_admin_init()
{
include_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/core/class-ca-design-system-gutenberg-blocks-plugin-update.php';
}
/* Include publishing system integrations and features */
// Convert The SEO Framework data to OG_meta spec for the design system
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/publishing/api_autodescription.php';
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/publishing/api_redirection.php';
// Deliver page template names in safe location that does not break the WP API
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/publishing/api_page_templates.php';
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/publishing/api_meta_categories.php';
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/publishing/api_rest_api_headless.php';
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/publishing/api_meta_tags.php';
// Headless publishing features
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/publishing/api_publishing.php';
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/publishing/api_preview.php';
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/publishing/preview_button.php';
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/publishing/site_options.php';
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/publishing/headless_mime_types.php';
/* Include Gutenberg blocks and patterns. */
// Core design system blocks (periodically synced with design system changes)
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/cagov-design-system/blocks/plugin.php';
// Connect content modules/patterns
// Patterns have more data & API requirements and multiple layouts.
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/cagov-patterns/cagov-design-system-events/plugin.php';
require_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/cagov-patterns/cagov-design-system-posts/plugin.php';
// We host this plugin on multiple platforms and WordPress base installs. Accomodate the differences in themes, and support monolithic WordPress as well as ODI Publishing headless wordpress.
include_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/roles.php';
$theme = wp_get_theme();
// @todo Instead of testing for CAWeb theme, allow users the option to include/exclude this plugin's helper files. .
if ( 'CAWeb' == $theme->name) {
// Add page templates
if (!class_exists('CAGOVDesignSystemHeadlessWordPress_Plugin_Templates_Loader')) {
include_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/class-ca-design-system-gutenberg-blocks-templates.php';
}
CAGOVDesignSystemHeadlessWordPress_Plugin_Templates_Loader::get_instance();
include_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/caweb-page-resources.php';
include_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/caweb-filters.php';
include_once CAGOV_DESIGN_SYSTEM_HEADLESS_WORDPRESS__DIR_PATH . '/includes/caweb-functions.php';
}