drupal paragraphs form alter to make field required code example
Example: alter paragraph form drupal 8
/**
* Implements hook_field_widget_WIDGET_TYPE_form_alter().
*/
function paragraphs_test_field_widget_entity_reference_paragraphs_form_alter(&$element, &$form_state, $context) {
if ($element['#paragraph_type'] == 'altered_paragraph') {
$element['subform']['field_text']['widget'][0]['#title'] = 'Altered title';
}
}