You are here

function pwa_block_view in Progressive Web App 7.2

Implements hook_block_view().

1 call to pwa_block_view()
pwa_preprocess_html in ./pwa.module
Implements hook_preprocess_html().

File

./pwa.module, line 649

Code

function pwa_block_view($delta = '') {
  $block = [];
  if ($delta === 'pwa_register') {

    // There is no content, only attach libraries and settings.
    $block['content'] = [
      // Never install serviceworker for uid 1.
      '#access' => _pwa_access_check(),
      '#attached' => [
        'library' => [
          [
            'pwa',
            'register',
          ],
        ],
        'js' => [
          [
            'data' => [
              'pwa' => [
                'path' => url('pwa/serviceworker/js'),
              ],
            ],
            'type' => 'setting',
          ],
        ],
      ],
    ];
  }
  return $block;
}