You are here

function _form_mode_manager_exclude_commerce_form_mode in Form mode manager 8

Same name and namespace in other branches
  1. 8.2 form_mode_manager.install \_form_mode_manager_exclude_commerce_form_mode()

Exclude from form mode manager configuration the incompatible form modes.

Add_to_cart are provided by commerce 'order', and aren't compatible with form mode manager.

2 calls to _form_mode_manager_exclude_commerce_form_mode()
form_mode_manager_install in ./form_mode_manager.install
Implements hook_install().
form_mode_manager_update_8002 in ./form_mode_manager.install
Set "add_to_cart" Form Mode excluded from Form mode manager settings.

File

./form_mode_manager.install, line 47
Install, update and uninstall functions for the Form Mode Manager module.

Code

function _form_mode_manager_exclude_commerce_form_mode() {
  if (\Drupal::moduleHandler()
    ->moduleExists('order')) {
    \Drupal::configFactory()
      ->getEditable('form_mode_manager.settings')
      ->set("form_modes.commerce_order_item.to_exclude", [
      'add_to_cart' => 'add_to_cart',
    ])
      ->save(TRUE);
    \Drupal::entityTypeManager()
      ->clearCachedDefinitions();
  }
}