Commit 4282db64 authored by Berdir's avatar Berdir

Issue #3124446 by mrinalini9, pratik_kamble, naresh_bavaskar, mohrerao, Neslee...

Issue #3124446 by mrinalini9, pratik_kamble, naresh_bavaskar, mohrerao, Neslee Canil Pinto, Sahana _N, shaktik, nikitagupta, Berdir, jungle: t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
parent 60e1e378
......@@ -83,7 +83,7 @@ class ParagraphsDemoTest extends BrowserTestBase {
$this->drupalGet('admin/structure/types/manage/paragraphed_content_demo/form-display');
$this->drupalPostForm(NULL, [], "field_paragraphs_demo_settings_edit");
$edit = ['fields[field_paragraphs_demo][settings_edit_form][settings][edit_mode]' => 'open'];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
// Check for all pre-configured paragraphs_types.
$this->drupalGet('admin/structure/paragraphs_type');
......@@ -144,7 +144,7 @@ class ParagraphsDemoTest extends BrowserTestBase {
$this->drupalGet('node/add/paragraphed_content_demo');
$this->assertSession()->responseContains('<h4 class="label">Paragraphs</h4>');
$this->drupalPostForm(NULL, NULL, t('Add Text'));
$this->drupalPostForm(NULL, NULL, 'Add Text');
$this->assertSession()->responseNotContains('<strong data-drupal-selector="edit-field-paragraphs-demo-title">Paragraphs</strong>');
$this->assertSession()->responseContains('<h4 class="label">Paragraphs</h4>');
$edit = array(
......@@ -152,11 +152,11 @@ class ParagraphsDemoTest extends BrowserTestBase {
'moderation_state[0][state]' => 'published',
'field_paragraphs_demo[0][subform][field_text_demo][0][value]' => 'Paragraph text',
);
$this->drupalPostForm(NULL, $edit, t('Add User'));
$this->drupalPostForm(NULL, $edit, 'Add User');
$edit = [
'field_paragraphs_demo[1][subform][field_user_demo][0][target_id]' => $admin_user->label() . ' (' . $admin_user->id() . ')',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$this->assertSession()->pageTextContains('Paragraphed article Paragraph title has been created.');
$this->assertSession()->pageTextContains('Paragraph title');
......
......@@ -50,10 +50,10 @@ class LibraryItemForm extends ContentEntityForm {
parent::save($form, $form_state);
$form_state->setRedirect('entity.paragraphs_library_item.collection');
if ($insert) {
$this->messenger->addMessage(t('Paragraph %label has been created.', ['%label' => $this->entity->label()]));
$this->messenger->addMessage($this->t('Paragraph %label has been created.', ['%label' => $this->entity->label()]));
}
else {
$this->messenger->addMessage(t('Paragraph %label has been updated.', ['%label' => $this->entity->label()]));
$this->messenger->addMessage($this->t('Paragraph %label has been updated.', ['%label' => $this->entity->label()]));
}
}
......
......@@ -102,7 +102,7 @@ class LibraryItemRevisionRevertForm extends ConfirmFormBase {
public function submitForm(array &$form, FormStateInterface $form_state) {
$original_revision_timestamp = $this->revision->getChangedTime();
$this->revision = $this->prepareRevertedRevision($this->revision);
$this->revision->revision_log = t('Copy of the revision from %date.', [
$this->revision->revision_log = $this->t('Copy of the revision from %date.', [
'%date' => $this->dateFormatter->format($original_revision_timestamp)
]);
$this->revision->setChangedTime($this->time->getRequestTime());
......
......@@ -30,7 +30,7 @@ class LibraryItemSettingsForm extends ConfigFormBase {
public function buildForm(array $form, FormStateInterface $form_state) {
// This exists to make the field UI pages visible and must not be removed.
$form['account'] = array(
'#markup' => '<p>' . t('There are no settings yet.') . '</p>',
'#markup' => '<p>' . $this->t('There are no settings yet.') . '</p>',
);
return $form;
......
......@@ -92,7 +92,7 @@ class ParagraphsLibraryItemTranslationTest extends BrowserTestBase {
'settings[paragraphs_library_item][paragraphs_library_item][translatable]' => TRUE,
'settings[node][paragraphed_test][settings][language][language_alterable]' => TRUE
];
$this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
$this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration');
$assert_session = $this->assertSession();
$page = $this->getSession()->getPage();
......
......@@ -52,7 +52,7 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
'label[0][value]' => 're usable paragraph label',
'paragraphs[0][subform][field_text][0][value]' => 're_usable_text',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$this->clickLink('re usable paragraph label');
$this->assertSession()->responseContains('bartik/css/base/elements.css');
$this->clickLink('Edit');
......@@ -220,7 +220,7 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
$edit = [
'paragraphs[0][subform][field_text][0][value]' => 're_usable_text_new',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
// Check in both nodes that the text is updated. Test as anonymous user, so
// that the cache is populated.
......@@ -239,7 +239,7 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
$edit = [
'status[value]' => FALSE,
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$this->drupalGet('node/' . $node_one->id());
$this->assertSession()->pageTextContains('re_usable_text_new');
......@@ -254,7 +254,7 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
$edit = [
'status[value]' => TRUE,
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$this->drupalGet('node/' . $node_one->id());
$this->assertSession()->pageTextContains('re_usable_text_new');
......@@ -290,7 +290,7 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
$this->assertSession()->linkExists('Manage display');
// Assert that users can create fields to
$this->clickLink('Manage fields');
$this->clickLink(t('Add field'));
$this->clickLink('Add field');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextNotContains('plugin does not exist');
$this->drupalGet('admin/config/content');
......@@ -320,7 +320,7 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
'label[0][value]' => 'reusable paragraph label',
'paragraphs[0][subform][field_text][0][value]' => 'reusable_text',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$this->assertSession()->pageTextContains('Paragraph reusable paragraph label has been created.');
// Add created library item to a node.
......@@ -462,14 +462,14 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
$edit = [
'fields[field_paragraphs][type]' => 'paragraphs',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$this->drupalPostForm('admin/content/paragraphs/add/default', [], 'paragraphs_nested_test_add_more');
$this->drupalPostForm(NULL, [], 'paragraphs_0_subform_field_paragraphs_text_add_more');
$edit = [
'label[0][value]' => 'Test nested',
'paragraphs[0][subform][field_paragraphs][0][subform][field_text][0][value]' => 'test text paragraph',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$this->assertSession()->pageTextContains('test text paragraph');
// Assert that the user with the access content permission can see the
......@@ -504,12 +504,12 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
$this->clickLink('Add library item');
// Check the label validation.
$this->drupalPostForm(NULL, [], t('Save'));
$this->drupalPostForm(NULL, [], 'Save');
$this->assertSession()->pageTextContains('Label field is required.');
$edit = [
'label[0][value]' => 're usable paragraph label',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
// Check the paragraph validation.
$this->assertSession()->pageTextContains('Paragraphs field is required.');
......@@ -517,13 +517,13 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
$edit['paragraphs[0][subform][field_text][0][value]'] = 're_usable_text';
// Check that the library item is created.
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$this->assertSession()->pageTextContains('Paragraph re usable paragraph label has been created.');
$this->clickLink('Edit');
$edit = [
'paragraphs[0][subform][field_text][0][value]' => 'new text',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$this->assertSession()->pageTextContains('Paragraph re usable paragraph label has been updated.');
}
......@@ -548,7 +548,7 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
'label[0][value]' => 'reusable paragraph label',
'paragraphs[0][subform][field_text][0][value]' => 'reusable_text',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$this->assertSession()->pageTextContains('Paragraph reusable paragraph label has been created.');
// Create a node with a "From library" paragraph referencing the library
......@@ -559,7 +559,7 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
'title[0][value]' => 'library_test',
'field_paragraphs[0][subform][field_reusable_paragraph][0][target_id]' => 'reusable paragraph label',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$this->assertSession()->pageTextContains('paragraphed_test library_test has been created.');
// Disallow the paragraphs type "Text" for the used content type.
......@@ -569,13 +569,13 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
'settings[handler_settings][target_bundles_drag_drop][from_library][enabled]' => 1,
'settings[handler_settings][target_bundles_drag_drop][text][enabled]' => FALSE,
];
$this->drupalPostForm(NULL, $edit, t('Save settings'));
$this->drupalPostForm(NULL, $edit, 'Save settings');
$this->assertSession()->pageTextContains('Saved field_paragraphs configuration.');
// Check that the node now fails validation.
$node = $this->getNodeByTitle('library_test');
$this->drupalGet('node/' . $node->id() . '/edit');
$this->drupalPostForm(NULL, [], t('Save'));
$this->drupalPostForm(NULL, [], 'Save');
$this->assertSession()->addressEquals('node/' . $node->id() . '/edit');
$this->assertSession()->pageTextContains('The Reusable paragraph field cannot contain a text paragraph, because the parent field_paragraphs field disallows it.');
}
......@@ -642,14 +642,9 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
// Test reverting revision.
$this->clickLink('Revert');
$this->assertSession()->responseContains(t('Are you sure you want to revert revision from %revision-date?', [
'%revision-date' => $date_formatter->format($revision->getChangedTime())
]));
$this->assertSession()->responseContains('Are you sure you want to revert revision from ' . $date_formatter->format($revision->getChangedTime()) . '?');
$this->drupalPostForm(NULL, NULL, 'Revert');
$this->assertSession()->responseContains(t('%title has been reverted to the revision from %revision-date.', [
'%title' => 'Test revisions nested original',
'%revision-date' => $date_formatter->format($revision->getChangedTime())
]));
$this->assertSession()->pageTextContains('Test revisions nested original has been reverted to the revision from ' . $date_formatter->format($revision->getChangedTime()) . '.');
// Check current revision.
$current_revision = $storage->loadRevision(3);
......@@ -660,13 +655,9 @@ class ParagraphsLibraryTest extends ParagraphsTestBase {
// Test deleting revision.
$revision_for_deleting = $storage->loadRevision(2);
$this->clickLink('Delete');
$this->assertSession()->responseContains(t('Are you sure you want to delete revision from %revision-date', [
'%revision-date' => $date_formatter->format($revision_for_deleting->getChangedTime())
]));
$this->assertSession()->responseContains('Are you sure you want to delete revision from ' . $date_formatter->format($revision_for_deleting->getChangedTime()));
$this->drupalPostForm(NULL, NULL, 'Delete');
$this->assertSession()->responseContains(t('Revision from %revision-date has been deleted.', [
'%revision-date' => $date_formatter->format($revision_for_deleting->getChangedTime())
]));
$this->assertSession()->pageTextContains('Revision from ' . $date_formatter->format($revision_for_deleting->getChangedTime()) .' has been deleted.');
}
}
......@@ -65,7 +65,7 @@ class ParagraphsLibraryItemEntityBrowserTest extends EntityBrowserWebDriverTestB
'entity_types[paragraphs_library_item]' => TRUE,
'settings[paragraphs_library_item][paragraphs_library_item][translatable]' => TRUE,
];
$this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
$this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration');
$this->addParagraphsType('text');
$this->addFieldtoParagraphType('text', 'field_text', 'text');
......@@ -105,7 +105,7 @@ JS;
// processing in the iframe.
sleep(1);
$this->waitForAjaxToFinish();
$this->drupalPostForm(NULL, [], t('Save'));
$this->drupalPostForm(NULL, [], 'Save');
// Check that the paragraph was correctly reused.
$this->assertSession()->pageTextContains('reusable_text');
......
......@@ -83,7 +83,7 @@ class ParagraphsTypePermissionsTest extends BrowserTestBase {
'settings[paragraph][text_image][fields][field_text_demo]' => TRUE,
'settings[node][paragraphed_content_demo][settings][language][language_alterable]' => TRUE
];
$this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
$this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration');
$display_options = [
'type' => 'image',
......@@ -141,24 +141,24 @@ class ParagraphsTypePermissionsTest extends BrowserTestBase {
// Create a node with some Paragraph types.
$this->drupalGet('node/add/paragraphed_content_demo');
$this->drupalPostForm(NULL, NULL, t('Add text_image'));
$this->drupalPostForm(NULL, NULL, t('Add images'));
$this->drupalPostForm(NULL, NULL, t('Add text'));
$this->drupalPostForm(NULL, NULL, 'Add text_image');
$this->drupalPostForm(NULL, NULL, 'Add images');
$this->drupalPostForm(NULL, NULL, 'Add text');
$image_text = $this->getTestFiles('image')[0];
$this->drupalPostForm(NULL, [
'files[field_paragraphs_demo_0_subform_field_image_demo_0]' => $image_text->uri,
], t('Upload'));
], 'Upload');
$images = $this->getTestFiles('image')[1];
$this->drupalPostForm(NULL, [
'files[field_paragraphs_demo_1_subform_field_images_demo_0][]' => $images->uri,
], t('Upload'));
], 'Upload');
$edit = [
'title[0][value]' => 'paragraph node title',
'field_paragraphs_demo[0][subform][field_text_demo][0][value]' => 'Paragraph type Image + Text',
'field_paragraphs_demo[2][subform][field_text_demo][0][value]' => 'Paragraph type Text',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
// Get the node to edit it later.
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
......@@ -197,7 +197,7 @@ class ParagraphsTypePermissionsTest extends BrowserTestBase {
$this->drupalGet('admin/structure/types/manage/paragraphed_content_demo/form-display');
$this->drupalPostForm(NULL, [], "field_paragraphs_demo_settings_edit");
$edit = ['fields[field_paragraphs_demo][settings_edit_form][settings][edit_mode]' => 'open'];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
// Unpublish the 'Image + Text' paragraph type.
$this->drupalGet('node/' . $node->id() . '/edit');
......@@ -205,7 +205,7 @@ class ParagraphsTypePermissionsTest extends BrowserTestBase {
$edit = [
'field_paragraphs_demo[0][subform][status][value]' => FALSE,
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
// Check that 'Image + Text' paragraph is not shown anymore for admin user.
$this->assertSession()->responseNotContains($image_text_tag);
......
......@@ -14,6 +14,7 @@ use Drupal\Core\Field\ChangedFieldItemList;
use Drupal\Core\Field\EntityReferenceFieldItemListInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
use Drupal\Core\Render\Markup;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\TypedData\TranslatableInterface;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\entity_reference_revisions\EntityNeedsSaveTrait;
......@@ -100,6 +101,7 @@ class Paragraph extends ContentEntityBase implements ParagraphInterface {
use EntityNeedsSaveTrait;
use EntityPublishedTrait;
use StringTranslationTrait;
/**
* The behavior plugin data for the paragraph entity.
......@@ -164,7 +166,7 @@ class Paragraph extends ContentEntityBase implements ParagraphInterface {
}
}
else {
$label = t('Orphaned @type: @summary', ['@summary' => Unicode::truncate(strip_tags($this->getSummary()), 50, FALSE, TRUE), '@type' => $this->get('type')->entity->label()]);
$label = $this->t('Orphaned @type: @summary', ['@summary' => Unicode::truncate(strip_tags($this->getSummary()), 50, FALSE, TRUE), '@type' => $this->get('type')->entity->label()]);
}
return $label;
}
......
......@@ -69,7 +69,7 @@ class ParagraphsTypeForm extends EntityForm {
$paragraphs_type = $this->entity;
if (!$paragraphs_type->isNew()) {
$form['#title'] = (t('Edit %title paragraph type', [
$form['#title'] = ($this->t('Edit %title paragraph type', [
'%title' => $paragraphs_type->label(),
]));
}
......@@ -107,10 +107,10 @@ class ParagraphsTypeForm extends EntityForm {
}
$form['description'] = [
'#title' => t('Description'),
'#title' => $this->t('Description'),
'#type' => 'textarea',
'#default_value' => $paragraphs_type->getDescription(),
'#description' => t('This text will be displayed on the <em>Add new paragraph</em> page.'),
'#description' => $this->t('This text will be displayed on the <em>Add new paragraph</em> page.'),
];
// Loop over the plugins that can be applied to this paragraph type.
......
......@@ -1291,7 +1291,7 @@ class InlineParagraphsWidget extends WidgetBase {
$non_remove_mode_item_count = $widget_state['real_item_count'] - $remove_mode_item_count;
if ($elements['#required'] && $non_remove_mode_item_count < 1) {
$form_state->setError($elements, t('@name field is required.', ['@name' => $this->fieldDefinition->getLabel()]));
$form_state->setError($elements, $this->t('@name field is required.', ['@name' => $this->fieldDefinition->getLabel()]));
}
static::setWidgetState($elements['#field_parents'], $field_name, $form_state, $widget_state);
......
......@@ -2208,7 +2208,7 @@ class ParagraphsWidget extends WidgetBase {
$widget_state = static::getWidgetState($elements['#field_parents'], $field_name, $form_state);
if ($elements['#required'] && $widget_state['real_item_count'] < 1) {
$form_state->setError($elements, t('@name field is required.', ['@name' => $this->fieldDefinition->getLabel()]));
$form_state->setError($elements, $this->t('@name field is required.', ['@name' => $this->fieldDefinition->getLabel()]));
}
static::setWidgetState($elements['#field_parents'], $field_name, $form_state, $widget_state);
......
......@@ -42,28 +42,28 @@ class ParagraphsUninstallTest extends BrowserTestBase {
public function testUninstall() {
// Uninstall the module paragraphs_demo.
$this->drupalPostForm('admin/modules/uninstall', ['uninstall[paragraphs_demo]' => TRUE], t('Uninstall'));
$this->drupalPostForm(NULL, [], t('Uninstall'));
$this->drupalPostForm('admin/modules/uninstall', ['uninstall[paragraphs_demo]' => TRUE], 'Uninstall');
$this->drupalPostForm(NULL, [], 'Uninstall');
// Delete library data.
$this->clickLink('Remove Paragraphs library items');
$this->drupalPostForm(NULL, [], t('Delete all Paragraphs library items'));
$this->drupalPostForm(NULL, [], 'Delete all Paragraphs library items');
// Uninstall the library module.
$this->drupalPostForm('admin/modules/uninstall', ['uninstall[paragraphs_library]' => TRUE], t('Uninstall'));
$this->drupalPostForm(NULL, [], t('Uninstall'));
$this->drupalPostForm('admin/modules/uninstall', ['uninstall[paragraphs_library]' => TRUE], 'Uninstall');
$this->drupalPostForm(NULL, [], 'Uninstall');
// Delete paragraphs data.
$this->clickLink('Remove Paragraphs');
$this->drupalPostForm(NULL, [], t('Delete all Paragraphs'));
$this->drupalPostForm(NULL, [], 'Delete all Paragraphs');
// Uninstall the module paragraphs.
$this->drupalPostForm('admin/modules/uninstall', ['uninstall[paragraphs]' => TRUE], t('Uninstall'));
$this->drupalPostForm(NULL, [], t('Uninstall'));
$this->assertSession()->pageTextContains(t('The selected modules have been uninstalled.'));
$this->assertSession()->pageTextNotContains(t('Paragraphs demo'));
$this->assertSession()->pageTextNotContains(t('Paragraphs library'));
$this->assertSession()->pageTextNotContains(t('Paragraphs'));
$this->drupalPostForm('admin/modules/uninstall', ['uninstall[paragraphs]' => TRUE], 'Uninstall');
$this->drupalPostForm(NULL, [], 'Uninstall');
$this->assertSession()->pageTextContains('The selected modules have been uninstalled.');
$this->assertSession()->pageTextNotContains('Paragraphs demo');
$this->assertSession()->pageTextNotContains('Paragraphs library');
$this->assertSession()->pageTextNotContains('Paragraphs');
}
}
......@@ -69,7 +69,7 @@ class ParagraphsWidgetButtonsTest extends ParagraphsTestBase {
'field_paragraphs[0][subform][field_text][0][value]' => 'Fist paragraph',
'field_paragraphs[1][subform][field_text][0][value]' => 'Second paragraph',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$node = $this->drupalGetNodeByTitle('Autocollapse test node');
// Set the settings to "Open" edit mode without autocollapse.
......
......@@ -70,7 +70,7 @@ class ParagraphsAccessTest extends ParagraphsTestBase {
'settings[paragraph][text_image][fields][field_text_demo]' => TRUE,
'settings[node][paragraphed_content_demo][settings][language][language_alterable]' => TRUE
];
$this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration'));
$this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration');
$view_display = \Drupal::service('entity_display.repository')->getViewDisplay('paragraph', 'images');
$view_display->setComponent('field_images_demo', ['settings' => ['image_style' => 'medium']]);
......@@ -103,7 +103,7 @@ class ParagraphsAccessTest extends ParagraphsTestBase {
$edit = array(
'settings[uri_scheme]' => 'private',
);
$this->drupalPostForm('admin/structure/paragraphs_type/images/fields/paragraph.images.field_images_demo/storage', $edit, t('Save field settings'));
$this->drupalPostForm('admin/structure/paragraphs_type/images/fields/paragraph.images.field_images_demo/storage', $edit, 'Save field settings');
// Set the form display to legacy.
$form_display = EntityFormDisplay::load('node.paragraphed_content_demo.default')
......@@ -114,7 +114,7 @@ class ParagraphsAccessTest extends ParagraphsTestBase {
$this->drupalGet('node/add/paragraphed_content_demo');
// Add a new paragraphs images item.
$this->drupalPostForm(NULL, NULL, t('Add images'));
$this->drupalPostForm(NULL, NULL, 'Add images');
$images = $this->getTestFiles('image');
......@@ -134,19 +134,19 @@ class ParagraphsAccessTest extends ParagraphsTestBase {
'files[field_paragraphs_demo_0_subform_field_images_demo_0][]' => $file_path,
);
$this->drupalPostForm(NULL, $edit, t('Upload'));
$this->drupalPostForm(NULL, $edit, 'Upload');
$edit = array(
'files[field_paragraphs_demo_0_subform_field_images_demo_1][]' => $file_path_2,
);
$this->drupalPostForm(NULL, $edit, t('Preview'));
$this->drupalPostForm(NULL, $edit, 'Preview');
$image_style = ImageStyle::load('medium');
$img1_url = $image_style->buildUrl('private://' . date('Y-m') . '/privateImage.jpg');
$image_url = file_url_transform_relative($img1_url);
$this->assertSession()->responseContains($image_url);
$this->clickLink(t('Back to content editing'));
$this->drupalPostForm(NULL, [], t('Save'));
$this->clickLink('Back to content editing');
$this->drupalPostForm(NULL, [], 'Save');
$node = $this->drupalGetNodeByTitle('Security test node');
......@@ -175,21 +175,21 @@ class ParagraphsAccessTest extends ParagraphsTestBase {
$this->loginAsAdmin($admin_user);
// Create a new demo node.
$this->drupalGet('node/add/paragraphed_content_demo');
$this->drupalPostForm(NULL, NULL, t('Add text'));
$this->drupalPostForm(NULL, NULL, 'Add text');
$this->assertSession()->pageTextContains('Text');
$edit = [
'title[0][value]' => 'delete_permissions',
'field_paragraphs_demo[0][subform][field_text_demo][0][value]' => 'Test',
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
// Edit the node.
$this->clickLink(t('Edit'));
$this->clickLink('Edit');
// Check the remove button is present.
$this->assertNotNull($this->xpath('//*[@name="field_paragraphs_demo_0_remove"]'));
// Delete the Paragraph and save.
$this->drupalPostForm(NULL, [], 'field_paragraphs_demo_0_remove');
$this->drupalPostForm(NULL, [], 'field_paragraphs_demo_0_confirm_remove');
$this->drupalPostForm(NULL, [], t('Save'));
$this->drupalPostForm(NULL, [], 'Save');
$node = $this->getNodeByTitle('delete_permissions');
$this->assertSession()->addressEquals('node/' . $node->id());
}
......
......@@ -20,11 +20,11 @@ class ParagraphsAddModesTest extends ParagraphsTestBase {
// Edit the field.
$this->drupalGet('admin/structure/types/manage/paragraphed_test/fields');
$this->clickLink(t('Edit'));
$this->clickLink('Edit');
// Check that the current field does not allow to add default values.
$this->assertSession()->pageTextContains('No widget available for: paragraphs_field.');
$this->drupalPostForm(NULL, [], t('Save settings'));
$this->drupalPostForm(NULL, [], 'Save settings');
$this->assertSession()->pageTextContains('Saved paragraphs_field configuration.');
$this->assertSession()->statusCodeEquals(200);
}
......@@ -38,8 +38,8 @@ class ParagraphsAddModesTest extends ParagraphsTestBase {
// Edit the field and save when there are no Paragraphs types available.
$this->drupalGet('admin/structure/types/manage/paragraphed_test/fields');
$this->clickLink(t('Edit'));
$this->drupalPostForm(NULL, [], t('Save settings'));
$this->clickLink('Edit');
$this->drupalPostForm(NULL, [], 'Save settings');
$this->assertSession()->pageTextContains('Saved paragraphs configuration.');
}
......@@ -187,7 +187,7 @@ class ParagraphsAddModesTest extends ParagraphsTestBase {
$this->setDefaultParagraphType('paragraphed_test', 'paragraphs', 'paragraphs_settings_edit', 'text_image');
$this->removeDefaultParagraphType('paragraphed_test');
$edit = ['title[0][value]' => 'New Host'];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$this->drupalGet('node/1/edit');
$this->assertSession()->pageTextContains('No Paragraph added yet.');
}
......
......@@ -57,8 +57,8 @@ class ParagraphsAdministrationTest extends ParagraphsTestBase {
));
// Configure article fields.
$this->drupalGet('admin/structure/types/manage/paragraphs/fields');
$this->clickLink(t('Manage form display'));
$this->drupalPostForm(NULL, array('fields[field_paragraphs][type]' => 'entity_reference_paragraphs'), t('Save'));
$this->clickLink('Manage form display');
$this->drupalPostForm(NULL, array('fields[field_paragraphs][type]' => 'entity_reference_paragraphs'), 'Save');
// Create node with our paragraphs.
$this->drupalGet('node/add/paragraphs');
......@@ -70,7 +70,7 @@ class ParagraphsAdministrationTest extends ParagraphsTestBase {
'field_paragraphs[1][subform][field_text][0][value]' => 'Test text 2',
'status[value]' => TRUE,
];
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->drupalPostForm(NULL, $edit, 'Save');
$node = $this->drupalGetNodeByTitle('TEST TITEL');
$paragraph1 = $node->field_paragraphs[0]->target_id;
......@@ -84,7 +84,7 @@ class ParagraphsAdministrationTest extends ParagraphsTestBase {
'field_paragraphs[0][subform][field_text][0][value]' => 'Foo Bar 1',
'revision' => FALSE,
];
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save');
$this->countRevisions($node, $paragraph1, $paragraph2, 1);
......@@ -95,7 +95,7 @@ class ParagraphsAdministrationTest extends ParagraphsTestBase {