You are here

function simplemeta_meta_load_by_path in Simple Meta 7

Same name and namespace in other branches
  1. 8.2 simplemeta.module \simplemeta_meta_load_by_path()
  2. 8 simplemeta.module \simplemeta_meta_load_by_path()
  3. 6.2 simplemeta.module \simplemeta_meta_load_by_path()
  4. 7.2 simplemeta.module \simplemeta_meta_load_by_path()

Load meta data by path.

Parameters

string $path: page's path to fetch meta data

string $language: language code

Return value

object|FALSE object representing metadata or FALSE on failure

4 calls to simplemeta_meta_load_by_path()
simplemeta_meta_form_validate_save in ./simplemeta.module
SimpleMeta form validation callback on save.
simplemeta_meta_save in ./simplemeta.module
Save meta data.
simplemeta_page_alter in ./simplemeta.module
Implements hook_page_alter().
simplemeta_page_meta_form_ajax_language in ./simplemeta.module
AJAX callback for language element of the simplemeta_page_meta_form.

File

./simplemeta.module, line 306
SimpleMeta module.

Code

function simplemeta_meta_load_by_path($path, $language = '') {
  $result = db_select('simplemeta', 's')
    ->fields('s')
    ->condition('s.path', $path, '=')
    ->condition('s.language', $language, '=')
    ->execute();
  if ($meta = $result
    ->fetchObject()) {
    $meta->data = unserialize($meta->data);
    return $meta;
  }
  return FALSE;
}