You are here

function patterns_publish_pattern_submit in Patterns 7.2

Executes patterns_db_publish_pattern($pid) and display a message.

See also



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


function patterns_publish_pattern_submit($form, &$form_state) {
  $pid = $form_state['values']['pid'];
  $pattern = patterns_utils_if_invalid_go_back($pid);
  $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);
  $form_state['redirect'] = 'admin/patterns';