Skip to content

Conversation

martinyde
Copy link
Contributor

@martinyde martinyde commented Oct 8, 2025

Includes

  • Base functionality with a new itk_video field type
  • Support for Videotool and Vimeo
  • Support for CookieInformation.com
  • Config page.
Skærmbillede 2025-10-09 kl  08 32 33 Skærmbillede 2025-10-09 kl  08 32 51 Skærmbillede 2025-10-09 kl  08 33 12

@martinyde martinyde requested a review from rimi-itk October 9, 2025 07:42
Copy link

@rimi-itk rimi-itk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this works, but some parts are hard to understand. Some comments added and questions asked.

# itk_video
# ITK Video

Module that supplies video integration, through a dedicated itk_video field
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Module that supplies video integration, through a dedicated itk_video field
Module that supplies video integration through a dedicated itk_video field

Comment on lines +13 to +18
The definitions include;

- host : Used to identify the provider from the supplied video URL.
- type : Used to determine if videoinformation should be retrieved bu this
module (custom) or Oembed
- requiredCookies : The cookies that the provider sets when embedding a video
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The definitions include;
- host : Used to identify the provider from the supplied video URL.
- type : Used to determine if videoinformation should be retrieved bu this
module (custom) or Oembed
- requiredCookies : The cookies that the provider sets when embedding a video
The definitions include
- host: Used to identify the provider from the supplied video URL.
- type: Used to determine if videoinformation should be retrieved bu this
module (custom) or Oembed
- requiredCookies: The cookies that the provider sets when embedding a video

Comment on lines +27 to +28
The module includes a permission to access the configuration page:
```"Administer ITK Video settings"```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The module includes a permission to access the configuration page:
```"Administer ITK Video settings"```
The module includes a permission to access the configuration page: "Administer ITK Video settings"

The module includes a permission to access the configuration page:
```"Administer ITK Video settings"```

If allowed access the settings are set on ```/admin/config/media/itk-video```.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If allowed access the settings are set on ```/admin/config/media/itk-video```.
If allowed access the settings are set on `/admin/config/media/itk-video`.


## Code

To check that coding standards are up to scratch run the following commands:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does “up to scratch” mean?

$requiredCookies = $supportedProviders[$providerKey]['requiredCookies'];

if (!empty($requiredCookies) && isset($videoArray['iframe'])) {
$videoArray['iframe'] = str_replace(' src="', ' src="" data-category-consent="' . $requiredCookies . '" data-consent-src="', $videoArray['iframe']);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably works, but it makes a lot of assumptions on the structure of the iframe HTML.

Comment on lines +200 to +201
$blockedText .= '<br>';
$blockedText .= $fieldValue->title ? '"' . $fieldValue->title . '"' : '';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$blockedText .= '<br>';
$blockedText .= $fieldValue->title ? '"' . $fieldValue->title . '"' : '';
if ($fieldValue->title) {
$blockedText .= '<br>"' . $fieldValue->title.'"';
}

Comment on lines +28 to +29
'title' => DRUPAL_REQUIRED,
'link_type' => LinkItemInterface::LINK_EXTERNAL,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how this “title” trick is used …

// However, if it is inaccessible to the current user, do not display it
// to them.
// @phpstan-ignore globalDrupalDependencyInjection.useDependencyInjection
if (\Drupal::currentUser()->hasPermission('link to any page') || $item->getUrl()->access()) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use dependency injection to get the current user.

/**
* {@inheritdoc}
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand what's going on in this function, but it seems complicated.

I suppose that inserting a video requires both a title and a URL. Do we need this much code to ensure that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants