Skip to content

Commit

Permalink
Merge pull request #16 from alirdn/gutenberg-jalali-calendar
Browse files Browse the repository at this point in the history
Adding Gutenberg Jalali Calendar
  • Loading branch information
man4toman authored Feb 15, 2019
2 parents 5b18564 + 7792fa5 commit b3cf112
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 1 deletion.
Binary file added assets/css/fonts/imrc-datetime-picker-icons.eot
Binary file not shown.
18 changes: 18 additions & 0 deletions assets/css/fonts/imrc-datetime-picker-icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/css/fonts/imrc-datetime-picker-icons.ttf
Binary file not shown.
Binary file added assets/css/fonts/imrc-datetime-picker-icons.woff
Binary file not shown.
Binary file added assets/css/fonts/imrc-datetime-picker-icons.woff2
Binary file not shown.
1 change: 1 addition & 0 deletions assets/css/gutenberg-jalali-calendar.build.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/js/gutenberg-jalali-calendar.build.js

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions includes/admin/gutenberg-jalali-calendar.php
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' );
}
3 changes: 2 additions & 1 deletion wp-parsidate.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Text Domain: wp-parsidate
* Domain Path: parsi-languages
* License: GPL2
*
*
* WP-Parsidate is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
Expand Down Expand Up @@ -134,6 +134,7 @@ public function include_files() {
'fixes-misc',
'admin/styles-fix',
'admin/datepicker-rtl',
'admin/gutenberg-jalali-calendar',
'admin/lists-fix',
'admin/widgets',
'fixes-calendar',
Expand Down

0 comments on commit b3cf112

Please sign in to comment.