You are here

function _patterns_lab_include_pattern in Patterns 7.2

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

Returns the portion of a pattern object to be included as a string, depending on the passed mode of exporting.

Parameters

stdclass $pattern an object representing the pattern as loaded from: the database

mixed $mode one of the four inclusion modes:

1 call to _patterns_lab_include_pattern()
patterns_lab_submit in includes/forms/lab.inc
Exports selected patterns either in a file or as a zip-archive

File

includes/forms/lab.inc, line 309
Functions related to exporting patterns.

Code

function _patterns_lab_include_pattern($pattern, $mode = PATTERNS_EXPORT_MODE_FULL) {
  if (empty($pattern)) {
    return FALSE;
  }
  if ($mode === PATTERNS_EXPORT_MODE_FULL) {
    return $pattern->pattern;
  }
  if ($mode === PATTERNS_EXPORT_MODE_ACTIONS) {
    return patterns_parser_extract_all_actions($pattern->pattern);
  }
  if ($mode === PATTERNS_EXPORT_MODE_NAME) {
    return $pattern->name;
  }
  if ($mode === PATTERNS_EXPORT_MODE_ID) {
    return $pattern->pid;
  }
  return FALSE;
}