You are here

function entity_translation_unified_form_set_bundle_enabled in Entity Translation Unified Form 8

Sets the configuration for a given bundle.

1 call to entity_translation_unified_form_set_bundle_enabled()
entity_translation_unified_form_form_node_type_form_submit in ./entity_translation_unified_form.module
Submit handler. Sets content type-specific variable that is used to determine whether or not the content type may used unified forms.

File

./entity_translation_unified_form.module, line 170

Code

function entity_translation_unified_form_set_bundle_enabled($entity_type_id, $bundle, $enabled) {

  /** @var \Drupal\content_translation\ContentTranslationManagerInterface $content_translation_manager */
  $content_translation_manager = \Drupal::service('content_translation.manager');
  if ($content_translation_manager instanceof BundleTranslationSettingsInterface) {
    $settings = $content_translation_manager
      ->getBundleTranslationSettings($entity_type_id, $bundle);
    $settings['entity_translation_unified_form_enable'] = $enabled;
    $content_translation_manager
      ->setBundleTranslationSettings($entity_type_id, $bundle, $settings);
  }
}