How to add field to Paragraph types programmatically in D8

I have one paragraph type of Product. and I have to add one field to paragraph product programmatically, how can I achive this. function my_module_field_widget_paragraphs_form_alter(&$element, FormStateInterface &$form_state, $context){ if ($element[‘#paragraph_type’] == ‘products’) { \Drupal::logger(‘my_module’)->info(‘debug’); <!– add field here –> } } and other answer I found is use Drupal\paragraphs\Entity\Paragraph; $paragraph = Paragraph::load($paragraph_id); $paragraph->field_image[] = […

Trusted host patterns not being recognized in custom settings.php file in gitalb CI pipeline

I have created a custom settings.gitlabci.php file for setting trusted host patterns in a gitlab pipeline environment. See code below. <?php // @codingStandardsIgnoreFile if (getenv(‘GITLAB’) === ‘ON’) { $databases[‘default’][‘default’] = [ ‘driver’ => ‘mysql’, ‘database’ => ‘sssss’, ‘username’ => ‘rrrr’, ‘password’ => ‘xxxxx’, ‘host’ => ‘mysql’ ]; /** * Fix for Hash salt error on…

Webform how to set a value with hook_form_alter and also sent that value with the email handler?

I have a Webform with an Advanced HTML/Text element whose value I am setting via hook_form_alter(), however, this value that is set is not included in the email notification. I’ve tried this with various elements and also tried setting it via hook_webform_element_alter() and hook_webform_submission_presave() but no matter what I try the value set is not…