You are here

function patterns_edit_page in Patterns 7.2

Same name and namespace in other branches
  1. 7 includes/forms/editor.inc \patterns_edit_page()

Display the page for editing a pattern.

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

File

includes/forms/editor.inc, line 71
Functions, forms related to the Patterns editor.

Code

function patterns_edit_page($pid = NULL) {
  $form = array();
  if (!patterns_parser_ready()) {
    $messages = t('No available patterns parser was found.</br>');
    $messages .= t(' Go to the !modules page to enable more Patterns parsers.', array(
      '!modules' => l(t('modules'), 'admin/modules'),
    ));
    drupal_set_message($messages, 'warning');
    return $form;
  }
  $pattern = patterns_utils_if_invalid_go_back($pid);
  if (!$pattern->file) {
    drupal_set_message(t('This pattern does not seem to be associated with a valid source file.'), 'error');
    return FALSE;
  }
  $info = array();
  $info['Path'][] = t('Path:');
  $info['Path'][] = $pattern->file;
  $info['Enabled'][] = t('Enabled:');
  $info['Enabled'][] = $pattern->enabled ? t('Yes') : t('No');
  $out = '<h6>Info</h6>';
  $out .= theme('table', array(
    'rows' => $info,
    'attributes' => array(
      'class' => 'patterns-list',
    ),
  ));
  $out .= patterns_editor('patterns_edit', $pattern);
  return $out;
}