Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds label fields for "Department" and "Job Type" on People List Pages #44

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions config/install/ucb_site_configuration.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ article_date_format: '0'
related_articles_enabled_by_default: FALSE
related_articles_exclude_categories: []
related_articles_exclude_tags: []
people_list_filter_1_label: ''
people_list_filter_2_label: ''
people_list_filter_3_label: ''
people_list_department_label: Department
people_list_job_type_label: Job Type
people_list_filter_1_label: Filter 1
people_list_filter_2_label: Filter 2
people_list_filter_3_label: Filter 3
14 changes: 14 additions & 0 deletions src/Form/ContentTypesForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'details',
'#title' => $this->t('People List Page'),
'#open' => TRUE,
'people_list_department_label' => [
'#type' => 'textfield',
'#title' => $this->t('Department label'),
'#default_value' => $settings->get('people_list_department_label') ?? 'Department',
'#description' => $this->t('Choose the label that will be used for "Department" on People List Pages.'),
],
'people_list_job_type_label' => [
'#type' => 'textfield',
'#title' => $this->t('Job Type label'),
'#default_value' => $settings->get('people_list_job_type_label') ?? 'Job Type',
'#description' => $this->t('Choose the label that will be used for "Job Type" on People List Pages.'),
],
'people_list_filter_1_label' => [
'#type' => 'textfield',
'#title' => $this->t('Filter 1 label'),
Expand Down Expand Up @@ -173,6 +185,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
->set('related_articles_enabled_by_default', $form_state->getValue('related_articles_enabled_by_default'))
->set('related_articles_exclude_categories', array_keys(array_filter($form_state->getValue('related_articles_exclude_categories'))))
->set('related_articles_exclude_tags', array_keys(array_filter($form_state->getValue('related_articles_exclude_tags'))))
->set('people_list_department_label', $form_state->getValue('people_list_department_label'))
->set('people_list_job_type_label', $form_state->getValue('people_list_job_type_label'))
->set('people_list_filter_1_label', $form_state->getValue('people_list_filter_1_label'))
->set('people_list_filter_2_label', $form_state->getValue('people_list_filter_2_label'))
->set('people_list_filter_3_label', $form_state->getValue('people_list_filter_3_label'))
Expand Down
2 changes: 2 additions & 0 deletions src/SiteConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ public function attachArticlesConfiguration(array &$variables) {
*/
public function attachPeopleListConfiguration(array &$variables) {
$settings = $this->getSettings();
$variables['people_list_department_label'] = $settings->get('people_list_department_label') ?? 'Department';
$variables['people_list_job_type_label'] = $settings->get('people_list_job_type_label') ?? 'Job Type';
$variables['people_list_filter_1_label'] = $settings->get('people_list_filter_1_label') ?? 'Filter 1';
$variables['people_list_filter_2_label'] = $settings->get('people_list_filter_1_label') ?? 'Filter 2';
$variables['people_list_filter_3_label'] = $settings->get('people_list_filter_1_label') ?? 'Filter 3';
Expand Down
2 changes: 1 addition & 1 deletion ucb_site_configuration.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CU Boulder Site Configuration
description: 'Allows CU Boulder site administrators to configure site-specific settings.'
core_version_requirement: ^9 || ^10
type: module
version: '2.6.2'
version: '2.6.3'
package: CU Boulder
dependencies:
- block
Expand Down
Loading