You are here

function patterns_lab_validate in Patterns 7.2

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

Checks if the patterns directory is ready and if the file name for exported patterns is valid.





includes/forms/, line 123
Functions related to exporting patterns.


function patterns_lab_validate($form, &$form_state) {
  if (!isset($form_state['values']['patterns_table'])) {
    form_set_error('patterns_table', t('An error has occurred'));
  if (array_sum($form_state['values']['patterns_table']) === 0) {
    form_set_error('patterns_table', t('No pattern selected.'));
  if (!isset($form_state['values']['mode']) || !patterns_lab_is_valid_export_mode($form_state['values']['mode'])) {
    form_set_error('mode', t('Please select a valid include mode option'));
  if (!isset($form_state['values']['to'])) {
    form_set_error('to', t('Please select a valid action for the export'));
  if (!patterns_parser_exists($form_state['values']['format'])) {
    form_set_error('format', t('The pattern format seems to be invalid.'));
  if ($form_state['values']['to'] === PATTERNS_EXPORT_TO_DB) {
  elseif (empty($form_state['values']['export_name'])) {
    $form_state['values']['export_name'] = 'pattern';
  return TRUE;