-
Notifications
You must be signed in to change notification settings - Fork 8
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 #4 from DravenK/master
Related the project on drupal.org
- Loading branch information
Showing
6 changed files
with
90 additions
and
177 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,6 +1,27 @@ | ||
# d8-time-range | ||
A time range field for Drupal 8 | ||
Time Range | ||
========== | ||
Provides the form widget to fill in time range. | ||
This is just a change to the display form, so that the user doesn't need to | ||
enter too much content. | ||
This module not stored time data. The storage of time is provided by the core. | ||
|
||
1. Enable the Date Range field and also the Time Range field | ||
2. Create a Date Range field, making sure that you don't select All Day as field type. | ||
3. To select Time range, go to your content type's "Form Display Settings" and select Time Range | ||
## Installation | ||
|
||
Install the module as every other module. | ||
|
||
## Usage | ||
|
||
1. Enable the **Time Range** module. | ||
2. Create a **Date Range** field, select **Day and time** as field type. | ||
3. To select **Time range**, go to your content type's **Form Display Settings** | ||
and select **Time Range**. | ||
|
||
Because it doesn't require you to fill out the date, the default record is the | ||
date of the day. | ||
If you don't want to see the date on content's display, go to your content | ||
type's display settings and change the | ||
Date/Time format in your style. | ||
|
||
## Compatibility | ||
|
||
This module is compatible with Drupal core 8.x . |
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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
{ | ||
"name": "chris-happy7/time-range", | ||
"name": "drupal/time_range", | ||
"type": "drupal-module", | ||
"description": "Provides a timerange field.", | ||
"homepage": "https://github.com/Chris-Happy7/d8-time-range/", | ||
"description": "Provides the form widget to fill in time range.", | ||
"homepage": "https://github.com/DravenK/time-range.git", | ||
"license": "GPL-2.0+", | ||
"support": { | ||
"issues": "https://github.com/DravenK/time-range/issues", | ||
"source": "https://github.com/DravenK/time-range.git" | ||
}, | ||
"minimum-stability": "dev" | ||
} |
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
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
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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
name: 'Time Range' | ||
type: module | ||
description: 'Provides the ability to store start and end times.' | ||
package: Fields | ||
description: 'Provides the form widget to fill in time range.' | ||
core: 8.x | ||
project: 'drupal' | ||
package: Field types | ||
dependencies: | ||
- datetime | ||
- datetime_range | ||
- drupal:datetime | ||
- drupal:datetime_range |
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 |
---|---|---|
@@ -1,13 +1,47 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Module implementation file. | ||
*/ | ||
|
||
use Drupal\Core\Routing\RouteMatchInterface; | ||
|
||
/** | ||
* Implements hook_help(). | ||
*/ | ||
function time_range_help($route_name, RouteMatchInterface $route_match) { | ||
switch ($route_name) { | ||
case 'help.page.time_range': | ||
$output = '<h3>' . t('About') . '</h3>'; | ||
$output .= '<p>' . t('This module not stored time data. The storage of time is provided by the core. | ||
') . '</p>'; | ||
$output .= '<dl>'; | ||
$output .= '<dt>' . t('General') . '</dt>'; | ||
$output .= '<dd>' . t('Create a Date Range field, select Day and time as field type.') . '</dd>'; | ||
$output .= '<dd>' . t("To select Time range, go to your content type\'s form display settings | ||
and select Time Range.") . '</dd>'; | ||
$output .= '<dd>' . t("If you don\'t want to see the date on content\'s display, go to your content type\'s display settings and change the | ||
Date/time format in your style.") . '</dd>'; | ||
$output .= '<dd>' . t('If you have suggestions or questions . You can write down issue in <a href="https://github.com/DravenK/time-range/issues"> time_range</a>\'s page on github , or <a href="https://www.drupal.org/project/time_range">time_range</a>\'s project page on drupal.org .') . '</dd>'; | ||
$output .= '</dl>'; | ||
|
||
return $output; | ||
} | ||
return NULL; | ||
} | ||
|
||
/** | ||
* Implements hook_field_widget_info_alter(). | ||
*/ | ||
function time_range_field_widget_info() { | ||
return array( | ||
'daterange_time_only' => array( | ||
return [ | ||
'time_range' => [ | ||
'label' => t('Time Range'), | ||
'field types' => array('datetime_range'), | ||
'settings' => array( | ||
'add_new_text' => 'Add new customer...', //This is probably unneeded | ||
), | ||
), | ||
); | ||
'field types' => ['datetime_range'], | ||
'settings' => [ | ||
'add_new_text' => 'Add new customer...', | ||
], | ||
], | ||
]; | ||
} |