Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into feature/SDPAP-8222-new-paragraph-for-site
Browse files Browse the repository at this point in the history
  • Loading branch information
yeniatencio authored Feb 14, 2024
2 parents 3123dfd + 5a1f99c commit e331b3f
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 791 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: build

on: push

jobs:
set_status_in_progress:
name: set_status_in_progress
if: always()
uses: dpc-sdp/github-actions/.github/workflows/set_status.yml@main
secrets: inherit
with:
context: 'tide_build'
description: 'Tide Build running...'
state: 'pending'
target_url: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}
tide_build:
name: tide_build
secrets: inherit
uses: dpc-sdp/github-actions/.github/workflows/tide_build.yml@main
with:
module_build: true
runner: biggy-tide
export_config:
name: export_config
secrets: inherit
uses: dpc-sdp/github-actions/.github/workflows/export_config.yml@main
set_status:
name: set_status
needs: [tide_build]
if: always()
uses: dpc-sdp/github-actions/.github/workflows/set_status.yml@main
secrets: inherit
with:
context: 'tide_build'
description: 'Tide Build'
target_url: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}
14 changes: 14 additions & 0 deletions .github/workflows/dorg_git_sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: dorg_git_sync

on:
push:
branches:
- master
tags:
- '*'

jobs:
dorg_git_sync:
name: dorg_git_sync
uses: dpc-sdp/github-actions/.github/workflows/dorg_git_sync.yml@main
secrets: inherit
31 changes: 31 additions & 0 deletions .github/workflows/merge_to_reference.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: merge_to_reference

on:
push:
branches:
- develop

jobs:
set_status_in_progress:
name: set_status_in_progress
if: always()
uses: dpc-sdp/github-actions/.github/workflows/set_status.yml@main
secrets: inherit
with:
context: 'tide_merge_to_reference'
description: 'Merge to reference running...'
state: 'pending'
target_url: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}
tide_merge_to_reference:
name: tide_merge_to_reference
uses: dpc-sdp/github-actions/.github/workflows/tide_merge_to_reference.yml@main
set_status:
name: set_status
needs: [tide_merge_to_reference]
if: always()
uses: dpc-sdp/github-actions/.github/workflows/set_status.yml@main
secrets: inherit
with:
context: 'tide_merge_to_reference'
description: 'Merge to reference running...'
target_url: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}
16 changes: 11 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@
"type": "drupal-module",
"license": "GPL-2.0-or-later",
"require": {
"dpc-sdp/tide_core": "^3.2.5",
"dpc-sdp/tide_media": "^3.0.8",
"drupal/create_menus_permission": "^1.0",
"dpc-sdp/tide_core": "^4.0.0",
"dpc-sdp/tide_media": "^4.0.0",
"drupal/create_menus_permission": "dev-drupal_10_compatibility",
"drupal/key_value_field": "^1.3"
},
"suggest": {
"dpc-sdp/tide_api:^3.0.0": "Allows to use Drupal in headless mode"
"dpc-sdp/tide_api:^4.0.0": "Allows to use Drupal in headless mode"
},
"repositories": {
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/8"
"url": "https://packages.drupal.org/10",
"exclude": ["drupal/create_menus_permission"]
},
"drupal/create_menus_permission": {
"type": "vcs",
"no-api": true,
"url": "https://github.com/dpc-sdp/create_menus_permission.git"
}
},
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion modules/tide_site_preview/tide_site_preview.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Tide Site - Preview links'
description: Provides frontend preview links for content managed with Tide Site.
type: module
package: Tide
core_version_requirement: ^8.9 || ^9
core_version_requirement: ^9 || ^10
dependencies:
- dpc-sdp:tide_site
- dpc-sdp:tide_api
Expand Down
28 changes: 0 additions & 28 deletions modules/tide_site_preview/tide_site_preview.install
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* Tide Site install file.
*/

use Drupal\block\Entity\Block;
use Drupal\user\Entity\Role;

/**
Expand All @@ -22,30 +21,3 @@ function tide_site_preview_install() {
}
}
}

/**
* Remove block.block.seven_tide_site_preview_links.
*/
function tide_site_preview_update_8001() {
$block = Block::load('seven_tide_site_preview_links');
if ($block !== NULL) {
$block->delete();
}
}

/**
* Install block.block.claro_tide_site_preview_links.
*/
function tide_site_preview_update_8002() {
\Drupal::moduleHandler()->loadInclude('tide_core', 'inc', 'includes/helpers');
$config_location = [\Drupal::service('extension.list.module')->getPath('tide_site_preview') . '/config/optional'];
$storage = \Drupal::entityTypeManager()->getStorage('block');
$id = 'claro_tide_site_preview_links';
$config_entity = $storage->load($id);
if ($config_entity !== NULL) {
$storage->delete([$config_entity]);
}
$config_read = _tide_read_config('block.block.claro_tide_site_preview_links', $config_location, FALSE);
$new_config_entity = $storage->createFromStorageRecord($config_read);
$new_config_entity->save();
}
17 changes: 0 additions & 17 deletions modules/tide_site_simple_sitemap/tide_site_simple_sitemap.install
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ function tide_site_simple_sitemap_install($is_syncing) {
_update_settings();
}

