You are here

public static function Helpers::saveBlockSettings in Menu Multilingual 8

Save menu_multilingual block settings.

File

src/Helpers.php, line 32

Class

Helpers
Various functions to assist menu_multilingual block.

Namespace

Drupal\menu_multilingual

Code

public static function saveBlockSettings($entity_type, BlockInterface $block, &$form, FormStateInterface $form_state) {
  $settings = $form_state
    ->getValue([
    'settings',
    'multilingual',
  ]);
  $elements = $form['settings']['multilingual'];
  if ($elements['only_translated_labels']['#disabled']) {
    $settings['only_translated_labels'] = FALSE;
  }
  if ($elements['only_translated_content']['#disabled']) {
    $settings['only_translated_content'] = FALSE;
  }
  $block
    ->setThirdPartySetting('menu_multilingual', 'only_translated_labels', $settings['only_translated_labels']);
  $block
    ->setThirdPartySetting('menu_multilingual', 'only_translated_content', $settings['only_translated_content']);
}