Skip to content

Commit

Permalink
Phpcs fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
szatom committed Oct 20, 2023
1 parent 6f96001 commit aa5f398
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion media_upload.module
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function media_upload_form_media_type_edit_form_alter(&$form, FormStateInterface
'#title' => t('Media upload configuration'),
];

// @todo: Add states for better UX (hide fields if enabled is FALSE).
// @todo Add states for better UX (hide fields if enabled is FALSE).
$form['media_upload']['enabled'] = [
'#type' => 'checkbox',
'#default_value' => $type->getThirdPartySetting('media_upload', 'enabled'),
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/MediaUploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use function ksort;

/**
* Class MediaUploadController.
* List media/add links for bulk upload enabled.
*
* @package Drupal\media_upload\Controller
*/
Expand Down
14 changes: 7 additions & 7 deletions src/Form/BulkMediaUploadForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
use Drupal\file\FileInterface;
use Drupal\file\FileRepositoryInterface;
use Drupal\media\MediaTypeInterface;
use Exception;
use InvalidArgumentException;
use Symfony\Component\DependencyInjection\ContainerInterface;
use function explode;
use function file_get_contents;
Expand All @@ -27,7 +25,7 @@
use function trim;

/**
* Class BulkMediaUploadForm.
* Bulk media upload form.
*
* @package Drupal\media_upload\Form
*/
Expand Down Expand Up @@ -127,6 +125,8 @@ public static function create(ContainerInterface $container) {
* Token service.
* @param \Drupal\Core\File\FileSystemInterface $fileSystem
* The file system.
* @param \Drupal\file\FileRepositoryInterface $fileRepository
* File repository service.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
Expand Down Expand Up @@ -300,7 +300,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
continue;
}

// @todo: Not sure if strtolower() is the best approach.
// @todo Not sure if strtolower() is the best approach.
if (!in_array(
strtolower($fileInfo[static::EXT_NAME]),
explode(' ', strtolower($targetFieldSettings['file_extensions'])),
Expand Down Expand Up @@ -357,7 +357,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
->addMessage($this->t('@fileCount documents have been uploaded', ['@fileCount' => $fileCount]));
return;
}
catch (Exception $e) {
catch (\Exception $e) {
$this->logger->critical($e->getMessage());
$this->messenger()->addError($e->getMessage());

Expand All @@ -381,12 +381,12 @@ protected function getTargetFieldName($typeId) {
$type = $this->mediaTypeStorage->load($typeId);

if (NULL === $type) {
throw new InvalidArgumentException("The '{$typeId}' type can not be found.");
throw new \InvalidArgumentException("The '{$typeId}' type can not be found.");
}

$mediaUploadSettings = $type->getThirdPartySettings('media_upload');
if (empty($mediaUploadSettings) || !isset($mediaUploadSettings['enabled']) || (bool) $mediaUploadSettings['enabled'] === FALSE) {
throw new InvalidArgumentException("Bulk-upload is not enabled for the {$type->label()} type.");
throw new \InvalidArgumentException("Bulk-upload is not enabled for the {$type->label()} type.");
}

return $mediaUploadSettings['upload_target_field'];
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Derivative/BulkMediaUploadMenuLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Class BulkMediaUploadMenuLink.
* Generate links for media bundles - for bulk upload enabled.
*
* @package Drupal\media_upload\Plugin\Derivative
*/
Expand Down

0 comments on commit aa5f398

Please sign in to comment.