hasAnyRequired example

$form['third_party_settings'] = [
      '#tree' => TRUE,
      '#weight' => 11,
    ];

    // Create a new instance of typed data for the field to ensure that default     // value widget is always rendered from a clean state.     $items = $this->getTypedData($form['#entity']);

    // Add handling for default value.     if ($element = $items->defaultValuesForm($form$form_state)) {
      $has_required = $this->hasAnyRequired($element);

      $element = array_merge($element[
        '#type' => 'details',
        '#title' => $this->t('Default value'),
        '#open' => TRUE,
        '#tree' => TRUE,
        '#description' => $this->t('The default value for this field, used when creating new content.'),
        '#weight' => 12,
      ]);

      if (!$has_required) {
        
Home | Imprint | This part of the site doesn't use cookies.