function patterns_import_build_import_form_state in Patterns 7
Same name and namespace in other branches
- 7.2 includes/forms/import.inc \patterns_import_build_import_form_state()
Creates a miniminal form_state object to import a pattern into the database.
Returns FALSE if $name or $pattern are missing.
Parameters
mixed $name the name of the pattern:
mixed $pattern the pattern code as string or array. If array gets: converted to string
mixed $dest the folder in the file system where the pattern will be: saved. If empty it uses the default patterns files directory.
File
- includes/
forms/ import.inc, line 392 - Importing Patterns from a file or using an URL.
Code
function patterns_import_build_import_form_state($name = NULL, $pattern = NULL, $dest = NULL) {
if (is_null($name) || is_null($pattern)) {
return FALSE;
}
if (is_null($dest)) {
$dest = patterns_path_get_files_dir();
}
$form = array();
$form['values'] = array();
$form['values']['name'] = $name;
$form['values']['content'] = $pattern;
$form['values']['destination'] = $dest;
return $form;
}