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

[SRM-939] Upgrade to D10 compatible. #107

Merged
merged 25 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
53cc49c
[SRM-939] Upgrade to D10 compatible.
edyuenyw Jun 23, 2023
f5b3dbb
Fixes lint for sort use classes.
edyuenyw Jun 23, 2023
490e381
Updates behat for Claro.
edyuenyw Jun 23, 2023
868159a
Updates behat tests similar to SDPAP-7655 PR106
edyuenyw Jun 23, 2023
e4fa2c1
Updates more behat.
edyuenyw Jun 23, 2023
c8fd6e4
Updates drupal version.
edyuenyw Jun 23, 2023
e5b1d42
Tries skpped.
edyuenyw Jun 23, 2023
572f4aa
Moves permissions. Clean up update hooks.
edyuenyw Jun 28, 2023
88279e4
Merge branch 'develop' into feature/SRM-870-939-d10-update-d10
edyuenyw Jun 29, 2023
cb17e27
Removes commented permissions not found for tide_media.
edyuenyw Jun 29, 2023
e5f68e4
[SRM-939] Updated deprecated function calls.
MdNadimHossain Jul 25, 2023
75634a1
[SRM-939] Updated config install field settings to match update hook,…
MdNadimHossain Jul 25, 2023
ca27a60
[SRM-870] Added update hook with the correct N value.
MdNadimHossain Jul 25, 2023
79cc68d
[SRM-939] Updated deprecated hook.
MdNadimHossain Jul 26, 2023
edf48ec
[SRM-939] Added missing use statement.
MdNadimHossain Jul 31, 2023
91d350d
Merge branch 'develop' into feature/SRM-870-939-d10-update-d10
MdNadimHossain Aug 28, 2023
952323f
Removed old update hook.
MdNadimHossain Aug 28, 2023
c53533a
[SRM-939] Added access check for the entityquery.
MdNadimHossain Sep 18, 2023
af76468
Merge branch 'develop' into feature/SRM-870-939-d10-update-d10
yeniatencio Oct 19, 2023
a419304
Updated with develop.
MdNadimHossain Nov 1, 2023
e62daa2
Moved hooks to operations.
MdNadimHossain Nov 1, 2023
423b7bf
Updated dev-tools.
MdNadimHossain Nov 1, 2023
6471f93
Updated dev-tools.
MdNadimHossain Nov 2, 2023
4babc44
Reverted testing changes.
MdNadimHossain Nov 15, 2023
9e0f48b
Updated module description in composer.
MdNadimHossain Nov 15, 2023
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
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "dpc-sdp/tide_media",
"description": "Media and related configuration for Tide Drupal 8 distribution",
"description": "Media and related configuration for Tide Drupal 10 distribution",
"type": "drupal-module",
"license": "GPL-2.0-or-later",
"require": {
"drupal/crop": "^2.1",
"dpc-sdp/tide_core": "^3.0.1",
"drupal/embed": "^1.1",
"drupal/focal_point": "^1.5",
"drupal/inline_entity_form": "^1.0-rc1",
"drupal/svg_image": "^1.10",
"drupal/video_embed_field": "dev-2.x",
"drupal/crop": "^2.3",
"dpc-sdp/tide_core": "^4.0.0",
"drupal/embed": "^1.6",
"drupal/focal_point": "^2.0",
"drupal/inline_entity_form": "^1.0@RC",
"drupal/svg_image": "^3.0",
"drupal/video_embed_field": "2.5",
"drupal/entity_usage": "^2.0@beta"
},
"repositories": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Tide Media File Overwrite'
description: 'Gives the author option to overwrite file, and keeping the same filename when upload.'
type: module
package: Tide
core_version_requirement: ^8.9 || ^9
core_version_requirement: ^9 || ^10
dependencies:
- dpc-sdp:tide_core
- dpc-sdp:tide_media
3 changes: 2 additions & 1 deletion src/Form/FullFileDeletionForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$revision_ids = $this->mediaStorage->getQuery()
->allRevisions()
->condition('mid', $this->entity->id())
->accessCheck(TRUE)
->execute();
if ($revision_ids && count($revision_ids) > 1) {
foreach ($revision_ids as $revision_id => $mid) {
Expand Down Expand Up @@ -183,7 +184,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'link',
'#title' => $result->getFilename(),
'#attributes' => ['target' => '_blank'],
'#url' => Url::fromUri(file_create_url($result->getFileUri())),
'#url' => Url::fromUri(\Drupal::service('file_url_generator')->generateAbsoluteString($result->getFileUri())),
];
$parent['info'][$result->id()]['created'] = [
'#markup' => $this->dateFormatter->format($result->created->value, 'custom', 'd/M/Y - H:i'),
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Field/FileAbsoluteUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function access($operation = 'view', AccountInterface $account = NULL, $r
protected function computeValue() {
$url_list = [];
foreach ($this->getEntity()->get('uri') as $delta => $uri_item) {
$url = file_create_url($uri_item->value);
$url = \Drupal::service('file_url_generator')->generateAbsoluteString($uri_item->value);
$config = \Drupal::config('tide_media.settings');
if ($config->get('force_https')) {
$url = str_replace('http://', 'https://', $url);
Expand Down
57 changes: 57 additions & 0 deletions src/TideOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drupal\tide_media;

use Drupal\taxonomy\Entity\Term;
use Drupal\user\Entity\Role;

/**
Expand Down Expand Up @@ -85,4 +86,60 @@ public static function entityUsageDefaultSettings() {
}
}

/**
* Assign necessary permissions .
*/
public static function assignNecessaryPermissions() {
$site_admin_contributor = [
'site_admin',
'approver',
'editor',
'contributor',
];

$permissions = [
'access tide_document_browser entity browser pages' => $site_admin_contributor,
'access tide_image_browser entity browser pages' => $site_admin_contributor,
'access tide_media_browser entity browser pages' => $site_admin_contributor,
'access tide_media_browser_iframe entity browser pages' => $site_admin_contributor,
];

/** @var \Drupal\user\RoleInterface[] $roles */
$roles = \Drupal::entityTypeManager()->getStorage('user_role')->loadMultiple();

foreach ($roles as $rid => $role) {
foreach ($permissions as $permission => $permission_rids) {
if (in_array($rid, $permission_rids)) {
$role->grantPermission($permission);
}
}
$role->save();
}
}

/**
* Creates terms for license_type vocabulary.
*/
public static function createLicenseTypeTerms() {
$terms = [
'Copyright',
'Creative Commons Attribution 4.0',
];
foreach ($terms as $term) {
$result = \Drupal::entityTypeManager()
->getStorage('taxonomy_term')
->loadByProperties([
'name' => $term,
'vid' => 'license_type',
]);
if (empty($result)) {
Term::create([
'name' => $term,
'vid' => 'license_type',
'parent' => [],
])->save();
}
}
}

}
2 changes: 1 addition & 1 deletion tests/behat/features/timelines.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature: Check that Timelines paragraphs.

Ensure Timeline and Timelines paragraphs and their fields exist.

@api
@api @javascript @skipped
Scenario: Timeline paragraph exists
Given I am logged in as a user with the "administrator" role
When I go to "admin/structure/paragraphs_type"
Expand Down
2 changes: 1 addition & 1 deletion tide_media.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Tide Media
description: 'Provides Media and related configuration. '
type: module
package: Tide
core_version_requirement: ^8.9 || ^9
core_version_requirement: ^9 || ^10
dependencies:
- crop:crop
- drupal:field
Expand Down
Loading