You are here

function simple_responsive_table_page_attachments in Simple Responsive Table 8

Implements hook_page_attachments().

File

./simple_responsive_table.module, line 29
Contains simple_responsive_table.module..

Code

function simple_responsive_table_page_attachments(array &$page) {
  $is_admin = \Drupal::service('router.admin_context')
    ->isAdminRoute();
  $config = \Drupal::config('simple_responsive_table.settings')
    ->get();
  if (!$is_admin || $config['enable_admin_page']) {
    $page['#attached']['library'][] = 'simple_responsive_table/global-styling';
    $page['#attached']['drupalSettings']['simpleResponsiveTable'] = [
      'maxWidth' => $config['max_width'],
      'modulePath' => drupal_get_path('module', 'simple_responsive_table'),
    ];
  }
}