You are here

function view_mode_page_add_pattern in View Mode Page 7

Same name and namespace in other branches
  1. 8 view_mode_page.module \view_mode_page_add_pattern()
  2. 8.2 view_mode_page.module \view_mode_page_add_pattern()
  3. 7.2 view_mode_page.module \view_mode_page_add_pattern()

Add a URL pattern to the database.

This does not add the pattern to the menu_router table, but only adds it to the View Mode Page table.

Parameters

string $content_type: The name of the content type that the pattern is used for.

string $view_mode: The name of the view mode.

string $pattern: The URL pattern that is used in the hook_menu() call.

1 call to view_mode_page_add_pattern()
view_mode_page_form_submit in ./view_mode_page.module
Implements hook_form_submit().

File

./view_mode_page.module, line 217
View Mode Page module allows users to add a page for a specific view mode.

Code

function view_mode_page_add_pattern($content_type, $view_mode, $pattern, $show_title = FALSE, $title = '') {
  $query = db_insert('view_mode_page');
  $result = $query
    ->fields(array(
    'content_type' => $content_type,
    'view_mode' => $view_mode,
    'url_pattern' => $pattern,
    'show_title' => intval($show_title),
    'title' => $title,
  ))
    ->execute();
  module_invoke_all('view_mode_page_pattern_added', $content_type, $view_mode, $pattern, $result);
  return $result;
}