You are here

private function Update350::processField in Lightning Media 8.3

Same name and namespace in other branches
  1. 8.4 modules/lightning_media_video/src/Update/Update350.php \Drupal\lightning_media_video\Update\Update350::processField()

Removes translatability from a field after confirming the action.

Parameters

\Symfony\Component\Console\Style\StyleInterface $io: The I/O handler.

\Drupal\field\Entity\FieldConfig $field: The field from which to remove translatability.

2 calls to Update350::processField()
Update350::removeVideoFileLibraryFieldTranslatability in modules/lightning_media_video/src/Update/Update350.php
Makes field_media_in_library non-translatable in the video_file media type.
Update350::removeVideoLibraryFieldTranslatability in modules/lightning_media_video/src/Update/Update350.php
Makes field_media_in_library non-translatable in the video media type.

File

modules/lightning_media_video/src/Update/Update350.php, line 106

Class

Update350
Contains optional updates targeting Lightning Media Video 3.5.0.

Namespace

Drupal\lightning_media_video\Update

Code

private function processField(StyleInterface $io, FieldConfig $field) {
  $media_type = $field
    ->getTargetBundle();
  $variables = [
    '@field' => $field
      ->label(),
    '@media_type' => $this->mediaTypeStorage
      ->load($media_type)
      ->label(),
  ];
  $question = (string) $this
    ->t('Do you want to remove translatability for the @field field of @media_type media?', $variables);
  if ($io
    ->confirm($question)) {
    $this->fieldStorage
      ->save($field
      ->setTranslatable(FALSE));
  }
}