/**
* Updates bundle settings.
*/
function tide_site_simple_sitemap_update_8008(&$sandbox) {
_update_settings();
}

/**
* Update for sitemap 4.x.
*/
Expand Down Expand Up @@ -83,13 +76,3 @@ function _update_settings() {
}
}
}

/**
* Removes simple_sitemap_site table.
*/
function tide_site_simple_sitemap_update_8009() {
$hasTable = \Drupal::database()->schema()->tableExists('simple_sitemap_site');
if ($hasTable === TRUE) {
\Drupal::database()->schema()->dropTable('simple_sitemap_site');
}
}
11 changes: 9 additions & 2 deletions src/Commands/TideSiteCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Drupal\tide_site\Commands;

use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\taxonomy\Entity\Term;
use Drush\Commands\DrushCommands;

/**
Expand Down Expand Up @@ -43,8 +44,14 @@ public function siteEnvDomainUpdate() {
foreach (explode(',', $fe_domains) as $fe_domain) {
$domain = explode('|', $fe_domain);
$term = Term::load($domain[0]);
$term->set('field_site_domains', str_replace('<br/>', "\r\n", $domain[1]));
$term->save();
// Check if the term exists before trying to manipulate it.
if ($term) {
$term->set('field_site_domains', str_replace('<br/>', "\r\n", $domain[1]));
$term->save();
}
else {
$this->output()->writeln($this->t('Term with ID @term_id not found.', ['@term_id' => $domain[0]]));
}
}
$this->output()->writeln($this->t('Domains Updated.'));
}
Expand Down
22 changes: 11 additions & 11 deletions src/EventSubscriber/TideSiteRequestEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableResponseInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Routing\RouteObjectInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Url;
use Drupal\jsonapi\Routing\Routes;
use Drupal\jsonapi_extras\ResourceType\ConfigurableResourceType;
use Drupal\tide_site\TideSiteFields;
use Drupal\tide_site\TideSiteHelper;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;

/**
Expand Down Expand Up @@ -86,13 +86,13 @@ public static function getSubscribedEvents() {
/**
* Add Site filter to the request of JSON API controller.
*
* @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
* @param \Symfony\Component\HttpKernel\Event\RequestEvent $event
* The event.
*
* @see \Symfony\Component\HttpKernel\HttpKernel::handleRaw()
* @see \Drupal\jsonapi\Controller\RequestHandler::handle()
*/
public function onRequestAddSiteFilter(GetResponseEvent $event) {
public function onRequestAddSiteFilter(RequestEvent $event) {
if (!$this->jsonApiEnabled) {
return;
}
Expand Down Expand Up @@ -214,16 +214,16 @@ public function onRequestAddSiteFilter(GetResponseEvent $event) {
/**
* Add Site to cache context and tags of JSON API response.
*
* @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
* @param \Symfony\Component\HttpKernel\Event\ResponseEvent $event
* The event object.
*/
public function onResponseAddSiteFilterCacheContext(FilterResponseEvent $event) {
public function onResponseAddSiteFilterCacheContext(ResponseEvent $event) {
$response = $event->getResponse();
if (!$response instanceof CacheableResponseInterface) {
return;
}

$site_id = $event->getRequest()->query->get('site');
$site_id = $event->getRequest()->query->all()['site'] ?? [];
if ($site_id) {
$context = $response->getCacheableMetadata()->getCacheContexts();
$context = Cache::mergeContexts($context, ['url.query_args:site']);
Expand All @@ -246,22 +246,22 @@ public function onResponseAddSiteFilterCacheContext(FilterResponseEvent $event)
* The Resource type.
*/
protected function setSiteFilterToJsonApi(Request $request, array $site_filter, ConfigurableResourceType $resource_type) {
$filter = $request->query->get('filter', []);
$filter = $request->query->all()['filter'] ?? [];
$filter['site'] = $site_filter;
$request->query->set('filter', $filter);
}

/**
* Create a JSON Response for error message.
*
* @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
* @param \Symfony\Component\HttpKernel\Event\RequestEvent $event
* The event.
* @param string $error_message
* The error message.
* @param int $code
* The error code, default to 400.
*/
protected function setEventErrorResponse(GetResponseEvent $event, $error_message, $code = Response::HTTP_BAD_REQUEST) {
protected function setEventErrorResponse(RequestEvent $event, $error_message, $code = Response::HTTP_BAD_REQUEST) {
$json_response = [
'links' => [
'self' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Linkit/Substitution/Canonical.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function create(ContainerInterface $container, array $configuratio
*/
public function getUrl(EntityInterface $entity) {
/** @var \Drupal\Core\GeneratedUrl $url */
$url = parent::getUrl($entity);
$url = parent::getUrl($entity)->toString(TRUE);

// Remove the site prefix from path alias when responding from
// JSONAPI entity resource with site parameter.
Expand Down
2 changes: 1 addition & 1 deletion tide_site.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Tide site'
description: 'Functionality to allow post content to multiple sites and sections.'
type: module
package: Tide
core_version_requirement: ^8.9 || ^9
core_version_requirement: ^9.5 || ^10
dependencies:
- drupal:field
- drupal:field_ui
Expand Down
Loading

0 comments on commit e331b3f

Please sign in to comment.