diff --git a/README.md b/README.md index 79c9f23efad170f25be779ec200554cd4ec308f0..50b23dc5a8d22ecc65aa0dc17d34412c8994fa97 100644 --- a/README.md +++ b/README.md @@ -1,56 +1,51 @@ -CONTENTS OF THIS FILE ---------------------- - - * Introduction - * Requirements - * Installation - * Configuration - * Views exposed filters - * Maintainers - - -INTRODUCTION ------------- +# Single DateTimePicker The Single Date Time Picker module supports date/time and date fields. You can use it on Datetime and Datetime Range fields. Features: - * Support Datetime and Datetime Range field types - * Support for Views exposed filters - * 12/24 hour format display - * Option to choose granularity for minutes - * Option to disable specific days global (etc. Saturday) - * Option to disable specific dates, useful for holidays, working days, etc. +- Support Datetime and Datetime Range field types +- Support for Views exposed filters +- 12/24 hour format display +- Option to choose granularity for minutes +- Option to disable specific days global (etc. Saturday) +- Option to disable specific dates, useful for holidays, working days, etc. + +For a full description of the module, visit the +[project page](https://www.drupal.org/project/single_datetime). + +Submit bug reports and feature suggestions, or track changes in the +[issue queue](https://www.drupal.org/project/issues/single_datetime). - * For a full description of the module visit: - https://www.drupal.org/project/single_datetime - * To submit bug reports and feature suggestions, or to track changes visit: - https://www.drupal.org/project/issues/single_datetime +## Table of contents +- Requirements +- Installation +- Configuration +- Views exposed filters -REQUIREMENTS ------------- + +## Requirements This module requires the following outside of Drupal core: - * Plugin Date and Time Picker library - https://github.com/xdan/datetimepicker +- [Plugin Date and Time Picker library](https://github.com/xdan/datetimepicker) -INSTALLATION ------------- +## Installation - * Install the Single Date Time Picker module as you would normally install a - contributed Drupal module. Visit https://www.drupal.org/node/1897420 for - further information. - * Install external library from xdan trough composer or manual. Library - should be available at example.com/libraries/jquery-datetimepicker +- Install as you would normally install a contributed Drupal module. For further + information, see + [Installing Drupal Modules] + (https://www.drupal.org/docs/extending-drupal/installing-drupal-modules). +- Install external library from xdan trough composer or manual. Library + should be available at example.com/libraries/jquery-datetimepicker 1. Manual download. - Download https://github.com/xdan/datetimepicker/archive/2.5.20.zip, + Download `https://github.com/xdan/datetimepicker/archive/2.5.20.zip`, and extract inside [webroot]/libraries/jquery-datetimepicker 2. Using drupal-libraries-installer plugin. @@ -87,30 +82,29 @@ INSTALLATION composer require "npm-asset/jquery-datetimepicker":"^2.5" ``` - [Ensure composer packages of type drupal-library (options 2 and 3) or - npm-asset (option 4) are configured to install to the appropriate path. - ](https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#third-party-libraries) +[Ensure composer packages of type drupal-library (options 2 and 3) or +npm-asset (option 4) are configured to install to the appropriate path. +](https://www.drupal.org/docs/develop/using-composeusing-composer-to-install-drupal-and-manage-dependencies#third-party-libraries) + -CONFIGURATION -------------- +## Configuration - 1. Navigate to Administration > Extend and enable the module. - 2. Navigate to Administration > Structure > Content types > [Content type - with date field] > Manage form display. - 3. Select the date field to edit and choose "Single Date Time Picker" from - Widget drop down. - 4. Edit the Field Plugin Setting by selecting the gear icon. - 5. Select the hours format: 12 hours or 24 hours. - 6. Select granularity for minutes in calendar: 5, 10, 15, 30, or 60 minutes. - 7. Select days which are to be disabled in calendar. - 8. To disable specific dates from calendar enter days in following format - d.m.Y etc. 31.12.2018. Each date in new line. This is used for specific - dates. - 9. Update and Save. +1. Navigate to Administration > Extend and enable the module. +2. Navigate to Administration > Structure > Content types > [Content type + with date field] > Manage form display. +3. Select the date field to edit and choose "Single Date Time Picker" from + Widget drop down. +4. Edit the Field Plugin Setting by selecting the gear icon. +5. Select the hours format: 12 hours or 24 hours. +6. Select granularity for minutes in calendar: 5, 10, 15, 30, or 60 minutes. +7. Select days which are to be disabled in calendar. +8. To disable specific dates from calendar enter days in following format + d.m.Y etc. 31.12.2018. Each date in new line. This is used for specific + dates. +9. Update and Save. -VIEWS EXPOSED FILTERS -------------- +## Views exposed filters This module contains submodule `single_datetime_exposed`. If you enable it, all exposed filters of types `date` and `search_api_date` will @@ -120,8 +114,7 @@ It works with all operators, and none configuration is needed. If you need customized configuration, suggesting that you create your implementation based on this submodule. -FORM API USAGE -------------- +**Form api usage** You can use SingleDateTime in other parts of the Drupal FORM API with minor adjustments. If you are using non single_datetime elements, as textfield field type, you need to attach proper attributes on the field, and attach JS library @@ -133,8 +126,6 @@ single_datetime directly. Also exist helper `\Drupal\single_datetime\AttributeHelper` with some default attributes options and examples. See examples below. - - **Custom single_datetime field** Using AttributeHelper you can create default widget: @@ -149,7 +140,6 @@ $form['purchase_date'] = [ ] + \Drupal\single_datetime\AttributeHelper::allElementAttributes(); ``` - Directly using your attributes. ``` $form['purchase_date'] = [ @@ -189,7 +179,6 @@ Using AttributeHelper you can create default widget: $form['#attributes']['autocomplete'] = 'off'; ``` - Directly using your attributes. ```// Using datetimepicker module. $form['purchase_date'] = [ @@ -211,14 +200,3 @@ Directly using your attributes. $form['#attached']['library'][] = 'single_datetime/datetimepicker'; $form['#attributes']['autocomplete'] = 'off'; ``` - - - -MAINTAINERS ------------ - - * Valentino Međimorec (valic) - https://www.drupal.org/u/valic - -Supporting organization: - - * Vallic - https://www.drupal.org/vallic