You are here

function entity_translation_unified_form_form_node_type_form_process in Entity Translation Unified Form 8

Same name and namespace in other branches
  1. 7 entity_translation_unified_form.module \entity_translation_unified_form_form_node_type_form_process()

Add an "enable" checkbox to the node type's multilingual settings.

1 string reference to 'entity_translation_unified_form_form_node_type_form_process'
entity_translation_unified_form_form_node_type_form_alter in ./entity_translation_unified_form.module
Implements hook_form_FORM_ID_alter().

File

./entity_translation_unified_form.module, line 109

Code

function entity_translation_unified_form_form_node_type_form_process(&$form, $form_state) {
  $entity_type_id = 'node';
  $bundle = $form['type']['#default_value'];

  // Hide settings when entity translation is disabled for this content type.
  $states = [
    'visible' => [
      ':input[name="language_content_type"]' => [
        'value' => ENTITY_TRANSLATION_ENABLED,
      ],
    ],
  ];
  $form['workflow']['entity_translation_unified_form'] = [
    '#title' => t('Unified form'),
    '#type' => 'fieldset',
    '#weight' => 10,
    '#states' => $states,
  ];
  $form['workflow']['entity_translation_unified_form']['entity_translation_unified_form_enable'] = [
    '#title' => t('Place all content-translatable fields for all enabled languages inline on the node add/edit form'),
    '#type' => 'checkbox',
    '#default_value' => $form["#id"] === 'node-type-add-form' ? 0 : entity_translation_unified_form_bundle_enabled($entity_type_id, $bundle),
    '#disabled' => FALSE,
    '#states' => $states,
  ];
  $form['workflow']['entity_translation_unified_form']['entity_translation_unified_form_sbs_enable'] = [
    '#title' => t('Enable side-by-side UI mode on the node add/edit form'),
    '#type' => 'checkbox',
    '#default_value' => $form["#id"] === 'node-type-add-form' ? 0 : entity_translation_unified_form_sbs_enabled($entity_type_id, $bundle),
    '#disabled' => FALSE,
    '#states' => $states,
  ];
  $form['workflow']['entity_translation_unified_form']['entity_translation_unified_form_moderation_sync_disable'] = [
    '#title' => t('Disable moderation sync mode on the node add/edit form'),
    '#type' => 'checkbox',
    '#default_value' => $form["#id"] === 'node-type-add-form' ? 0 : entity_translation_unified_form_moderation_sync_disabled($entity_type_id, $bundle),
    '#disabled' => FALSE,
    '#states' => $states,
  ];
  return $form;
}