You are here

function opigno_messaging_update_8008 in Opigno messaging 8

Update private messages block all.

File

./opigno_messaging.install, line 103
Install, update and uninstall functions for the Opigno Messaging module.

Code

function opigno_messaging_update_8008() {
  try {
    $block = Block::load('views_block__private_message_block_all');
    $visibility = $block
      ->getVisibility();
    $visibility['request_path']['pages'] = "/private-messages\r\n/private-messages/*\r\n/private-message/*";
    $block
      ->setVisibilityConfig('request_path', $visibility['request_path']);
    $block
      ->save();
  } catch (\Exception $e) {
    \Drupal::logger('opigno_messaging')
      ->error($e
      ->getMessage());
    \Drupal::messenger()
      ->addMessage($e
      ->getMessage(), 'error');
  }
}