-
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.
- Loading branch information
Ines WALLON
committed
Jun 11, 2022
1 parent
977722a
commit facc80e
Showing
543 changed files
with
46,072 additions
and
111 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: Core | ||
description: 'Provide core components required by other features.' | ||
type: module | ||
core: 8.x | ||
core_version_requirement: ^8 || ^9 | ||
package: Drupalfr | ||
configure: drupalfr_core.config_list | ||
dependencies: | ||
- drupal:system |
6 changes: 6 additions & 0 deletions
6
app/modules/custom/drupalfr_core/drupalfr_core.links.menu.yml
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,6 @@ | ||
drupalfr_core.config_list: | ||
title: Drupal France | ||
route_name: drupalfr_core.config_list | ||
parent: system.admin_config | ||
description: 'Administer Drupal France config.' | ||
# weight: 5 |
23 changes: 23 additions & 0 deletions
23
app/modules/custom/drupalfr_core/drupalfr_core.links.task.yml
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,23 @@ | ||
drupalfr_core.admin.content.spam: | ||
title: 'Spam' | ||
route_name: view.spam_content.page_1 | ||
base_route: system.admin_content | ||
weight: 10 | ||
|
||
drupalfr_core.admin.content.spam_content: | ||
title: 'Content' | ||
route_name: view.spam_content.page_1 | ||
parent_id: drupalfr_core.admin.content.spam | ||
weight: 0 | ||
|
||
drupalfr_core.admin.content.spam_comment: | ||
title: 'Comment' | ||
route_name: view.spam_comment.page_1 | ||
parent_id: drupalfr_core.admin.content.spam | ||
weight: 1 | ||
|
||
drupalfr_core.admin.content.localize_glossary: | ||
title: 'Translations management' | ||
route_name: view.localize_glossary_admin.page_1 | ||
base_route: system.admin_content | ||
weight: 15 |
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,47 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Contains hook implementations for drupalfr_core module. | ||
*/ | ||
|
||
use Drupal\Core\Cache\Cache; | ||
use Drupal\node\NodeInterface; | ||
|
||
/** | ||
* Implements hook_leaflet_map_info_alter(). | ||
*/ | ||
function drupalfr_core_leaflet_map_info_alter(array &$map_info) { | ||
// Alter default leaflet map globally. | ||
// Set default zoom and maxBounds. | ||
// Disable zoom. | ||
$map_info['OSM Mapnik']['settings']['touchZoom'] = FALSE; | ||
$map_info['OSM Mapnik']['settings']['scrollWheelZoom'] = FALSE; | ||
$map_info['OSM Mapnik']['settings']['doubleClickZoom'] = FALSE; | ||
$map_info['OSM Mapnik']['settings']['zoomControl'] = FALSE; | ||
$map_info['OSM Mapnik']['settings']['zoom'] = 5; | ||
$map_info['OSM Mapnik']['settings']['maxBounds'] = [ | ||
['lat' => '40.613952441166596', 'lng' => '11.2445068359375'], | ||
['lat' => '52.05249047600099', 'lng' => '-7.80029296875'], | ||
]; | ||
} | ||
|
||
/** | ||
* Implements hook_node_presave(). | ||
* | ||
* Basic implementation of "Views Custom Cache Tag". | ||
*/ | ||
function drupalfr_core_node_presave(NodeInterface $node) { | ||
$cache_tag = 'node:type:' . $node->getType(); | ||
Cache::invalidateTags([$cache_tag]); | ||
} | ||
|
||
/** | ||
* Implements hook_node_delete(). | ||
* | ||
* See https://www.drupal.org/node/2917531. | ||
*/ | ||
function drupalfr_core_node_delete(NodeInterface $node) { | ||
$cache_tag = 'node:type:' . $node->getType(); | ||
Cache::invalidateTags([$cache_tag]); | ||
} |
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,9 @@ | ||
drupalfr_core.config_list: | ||
path: '/admin/config/drupalfr' | ||
defaults: | ||
_controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' | ||
_title: 'Drupal France' | ||
requirements: | ||
_permission: 'access administration pages' | ||
options: | ||
_admin_route: TRUE |
8 changes: 8 additions & 0 deletions
8
app/modules/custom/drupalfr_job_offer/drupalfr_job_offer.info.yml
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,8 @@ | ||
name: "Offre d'emploi" | ||
description: 'Provide functionality related to job offers.' | ||
type: module | ||
core: 8.x | ||
core_version_requirement: ^8 || ^9 | ||
package: Drupalfr | ||
dependencies: | ||
- drupal:system |
55 changes: 55 additions & 0 deletions
55
app/modules/custom/drupalfr_job_offer/drupalfr_job_offer.module
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,55 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Contains hook implementations for drupalfr_job_offer module. | ||
*/ | ||
|
||
use Drupal\Core\Link; | ||
use Drupal\node\NodeInterface; | ||
|
||
/** | ||
* Implements hook_cron(). | ||
* | ||
* Archive expired published job offer. | ||
*/ | ||
function drupalfr_job_offer_cron() { | ||
$request_time = \Drupal::time()->getRequestTime(); | ||
|
||
/** @var \Drupal\node\NodeInterface[] $published_job_offers */ | ||
$published_job_offers = \Drupal::entityTypeManager()->getStorage('node')->loadByProperties([ | ||
'type' => 'job_offer', | ||
'status' => NodeInterface::PUBLISHED, | ||
]); | ||
|
||
foreach ($published_job_offers as $published_job_offer) { | ||
if ( | ||
$published_job_offer->hasField('field_job_validity') && | ||
$published_job_offer->hasField('published_at') && | ||
$published_job_offer->hasField('moderation_state') | ||
) { | ||
|
||
$validity = $published_job_offer->get('field_job_validity')->first(); | ||
if (!is_null($validity)) { | ||
$validity = $validity->getValue()['value']; | ||
|
||
$published_at = $published_job_offer->get('published_at')->first(); | ||
if (!is_null($published_at)) { | ||
$published_at = $published_at->getValue()['value']; | ||
|
||
$validity_time = $validity * 30 * 24 * 3600; | ||
if ($request_time > $published_at + $validity_time) { | ||
$published_job_offer->moderation_state->value = 'archived'; | ||
$published_job_offer->save(); | ||
|
||
\Drupal::logger('drupalfr_job_offer')->notice('The job offer @nid - @title has been archived.', [ | ||
'@nid' => $published_job_offer->id(), | ||
'@title' => $published_job_offer->label(), | ||
'link' => Link::fromTextAndUrl(t('View'), $published_job_offer->toUrl())->toString(), | ||
]); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...les/custom/drupalfr_localize_statistics/config/schema/localize_statistics_type.schema.yml
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,12 @@ | ||
drupalfr_localize_statistics.localize_statistics_type.*: | ||
type: config_entity | ||
label: 'localize statistics type config' | ||
mapping: | ||
id: | ||
type: string | ||
label: 'ID' | ||
label: | ||
type: label | ||
label: 'Label' | ||
uuid: | ||
type: string |
8 changes: 8 additions & 0 deletions
8
app/modules/custom/drupalfr_localize_statistics/drupalfr_localize_statistics.info.yml
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,8 @@ | ||
name: "Statistiques de la traduction" | ||
description: 'Provides localize statistics feature and related configuration.' | ||
type: module | ||
core: 8.x | ||
core_version_requirement: ^8 || ^9 | ||
package: Drupalfr | ||
dependencies: | ||
- drupal:system |
10 changes: 10 additions & 0 deletions
10
...modules/custom/drupalfr_localize_statistics/drupalfr_localize_statistics.links.action.yml
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,10 @@ | ||
entity.localize_statistics.add_form: | ||
route_name: entity.localize_statistics.add_page | ||
title: 'Add localize statistics' | ||
appears_on: | ||
- entity.localize_statistics.collection | ||
entity.localize_statistics_type.add_form: | ||
route_name: entity.localize_statistics_type.add_form | ||
title: 'Add localize statistics type' | ||
appears_on: | ||
- entity.localize_statistics_type.collection |
7 changes: 7 additions & 0 deletions
7
app/modules/custom/drupalfr_localize_statistics/drupalfr_localize_statistics.links.menu.yml
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,7 @@ | ||
# localize statistics type menu items definition. | ||
entity.localize_statistics_type.collection: | ||
title: 'localize statistics type' | ||
route_name: entity.localize_statistics_type.collection | ||
description: 'List localize statistics type (bundles)' | ||
parent: system.admin_structure | ||
weight: 99 |
23 changes: 23 additions & 0 deletions
23
app/modules/custom/drupalfr_localize_statistics/drupalfr_localize_statistics.links.task.yml
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,23 @@ | ||
# localize statistics routing definition. | ||
|
||
entity.localize_statistics.canonical: | ||
route_name: entity.localize_statistics.canonical | ||
base_route: entity.localize_statistics.canonical | ||
title: 'View' | ||
|
||
entity.localize_statistics.edit_form: | ||
route_name: entity.localize_statistics.edit_form | ||
base_route: entity.localize_statistics.canonical | ||
title: 'Edit' | ||
|
||
entity.localize_statistics.delete_form: | ||
route_name: entity.localize_statistics.delete_form | ||
base_route: entity.localize_statistics.canonical | ||
title: Delete | ||
weight: 10 | ||
|
||
drupalfr_localize_statistics.admin.content.localize_statistics: | ||
title: 'Translation statistics' | ||
route_name: entity.localize_statistics.collection | ||
base_route: system.admin_content | ||
weight: 20 |
49 changes: 49 additions & 0 deletions
49
app/modules/custom/drupalfr_localize_statistics/drupalfr_localize_statistics.module
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,49 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Contains drupalfr_localize_statistics.module. | ||
*/ | ||
|
||
/** | ||
* Implements hook_theme(). | ||
*/ | ||
function drupalfr_localize_statistics_theme() { | ||
$theme = []; | ||
$theme['localize_statistics'] = [ | ||
'render element' => 'elements', | ||
'file' => 'localize_statistics.page.inc', | ||
'template' => 'localize_statistics', | ||
]; | ||
$theme['localize_statistics_content_add_list'] = [ | ||
'render element' => 'content', | ||
'variables' => [ | ||
'content' => NULL, | ||
], | ||
'file' => 'localize_statistics.page.inc', | ||
]; | ||
return $theme; | ||
} | ||
|
||
/** | ||
* Implements hook_theme_suggestions_HOOK(). | ||
*/ | ||
function drupalfr_localize_statistics_theme_suggestions_localize_statistics(array $variables) { | ||
$suggestions = []; | ||
$entity = $variables['elements']['#localize_statistics']; | ||
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_'); | ||
|
||
$suggestions[] = 'localize_statistics__' . $sanitized_view_mode; | ||
$suggestions[] = 'localize_statistics__' . $entity->bundle(); | ||
$suggestions[] = 'localize_statistics__' . $entity->bundle() . '__' . $sanitized_view_mode; | ||
$suggestions[] = 'localize_statistics__' . $entity->id(); | ||
$suggestions[] = 'localize_statistics__' . $entity->id() . '__' . $sanitized_view_mode; | ||
return $suggestions; | ||
} | ||
|
||
/** | ||
* Implements hook_cron(). | ||
*/ | ||
function drupalfr_localize_statistics_cron() { | ||
\Drupal::service('drupalfr_localize_statistics.cron')->cron(); | ||
} |
16 changes: 16 additions & 0 deletions
16
app/modules/custom/drupalfr_localize_statistics/drupalfr_localize_statistics.permissions.yml
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,16 @@ | ||
add localize statistics entities: | ||
title: 'Create new localize statistics entities' | ||
|
||
administer localize statistics entities: | ||
title: 'Administer localize statistics entities' | ||
description: 'Allow to access the administration form to configure localize statistics entities.' | ||
restrict access: true | ||
|
||
delete localize statistics entities: | ||
title: 'Delete localize statistics entities' | ||
|
||
edit localize statistics entities: | ||
title: 'Edit localize statistics entities' | ||
|
||
view localize statistics entities: | ||
title: 'View localize statistics entities' |
13 changes: 13 additions & 0 deletions
13
app/modules/custom/drupalfr_localize_statistics/drupalfr_localize_statistics.services.yml
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,13 @@ | ||
services: | ||
logger.channel.drupalfr_localize_statistics: | ||
parent: logger.channel_base | ||
arguments: ['drupalfr_localize_statistics'] | ||
|
||
drupalfr_localize_statistics.cron: | ||
class: Drupal\drupalfr_localize_statistics\Service\LocalizeStatisticsCron | ||
arguments: | ||
- '@datetime.time' | ||
- '@state' | ||
- '@entity_type.manager' | ||
- '@logger.channel.drupalfr_localize_statistics' | ||
- '@http_client_factory' |
27 changes: 27 additions & 0 deletions
27
app/modules/custom/drupalfr_localize_statistics/localize_statistics.page.inc
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,27 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Contains localize_statistics.page.inc. | ||
* | ||
* Page callback for localize statistics entities. | ||
*/ | ||
|
||
use Drupal\Core\Render\Element; | ||
|
||
/** | ||
* Prepares variables for localize statistics templates. | ||
* | ||
* Default template: localize_statistics.html.twig. | ||
* | ||
* @param array $variables | ||
* An associative array containing: | ||
* - elements: An associative array containing the user information and any | ||
* - attributes: HTML attributes for the containing element. | ||
*/ | ||
function template_preprocess_localize_statistics(array &$variables) { | ||
// Helpful $content variable for templates. | ||
foreach (Element::children($variables['elements']) as $key) { | ||
$variables['content'][$key] = $variables['elements'][$key]; | ||
} | ||
} |
Oops, something went wrong.