Skip to content
Snippets Groups Projects

#3368149 MR for the changes.

Open Nitin Lama requested to merge issue/file_entity-3368149:3368149--t-calls into 8.x-2.x

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
124 126 $extract_dir = $this->config('system.file')->get('default_scheme') . '://' . pathinfo($archive->getFilename(), PATHINFO_FILENAME);
125 127 $extract_dir = $this->fileSystem->getDestinationFilename($extract_dir, FileSystemInterface::EXISTS_RENAME);
126 128 if (!$this->fileSystem->prepareDirectory($extract_dir, FileSystemInterface::MODIFY_PERMISSIONS | FileSystemInterface::CREATE_DIRECTORY)) {
127 throw new \Exception(t('Unable to prepare, the directory %dir for extraction.', array('%dir' => $extract_dir)));
129 throw new \Exception($this->t('Unable to prepare, the directory %dir for extraction.', array('%dir' => $extract_dir)));
  • 244 246 $this->assertSession()->linkByHrefExists('file/1/delete');
    245 247 $this->assertSession()->linkByHrefExists('file/2/delete');
    246 248 $this->drupalGet('file/1/delete');
    247 $this->assertSession()->titleEquals((string) t('Are you sure you want to delete the file @filename? | Drupal', array('@filename' => FileEntity::load(1)->label())));
    249 $this->assertSession()->titleEquals((string) $this->t('Are you sure you want to delete the file @filename? | Drupal', array('@filename' => FileEntity::load(1)->label())));
  • Neha Verma added 1 commit

    added 1 commit

    Compare with previous version

  • 19 20 */
    20 21 class FileController extends ControllerBase {
    21 22
    23 use StringTranslationTrait;
    24
    25 /**
    26 * Class constructor.
    27 *
    28 * @param \Drupal\Core\StringTranslation\TranslationInterface $translation
    29 * The translation service.
    30 */
    • Comment on lines +25 to +30

      The documentation comment for constructors is not mandatory anymore, If it is given, the description must be Constructs a new [class name] object. where [class name] includes the class namespace.

    • Please register or sign in to reply
  • 78 91 // Ensure there is a valid token to download this file.
    79 92 if (!$this->config('file_entity.settings')->get('allow_insecure_download')) {
    80 93 if (!isset($_GET['token']) || $_GET['token'] !== $file->getDownloadToken()) {
    81 return new Response(t('Access to file @url denied', array('@url' => $file->getFileUri())), 403);
    94 return new Response($this->getStringTranslation()->translate('Access to file @url denied', array('@url' => $file->getFileUri())), 403);
  • 99 112 return new BinaryFileResponse($file->getFileUri(), 200, $headers, FALSE, 'attachment');
    100 113 }
    101 114 catch (FileNotFoundException $e) {
    102 return new Response(t('File @uri not found', array('@uri' =>$file->getFileUri())), 404);
    115 return new Response($this->getStringTranslation()->translate('File @uri not found', array('@uri' =>$file->getFileUri())), 404);
  • 131 144 if (!$form_state->isExecuted()) {
    132 145 // Return the form as a modal dialog.
    133 146 $form['#attached']['library'][] = 'core/drupal.dialog.ajax';
    134 $title = $this->t('Edit file @file', ['@file' => $file->label()]);
    147 $title = $this->getStringTranslation()->translate('Edit file @file', ['@file' => $file->label()]);
  • 19 20 class FileAddArchiveForm extends FormBase {
    20 21
    21 22 use UploadValidatorsTrait;
    22
    23 use StringTranslationTrait;
    24
    25 /**
    26 * Class constructor.
    27 *
    28 * @param \Drupal\Core\StringTranslation\TranslationInterface $translation
    29 * The translation service.
    30 */
    • Comment on lines +25 to +30

      The documentation comment for constructors is not mandatory anymore, If it is given, the description must be Constructs a new [class name] object. where [class name] includes the class namespace.

    • Please register or sign in to reply
  • 80 92
    81 93 $form['upload'] = array(
    82 94 '#type' => 'managed_file',
    83 '#title' => $this->t('Upload an archive file'),
    95 '#title' => $this->getStringTranslation()->translate('Upload an archive file'),
  • 80 92
    81 93 $form['upload'] = array(
    82 94 '#type' => 'managed_file',
    83 '#title' => $this->t('Upload an archive file'),
    95 '#title' => $this->getStringTranslation()->translate('Upload an archive file'),
    84 96 '#upload_location' => 'public://',
    85 97 '#progress_indicator' => 'bar',
    86 98 '#default_value' => $form_state->has('file') ? array($form_state->get('file')->id()) : NULL,
    87 99 '#required' => TRUE,
    88 '#description' => $this->t('Files must be less than <strong>%valid_size</strong><br> Allowed file types: <strong>%valid_extension</strong>', array('%valid_size' => format_size($validators['file_validate_size'][0]), '%valid_extension' => $validators['file_validate_extensions'][0])),
    100 '#description' => $this->getStringTranslation()->translate('Files must be less than <strong>%valid_size</strong><br> Allowed file types: <strong>%valid_extension</strong>', array('%valid_size' => format_size($validators['file_validate_size'][0]), '%valid_extension' => $validators['file_validate_extensions'][0])),
  • 95 '#title' => $this->getStringTranslation()->translate('Upload an archive file'),
    84 96 '#upload_location' => 'public://',
    85 97 '#progress_indicator' => 'bar',
    86 98 '#default_value' => $form_state->has('file') ? array($form_state->get('file')->id()) : NULL,
    87 99 '#required' => TRUE,
    88 '#description' => $this->t('Files must be less than <strong>%valid_size</strong><br> Allowed file types: <strong>%valid_extension</strong>', array('%valid_size' => format_size($validators['file_validate_size'][0]), '%valid_extension' => $validators['file_validate_extensions'][0])),
    100 '#description' => $this->getStringTranslation()->translate('Files must be less than <strong>%valid_size</strong><br> Allowed file types: <strong>%valid_extension</strong>', array('%valid_size' => format_size($validators['file_validate_size'][0]), '%valid_extension' => $validators['file_validate_extensions'][0])),
    89 101 '#upload_validators' => $validators,
    90 102 );
    91 103
    92 104 $form['pattern'] = array(
    93 105 '#type' => 'textfield',
    94 '#title' => $this->t('Pattern'),
    95 '#description' => $this->t('Only files matching this pattern will be imported. For example, to import all jpg and gif files, the pattern would be <strong>.*jpg|.*gif</strong>. Use <strong>.*</strong> to extract all files in the archive.'),
    106 '#title' => $this->getStringTranslation()->translate('Pattern'),
    107 '#description' => $this->getStringTranslation()->translate('Only files matching this pattern will be imported. For example, to import all jpg and gif files, the pattern would be <strong>.*jpg|.*gif</strong>. Use <strong>.*</strong> to extract all files in the archive.'),
  • 91 103
    92 104 $form['pattern'] = array(
    93 105 '#type' => 'textfield',
    94 '#title' => $this->t('Pattern'),
    95 '#description' => $this->t('Only files matching this pattern will be imported. For example, to import all jpg and gif files, the pattern would be <strong>.*jpg|.*gif</strong>. Use <strong>.*</strong> to extract all files in the archive.'),
    106 '#title' => $this->getStringTranslation()->translate('Pattern'),
    107 '#description' => $this->getStringTranslation()->translate('Only files matching this pattern will be imported. For example, to import all jpg and gif files, the pattern would be <strong>.*jpg|.*gif</strong>. Use <strong>.*</strong> to extract all files in the archive.'),
    96 108 '#default_value' => '.*',
    97 109 '#required' => TRUE,
    98 110 );
    99 111
    100 112 $form['remove_archive'] = array(
    101 113 '#type' => 'checkbox',
    102 '#title' => $this->t('Remove archive'),
    103 '#description' => $this->t('Removes archive after extraction.'),
    114 '#title' => $this->getStringTranslation()->translate('Remove archive'),
  • 92 104 $form['pattern'] = array(
    93 105 '#type' => 'textfield',
    94 '#title' => $this->t('Pattern'),
    95 '#description' => $this->t('Only files matching this pattern will be imported. For example, to import all jpg and gif files, the pattern would be <strong>.*jpg|.*gif</strong>. Use <strong>.*</strong> to extract all files in the archive.'),
    106 '#title' => $this->getStringTranslation()->translate('Pattern'),
    107 '#description' => $this->getStringTranslation()->translate('Only files matching this pattern will be imported. For example, to import all jpg and gif files, the pattern would be <strong>.*jpg|.*gif</strong>. Use <strong>.*</strong> to extract all files in the archive.'),
    96 108 '#default_value' => '.*',
    97 109 '#required' => TRUE,
    98 110 );
    99 111
    100 112 $form['remove_archive'] = array(
    101 113 '#type' => 'checkbox',
    102 '#title' => $this->t('Remove archive'),
    103 '#description' => $this->t('Removes archive after extraction.'),
    114 '#title' => $this->getStringTranslation()->translate('Remove archive'),
    115 '#description' => $this->getStringTranslation()->translate('Removes archive after extraction.'),
  • 22 23 class FileEditForm extends ContentEntityForm {
    23 24
    24 25 use UploadValidatorsTrait;
    26 use StringTranslationTrait;
    25 27
    28 /**
    29 * Class constructor.
    30 *
    31 * @param \Drupal\Core\StringTranslation\TranslationInterface $translation
    32 * The translation service.
    33 */
  • 27 28 */
    28 29 class FileImageFormatter extends ImageFormatter {
    29 30
    31 use StringTranslationTrait;
    32
    33 /**
    34 * Class constructor.
    35 *
    36 * @param \Drupal\Core\StringTranslation\TranslationInterface $translation
    37 * The translation service.
    38 */
    39 public function __construct(TranslationInterface $translation) {
    40 $this->setStringTranslation($translation);
  • 29 30 */
    30 31 class FileDownloadLinkFormatter extends FileFormatterBase implements ContainerFactoryPluginInterface {
    31 32
    33 use StringTranslationTrait;
    34
    35 /**
    36 * Class constructor.
    37 *
    38 * @param \Drupal\Core\StringTranslation\TranslationInterface $translation
    39 * The translation service.
    40 */
    41 public function __construct(TranslationInterface $translation) {
    42 $this->setStringTranslation($translation);
    43 }
  • 14 15 */
    15 16 class FileTypeForm extends EntityForm {
    16 17
    18 use StringTranslationTrait;
    19
    20 /**
    21 * Class constructor.
    22 *
    23 * @param \Drupal\Core\StringTranslation\TranslationInterface $translation
    24 * The translation service.
    25 */
    26 public function __construct(TranslationInterface $translation) {
    27 $this->setStringTranslation($translation);
    28 }
  • 20 21 */
    21 22 class FileEditableWidget extends FileWidget {
    22 23
    24 use StringTranslationTrait;
    25
    26 /**
    27 * Class constructor.
    28 *
    29 * @param \Drupal\Core\StringTranslation\TranslationInterface $translation
    30 * The translation service.
    31 */
    32 public function __construct(TranslationInterface $translation) {
    33 $this->setStringTranslation($translation);
    34 }
  • 16 17 */
    17 18 class FileEntityAdminTest extends FileEntityTestBase {
    18 19
    20 use StringTranslationTrait;
    21
    22 /**
    23 * Class constructor.
    24 *
    25 * @param \Drupal\Core\StringTranslation\TranslationInterface $translation
    26 * The translation service.
    27 */
    28 public function __construct(TranslationInterface $translation) {
    29 $this->setStringTranslation($translation);
    30 }
  • 16 17 */
    17 18 class FileEntityCreationTest extends FileEntityTestBase {
    18 19
    20 use StringTranslationTrait;
    21
    22 /**
    23 * Class constructor.
    24 *
    25 * @param \Drupal\Core\StringTranslation\TranslationInterface $translation
    26 * The translation service.
    27 */
    28 public function __construct(TranslationInterface $translation) {
    29 $this->setStringTranslation($translation);
    30 }
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading