Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnvanbreda committed Sep 25, 2024
2 parents 9af76ff + 11243cd commit 03b3bcf
Show file tree
Hide file tree
Showing 40 changed files with 3,141 additions and 140 deletions.
2 changes: 1 addition & 1 deletion easy_login/easy_login.module
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function easy_login_call_get_user_id(
* Should the updated account be saved?
*/
function easy_login_handle_get_user_id_response($account, $response, $save) {
$response = json_decode($response);
$response = json_decode($response ?? '{}');
if (!empty($response->userId)) {
if (!account_has_valid_warehouse_user_id($account) || $account->field_indicia_user_id->value != $response->userId) {
// @todo: no need for these messages during registration
Expand Down
56 changes: 44 additions & 12 deletions group_landing_pages/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Provides landing pages for groups (sometimes known as activities or projects). After installation,
the landing page for any group can be found at the URL `/groups/<group title>`, where
`<group title>` is replaced by the title of the group in lowercase and with spaces replaced by
hyphens.
hyphens. Group landing pages arae themeable using the Drupal templating system and can include
various reports and data outputs built using group data as well as a blog of news about the group.

If you are using this module to provide access to a public landing page for groups, that users who
are not logged in can access, then ensure that you set the "Elasticsearch all records permission"
Expand All @@ -11,21 +12,47 @@ page.

# Theming the group landing page output

The Group Landing Pages module renders the landing page for a group using a theme hook called
`group_landing_page`. An example template is provided in the module's templates folder which
describes the variables available in the header comment. Copy the `group-landing-page.html.twig`
file to your theme's templates folders and modify it if you need a customised default group landing
page template.
The Group Landing Pages module renders the landing page for a group using the following theme
hooks:
* `group_landing_page_tabs` - the tab container for the page.
* `group_landing_page_overview` - the main overview tab.
* `group_landing_page_progress` - the progress summary tab.
* `group_landing_page_taxa` - the taxa/species information tab.

Example templates are provided in the module's templates folder which describes the variables
available in the header comment. Copy the required files to your theme's templates folders and
modify them if you need a customised default group landing page template.

Theme suggestions are provided to allow you to create versions of the template file specific to
certain group types, or specific to individual groups:
* `group-landing-page--type-<type>.html.twig` - replace `<type>` with the group type in lowercase
certain group types, to container/contained groups, or specific to individual groups:

* `<theme_hook>-type-<type>.html.twig` - replace `<type>` with the group type in lowercase
and with non-alphabetic characters replaced by hyphens (e.g. bioblitz or local-project). This
template will then be used for all groups of that type, unless individually overridden as
described below.
* `group-landing-page--id-<id>.html.twig` - replace `<id>` with the numeric group unique
* `<theme_hook>--contained.html.twig` - used for groups that are contained within a parent
container group.
* `<theme_hook>--container.html.twig` - used for groups that are containers for other contained
groups.
* `<theme_hook>--contained--type-<type>.html.twig` - used for groups that are contained within a
parent container group and of the given type.
* `<theme_hook>--container--type-<type>.html.twig` - used for groups that are containers for other
contained groups and of the given type.
* `<theme_hook>--contained--type-<type>--parent-id-<id>.html.twig` - used for groups that are
contained within a parent container group with the given ID and where the contained group is of
the given type.
* `<theme_hook>--id-<id>.html.twig` - replace `<id>` with the numeric group unique
identifier. This template will then be used only by that specific group.

Here are some example template suggestions for the overview tab, for group ID 5, which is contained
within group ID 1 and where the type is set to "project":
* group-landing-page-overview--id-5.html.twig
* group-landing-page-overview--contained--type-project--parent-id-1.html.twig
* group-landing-page-overview--contained--type-project.html.twig
* group-landing-page-overview--contained.html.twig
* group-landing-page-overview--type-project.html.twig
* group-landing-page-overview.html.twig.

# Blocks

The Group Landing Pages module relies on the [Twig Tweak](https://www.drupal.org/project/twig_tweak)
Expand All @@ -38,11 +65,12 @@ contributed module to allow blocks to be embedded into the templates, for exampl
In most cases you will want to specify the unverified_records config option so that unverified
records are included. A number of blocks are provided by the Indicia Blocks module which can be
embedded in templates, including the following:
* es_accumulation_chart_block
* es_all_records_map_block - available variables:
* `base_layer` - options are OpenStreetMap, OpenTopoMap, GoogleSatellite, GoogleRoadMap,
GoogleTerrain, GoogleHybrid.
* `map_layer_type` - options are circle, square, heat, geohash.
* es_phenology_graph_block
* es_phenology_chart_block
* es_recent_photos - available variables:
* `limit` (count of photos, integer)
* es_recent_records_block - available variables:
Expand All @@ -52,6 +80,7 @@ embedded in templates, including the following:
* es_records_by_verification_status_pie_block - available options:
* `level_2` - (1 or 0, should level 2 verification decision detail be included as a doughnut
ring?).
* es_records_by_year_chart_block
* es_top_recorders_table_block - available variables:
* `limit` (count of rows, integer)
* `include_records` (1 or 0)
Expand All @@ -60,5 +89,8 @@ embedded in templates, including the following:
* es_totals_block

The Group Landing Pages module also provides the following blocks:
* group_landing_pages_group_page_links - a list of links to pages that have been linked to the
group.
* group_landing_pages_group_page_links - a list of links to pages related to the group which the
user has access to.

Refer to the provided template (templates/group-landing-page-overview.html.twig) for and example of
how to include the group blog entries view on the page.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
langcode: en
status: true
dependencies:
config:
- field.field.node.group_blog.body
- field.field.node.group_blog.field_group_id
- node.type.group_blog
module:
- text
id: node.group_blog.default
targetEntityType: node
bundle: group_blog
mode: default
content:
body:
type: text_textarea_with_summary
weight: 1
region: content
settings:
rows: 9
summary_rows: 3
placeholder: ''
show_summary: false
third_party_settings: { }
field_group_id:
type: number
weight: 2
region: content
settings:
placeholder: ''
third_party_settings: { }
title:
type: string_textfield
weight: 0
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
hidden:
created: true
path: true
promote: true
status: true
sticky: true
uid: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
langcode: en
status: true
dependencies:
config:
- field.field.node.group_blog.body
- field.field.node.group_blog.field_group_id
- node.type.group_blog
module:
- text
- user
id: node.group_blog.default
targetEntityType: node
bundle: group_blog
mode: default
content:
body:
type: text_default
label: hidden
settings: { }
third_party_settings: { }
weight: 0
region: content
links:
settings: { }
third_party_settings: { }
weight: 1
region: content
hidden:
field_group_id: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.teaser
- field.field.node.group_blog.body
- field.field.node.group_blog.field_group_id
- node.type.group_blog
module:
- text
- user
id: node.group_blog.teaser
targetEntityType: node
bundle: group_blog
mode: teaser
content:
body:
type: text_summary_or_trimmed
label: hidden
settings:
trim_length: 600
third_party_settings: { }
weight: 101
region: content
links:
settings: { }
third_party_settings: { }
weight: 100
region: content
hidden:
field_group_id: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
langcode: en
status: true
dependencies:
config:
- field.storage.node.body
- node.type.group_blog
module:
- text
id: node.group_blog.body
field_name: body
entity_type: node
bundle: group_blog
label: Body
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
display_summary: true
required_summary: false
allowed_formats: { }
field_type: text_with_summary
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_group_id
- node.type.group_blog
id: node.group_blog.field_group_id
field_name: field_group_id
entity_type: node
bundle: group_blog
label: 'Group ID'
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: 1
max: null
prefix: ''
suffix: ''
field_type: integer
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
langcode: en
status: true
dependencies:
module:
- node
id: node.field_group_id
field_name: field_group_id
entity_type: node
type: integer
settings:
unsigned: false
size: normal
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
group_label: group
container_group_label: project
contained_group_label: project group
group_edit_alias: /groups/edit
species_details_alias: ''
species_details_within_group_alias: ''
logo_selector: '[rel="home"][class*=logo]'
16 changes: 16 additions & 0 deletions group_landing_pages/config/install/node.type.group_blog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
langcode: en
status: true
dependencies:
module:
- menu_ui
third_party_settings:
menu_ui:
available_menus: { }
parent: ''
name: 'Group blog'
type: group_blog
description: 'Blog entries for Indicia recording groups.'
help: null
new_revision: false
preview_mode: 1
display_submitted: true
Loading

0 comments on commit 03b3bcf

Please sign in to comment.