You are here

function paragraphs_previewer_page_alter in Paragraphs Previewer 7

Implements hook_page_alter().

File

./paragraphs_previewer.module, line 81
Provides a rendered preview of a paragraphs item on an entity form..

Code

function paragraphs_previewer_page_alter(&$page) {
  if (strpos($_GET['q'], 'paragraphs-previewer/') === 0) {
    $page['#theme'] = 'paragraphs_previewer_page';

    // Disable administration modules from adding output to the popup.
    // @see http://drupal.org/node/914786
    module_invoke_all('suppress', TRUE);
    foreach (element_children($page) as $key) {
      if ($key != 'content') {
        unset($page[$key]);
      }
      else {
        foreach (element_children($page[$key]) as $child_key) {
          if ($child_key != 'system_main') {
            unset($page[$key][$child_key]);
          }
        }
      }
    }
  }
}