You are here

function patterns_db_analyze_patterns_status in Patterns 7

Same name and namespace in other branches
  1. 7.2 includes/db.inc \patterns_db_analyze_patterns_status()

Returns a string representation of the status of the pattern as it is in the database;

Parameters

mixed $pattern A pattern object, an array representing: the pattern object, a numeric id or alphanumeric name of the pattern as it is in the database

1 call to patterns_db_analyze_patterns_status()
patterns_edit in includes/forms/editor.inc
Form constructor for editing a pattern. TODO:params

File

includes/db.inc, line 443
Retrieve, save, and remove patterns from the database.

Code

function patterns_db_analyze_patterns_status($pattern) {
  $pattern = _patterns_db_get_pattern($pattern);
  if (!$pattern) {
    return t('This pattern has not been validated yet.');
  }
  if ($pattern->status >= 0) {
    return t('This is a valid pattern');
  }
  if ($pattern->status === PATTERNS_STATUS_INVALID) {
    return t('This pattern is marked as NOT valid');
  }
  if ($pattern->status === PATTERNS_STATUS_TRASHED) {
    return t('This pattern is marked as TRASHED.');
  }
  return t('This pattern has not been validated yet.');
}