Skip to content

Commit

Permalink
add theme option & update readme file
Browse files Browse the repository at this point in the history
add theme option  & update readme file
  • Loading branch information
kareemzok committed May 11, 2016
1 parent 78a3ee7 commit 116fb76
Show file tree
Hide file tree
Showing 8 changed files with 1,523 additions and 5 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ This module requires the following contrib module :
* libraries (https://www.drupal.org/project/libraries)
* jQuery Update (https://www.drupal.org/project/jquery_update)


FEATURES
-------------
* Content type options
* General configuration such as date format, links option, cashing, speed and much more.
* Text and label confuguration such as prefix, suffix of the event head date, next and previous buttons, url button and much more.
* Choose between different themes.


INSTALLATION
Expand All @@ -32,8 +39,6 @@ INSTALLATION
if you got the following error : Cannot read property 'fn' of undefined




CONFIGURATION
-------------
* Jquery event calendar settings can be found at admin/config/user-interface/jquery-event-calendar.
Expand Down
31 changes: 29 additions & 2 deletions file/jquery_event_calendar_settings.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function jquery_event_calendar_option_configuration_form($form, &$form_state) {
);
$form['general']['libpath']['#markup'] = t('Download Jquery Calendar library from: <a href="https://github.com/jaime8111/jQueryEventCalendar" target="_blank">Jquery Calendar Library download</a> then upload to. ' . $jquery_calandar_lib_path);

/* Content type calendar configuration */

$form['content'] = array(
'#type' => 'fieldset',
Expand Down Expand Up @@ -54,6 +55,8 @@ function jquery_event_calendar_option_configuration_form($form, &$form_state) {
);
}
}

/* General Calendar configuration */
$form['config'] = array(
'#type' => 'fieldset',
'#title' => t('General Calendar configuration'),
Expand All @@ -66,13 +69,12 @@ function jquery_event_calendar_option_configuration_form($form, &$form_state) {
$date_formats[$value['type']] = t('@date_format format', array('@date_format' => $value['title'])) . ': ' . format_date(REQUEST_TIME, $value['type']);
}


$form['config']['jquery_event_calendar_dateformat'] = array(
'#type' => 'textfield',
'#title' => t('Date format'),
'#description' => t('See the <a href="@url" target="_blank">Moment plugin</a> for date formats.', array('@url' => 'http://momentjs.com/docs/#/displaying/format/')),
'#default_value' => variable_get('jquery_event_calendar_dateformat', 'dddd MM-D-YYYY'),

);


Expand Down Expand Up @@ -181,6 +183,8 @@ function jquery_event_calendar_option_configuration_form($form, &$form_state) {
'#description' => t('Opacity of widget animation.'),
);

/* Text/label calendar configuration */

$form['labels'] = array(
'#type' => 'fieldset',
'#title' => t('Text/label calendar configuration'),
Expand Down Expand Up @@ -241,6 +245,29 @@ function jquery_event_calendar_option_configuration_form($form, &$form_state) {
'#default_value' => variable_get('jquery_event_calendar_txt_GoToEventUrl', 'See the event'),
);

/* theming */

$form['theme'] = array(
'#type' => 'fieldset',
'#title' => t('Theming'),
'#collapsible' => true,
'#collapsed' => true,
);

$form['theme']['jquery_event_calendar_template'] = array(
'#type' => 'select',
'#title' => t('Chose a theme'),
'#options' => array(
'default' => t('Sky'),
'desert' => t('Desert'),
'forest' => t('Forest'),
'orangy' => t('Orangy'),
'pepper' => t('Pepper'),
),
'#default_value' => variable_get('jquery_event_calendar_template', 'default'),
'#description' => t('The default theme is Sky.'),
);


return system_settings_form($form);
}
Expand Down
2 changes: 1 addition & 1 deletion jquery_event_calendar.install
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function jquery_event_calendar_uninstall() {
variable_del('event_calendar_jsonData');
variable_del('event_calendar_cacheJson');
variable_del('jquery_event_calendar_dateformat');

variable_del('jquery_event_calendar_template');

$content_type_names = node_type_get_names();
foreach ($content_type_names as $type => $name) {
Expand Down
29 changes: 29 additions & 0 deletions jquery_event_calendar.module
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@
* Event node handling, add to calendar, event block and general hooks.
*/



/**
* Implements hook_init().
*/
function jquery_event_calendar_init(){
$path = drupal_get_path('module', 'jquery_event_calendar');
$theme_name=variable_get('jquery_event_calendar_template');

if($theme_name!='default')
drupal_add_css($path.'/themes/'.$theme_name.'/eventCalendar_theme_responsive.css');


}


/**
* Implements hook_menu().
*/
Expand Down Expand Up @@ -220,4 +236,17 @@ function jquery_event_calendar_requirements($phase) {

return $requirements;

}


/**
* Implements hook_css_alter().
*/

function jquery_event_calendar_css_alter(&$css) {

$theme_name=variable_get('jquery_event_calendar_template');

if($theme_name!='default')
unset($css['sites/all/libraries/jquery-event-calendar/eventCalendar_theme_responsive.css']);
}

0 comments on commit 116fb76

Please sign in to comment.