-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from alirdn/gutenberg-jalali-calendar
Adding Gutenberg Jalali Calendar
- Loading branch information
Showing
9 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
/** | ||
* Gutenberg Jalali Calendar | ||
* | ||
* This package, will add a Jalali calendar to WordPress Gutenberg editor | ||
* introduced from version v5.0. | ||
* | ||
* @author Alireza Dabiri Nejad / Alirdn | ||
* @package WP-Parsidate | ||
* @subpackage Admin/Gutenber_Jalali_Calendar | ||
*/ | ||
|
||
// Exit if accessed directly. | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
/** | ||
* Enqueue Gutenberg Jalali Calendar assets for backend editor. | ||
* | ||
* @uses {wp-plugins} | ||
* @uses {wp-i18n} to internationalize the block's text. | ||
* @uses {wp-compose} | ||
* @uses {wp-components} | ||
* @uses {wp-element} for WP Element abstraction — structure of blocks. | ||
* @uses {wp-editor} for WP editor styles. | ||
* @uses {wp-edit-post} to internationalize the block's text. | ||
* @uses {wp-data} | ||
* @uses {wp-date} | ||
* @since X.X.X | ||
*/ | ||
if ( ! function_exists( 'wpp_gutenberg_jalali_calendar_editor_assets' ) ) { | ||
function wpp_gutenberg_jalali_calendar_editor_assets() { | ||
// Scripts. | ||
wp_enqueue_script( | ||
'wpp_gutenberg_jalali_calendar_editor_scripts', | ||
WP_PARSI_URL . 'assets/js/gutenberg-jalali-calendar.build.js', | ||
array( | ||
'wp-plugins', | ||
'wp-i18n', | ||
'wp-compose', | ||
'wp-components', | ||
'wp-element', | ||
'wp-editor', | ||
'wp-edit-post', | ||
'wp-data', | ||
'wp-date' | ||
), | ||
true | ||
); | ||
|
||
// Styles. | ||
wp_enqueue_style( | ||
'wpp_gutenberg_jalali_calendar_editor_styles', | ||
WP_PARSI_URL . 'assets/css/gutenberg-jalali-calendar.build.css', | ||
array( 'wp-edit-blocks' ) | ||
); | ||
} | ||
} | ||
|
||
// Hook: Editor assets. | ||
$wpp_options = get_option( 'wpp_settings' ); | ||
if ( version_compare( get_bloginfo( 'version' ), '5.0.0', '>=' ) && $wpp_options['persian_date'] === 'enable' ) { | ||
add_action( 'enqueue_block_editor_assets', 'wpp_gutenberg_jalali_calendar_editor_assets' ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters