protected function ParagraphsCoreVersionUiTestTrait::paragraphsPostNodeForm in Paragraphs 8
An adapter for 8.3 > 8.4 Save (and (un)publish) node button change.
Arguments are the same as WebTestBase::drupalPostForm.
Parameters
\Drupal\Core\Url|string $path: Location of the post form.
array $edit: Field data in an associative array.
mixed $submit: Value of the submit button whose click is to be emulated. For example,
array $options: (optional) Options to be forwarded to the url generator.
array $headers: (optional) An array containing additional HTTP request headers.
string $form_html_id: (optional) HTML ID of the form to be submitted.
string $extra_post: (optional) A string of additional data to append to the POST submission.
See also
\Drupal\simpletest\WebTestBase::drupalPostForm
https://www.drupal.org/node/2847274
File
- tests/
src/ Traits/ ParagraphsCoreVersionUiTestTrait.php, line 33
Class
- ParagraphsCoreVersionUiTestTrait
- Provides helper methods for Drupal 8.3.x and 8.4.x versions.
Namespace
Drupal\Tests\paragraphs\TraitsCode
protected function paragraphsPostNodeForm($path, $edit, $submit, array $options = [], array $headers = [], $form_html_id = NULL, $extra_post = NULL) {
$drupal_version = (double) substr(\Drupal::VERSION, 0, 3);
if ($drupal_version > 8.300000000000001) {
switch ($submit) {
case t('Save and unpublish'):
$submit = 'Save';
$edit['status[value]'] = FALSE;
break;
case 'Save and publish':
$submit = 'Save';
$edit['status[value]'] = TRUE;
break;
case 'Save and keep published (this translation)':
$submit = 'Save (this translation)';
break;
default:
$submit = 'Save';
}
}
parent::drupalPostForm($path, $edit, $submit, $options, $headers, $form_html_id, $extra_post);
}