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

UHF-8932: Sidebar content and TPR unit config changes #605

Merged
merged 8 commits into from
Oct 10, 2023
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
15 changes: 0 additions & 15 deletions modules/hdbt_admin_tools/hdbt_admin_tools.module
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use Drupal\hdbt_admin_tools\Form\SiteSettings;
use Drupal\hdbt_admin_tools\Plugin\Field\FieldType\SelectIcon;
use Drupal\helfi_api_base\Link\UrlHelper;
use Drupal\helfi_tpr\Entity\Service;
use Drupal\helfi_tpr\Entity\Unit;
use Drupal\node\NodeInterface;
use Drupal\user\UserInterface;

Expand Down Expand Up @@ -386,20 +385,6 @@ function hdbt_admin_tools_handle_sidebar_visibility(array &$variables, ContentEn
$variables['has_sidebar_second'] = TRUE;
}

// Enable sidebar second for TPR unit if contact information exists.
if ($entity instanceof Unit) {
if (
!$entity->get('address')->isEmpty() ||
!$entity->get('email')->isEmpty() ||
!$entity->get('phone')->isEmpty() ||
!$entity->get('address_postal')->isEmpty() ||
!$entity->get('opening_hours')->isEmpty() ||
!$entity->get('www')->isEmpty()
) {
$variables['has_sidebar_second'] = TRUE;
}
}

// Enable sidebar second for TPR service if important links exists.
if ($entity instanceof Service && !$entity->get('links')->isEmpty()) {
$variables['has_sidebar_second'] = TRUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,22 @@ content:
third_party_settings: { }
weight: 23
region: content
latitude:
type: string
label: hidden
settings:
link_to_entity: false
third_party_settings: { }
weight: 24
region: content
longitude:
type: string
label: hidden
settings:
link_to_entity: false
third_party_settings: { }
weight: 23
region: content
name:
type: string
label: hidden
Expand Down Expand Up @@ -224,7 +240,5 @@ hidden:
field_unit_type: true
hide_description: true
langcode: true
latitude: true
longitude: true
show_www: true
streetview_entrance_url: true
9 changes: 9 additions & 0 deletions modules/helfi_tpr_config/helfi_tpr_config.install
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,12 @@ function helfi_tpr_config_update_9045() : void {
\Drupal::service('helfi_platform_config.config_update_helper')
->update('helfi_tpr_config');
}

/**
* UHF-8932 Add fields coordinates to display.
*/
function helfi_tpr_config_update_9046(): void {
// Re-import 'helfi_tpr_config' configuration.
\Drupal::service('helfi_platform_config.config_update_helper')
->update('helfi_tpr_config');
}
8 changes: 0 additions & 8 deletions src/Plugin/Block/LowerContentBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\helfi_platform_config\EntityVersionMatcher;
use Drupal\helfi_tpr\Entity\Service;
use Drupal\helfi_tpr\Entity\Unit;

/**
* Provides a 'LowerContentBlock' block.
Expand All @@ -31,13 +30,6 @@ public function build() : array {
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
['entity' => $entity, 'entity_version' => $entity_version] = $this->getCurrentEntityVersion();

// Pass the Unit entity render array to templates if one exists.
if ($entity instanceof Unit) {
$view_builder = $this->entityTypeManager->getViewBuilder('tpr_unit');
$build['lower_content']['#computed'] = $view_builder->view($entity);
$build['lower_content']['#computed']['#theme'] = 'tpr_unit_lower_content';
}

// Pass the Service entity render array to templates if one exists.
if ($entity instanceof Service) {
$view_builder = $this->entityTypeManager->getViewBuilder('tpr_service');
Expand Down
8 changes: 0 additions & 8 deletions src/Plugin/Block/SidebarContentBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\helfi_platform_config\EntityVersionMatcher;
use Drupal\helfi_tpr\Entity\Service;
use Drupal\helfi_tpr\Entity\Unit;

/**
* Provides a 'SidebarContentBlock' block.
Expand All @@ -31,13 +30,6 @@ public function build() : array {
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
['entity' => $entity, 'entity_version' => $entity_version] = $this->getCurrentEntityVersion();

// Pass Unit entity render array to templates.
if ($entity instanceof Unit) {
$view_builder = $this->entityTypeManager->getViewBuilder('tpr_unit');
$build['sidebar_content']['#computed'] = $view_builder->view($entity);
$build['sidebar_content']['#computed']['#theme'] = 'tpr_unit_contact_information';
}

// Pass the Service entity render array to templates if one exists.
if ($entity instanceof Service) {
$view_builder = $this->entityTypeManager->getViewBuilder('tpr_service');
Expand Down