| @@ -14,8 +14,18 @@ | ||
| 14 | 14 | 'future', |
| 15 | 15 | 'private', |
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | + /** | |
| 19 | + * Associative array of hook_name => callback_name | |
| 20 | + * This is used for Gutenberg-compat initialization | |
| 21 | + * [ | |
| 22 | + * 'init' => 'init_callback_on_module_instance' | |
| 23 | + * ] | |
| 24 | + * @var array | |
| 25 | + */ | |
| 26 | + protected $compat_hooks = []; | |
| 27 | + | |
| 18 | 28 | function __construct() {} |
| 19 | 29 | |
| 20 | 30 | /** |
| 21 | 31 | * Returns whether the current module is enabled. |
| @@ -204,14 +214,16 @@ | ||
| 204 | 214 | * @since 0.7 |
| 205 | 215 | */ |
| 206 | 216 | function enqueue_datepicker_resources() { |
| 207 | 217 | |
| 218 | + // Add the first day of the week as an available variable to wp_head | |
| 219 | + echo "<script type=\"text/javascript\">var ef_week_first_day=\"" . get_option( 'start_of_week' ) . "\";</script>"; | |
| 220 | + | |
| 208 | 221 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 209 | 222 | |
| 210 | 223 | //Timepicker needs to come after jquery-ui-datepicker and jquery |
| 211 | 224 | wp_enqueue_script( 'edit_flow-timepicker', EDIT_FLOW_URL . 'common/js/jquery-ui-timepicker-addon.js', array( 'jquery', 'jquery-ui-datepicker' ), EDIT_FLOW_VERSION, true ); |
| 212 | 225 | wp_enqueue_script( 'edit_flow-date_picker', EDIT_FLOW_URL . 'common/js/ef_date.js', array( 'jquery', 'jquery-ui-datepicker', 'edit_flow-timepicker' ), EDIT_FLOW_VERSION, true ); |
| 213 | - wp_add_inline_script( 'edit_flow-date_picker', sprintf( 'var ef_week_first_day = %s;', wp_json_encode( get_option( 'start_of_week' ) ) ), 'before' ); | |
| 214 | 226 | |
| 215 | 227 | // Now styles |
| 216 | 228 | wp_enqueue_style( 'jquery-ui-datepicker', EDIT_FLOW_URL . 'common/css/jquery.ui.datepicker.css', array( 'wp-jquery-ui-dialog' ), EDIT_FLOW_VERSION, 'screen' ); |
| 217 | 229 | wp_enqueue_style( 'jquery-ui-theme', EDIT_FLOW_URL . 'common/css/jquery.ui.theme.css', false, EDIT_FLOW_VERSION, 'screen' ); |
| @@ -585,7 +597,16 @@ | ||
| 585 | 597 | $new_description = $this->get_encoded_description( $description_args ); |
| 586 | 598 | wp_update_term( $term->term_id, $taxonomy, array( 'description' => $new_description ) ); |
| 587 | 599 | } |
| 588 | 600 | } |
| 601 | + | |
| 602 | + /** | |
| 603 | + * Return compatibility hooks for the current instance | |
| 604 | + * | |
| 605 | + * @return array | |
| 606 | + */ | |
| 607 | + function get_compat_hooks() { | |
| 608 | + return isset( $this->compat_hooks ) && is_array( $this->compat_hooks ) ? $this->compat_hooks : []; | |
| 609 | + } | |
| 610 | + | |
| 589 | 611 | } |
| 590 | - | |
| 591 | 612 | } |