You are here

function patterns_publish_pattern in Patterns 7

Same name and namespace in other branches
  1. 6.2 patterns.module \patterns_publish_pattern()
  2. 6 patterns.module \patterns_publish_pattern()
  3. 7.2 includes/ \patterns_publish_pattern()

Callback function for route /admin/patterns/publish/

Sets the flag public to TRUE in the database and invokes the hook_patterns_publish in all the modules implementing it.

Redirects the user to the patterns home.


mixed $pattern the id or the name of the pattern.:

1 string reference to 'patterns_publish_pattern'
patterns_menu in ./patterns.module
Implements hook_menu().


includes/, line 187
Functions related to importing and publishing patterns on the web.


function patterns_publish_pattern($pattern) {
  $pattern = patterns_utils_if_invalid_go_back($pattern);
  $result = patterns_db_publish_pattern($pattern);
  if ($result) {
    drupal_set_message(t('Pattern %pattern was marked as public.', array(
      '%pattern' => @$pattern->name,
  else {
    drupal_set_message(t('An error occurred. Unable to mark pattern %pattern as public.', array(
      '%pattern' => @$pattern->name,
    )), 'error');

  // Patterns API
  // Invoke all the modules who wants to do something with the published pattern
  module_invoke_all('patterns_publish', $pattern);