You are here

function opigno_lms_update_8003 in Opigno LMS 8.2

Implements hook_update_N().

Update Opigno LP Steps block visibility configuration.

File

./opigno_lms.install, line 143
Install, update and uninstall functions for the "opigno_lms" installation profile.

Code

function opigno_lms_update_8003() {
  $config_factory = \Drupal::configFactory();
  $config = $config_factory
    ->getEditable('block.block.lp_steps_block');
  $visibility = $config
    ->get('visibility');

  // Change visibility settings only if admins didn't change them.
  if (isset($visibility['request_path']['pages']) && $visibility['request_path']['pages'] == "/module/*\r\n/group/*/module/*") {
    $visibility['request_path']['pages'] = "/module/*/result*\r\n/group/*/module/*";
    $config
      ->set('visibility', $visibility);
    $config
      ->save(TRUE);
  }
}