You are here

function simplemeta_page_alter in Simple Meta 7

Same name and namespace in other branches
  1. 7.2 simplemeta.module \simplemeta_page_alter()

Implements hook_page_alter().

File

./simplemeta.module, line 86
SimpleMeta module.

Code

function simplemeta_page_alter(&$page) {
  global $language;
  if (variable_get('simplemeta_form_enable', TRUE) && user_access('administer simplemeta') && !path_is_admin(current_path())) {
    $path = $_GET['q'];
    $lang = $language->language;
    $meta = simplemeta_meta_load_by_path($path, $lang);

    // Try to load language-neutral
    if (!$meta) {
      $meta = simplemeta_meta_load_by_path($path);
    }
    if (!$meta) {
      $meta = new stdClass();
      $meta->path = $path;
      $meta->data = array();
      $meta->language = '';
    }
    $form = drupal_get_form('simplemeta_page_meta_form', $meta);
    $page['page_bottom']['simplemeta'] = array(
      '#markup' => drupal_render($form),
    );
  }
}