You are here

function user_patterns_callbacks in Patterns 7

File

patterns_components/components/user.inc, line 501

Code

function user_patterns_callbacks($action, $tag, &$data) {
  if ($tag == 'user') {

    // Check if the user needs updating.
    if ($data['uid']) {
      if ($action === PATTERNS_DELETE) {
        $result = array(
          'user_cancel_confirm_form',
        );
      }
      elseif ($action === PATTERNS_MODIFY) {
        $result = array(
          'user_profile_form',
        );
      }
    }
    else {
      if ($action !== PATTERNS_DELETE) {
        $result = array(
          'user_register_form',
        );
      }
      else {

        // TODO: ???
      }
    }
  }
  elseif ($tag == 'role') {

    // Role names should always be unique.
    if ($data['rid'] && $data['name'] && $action === PATTERNS_MODIFY) {
      $result = array(
        'user_admin_role',
      );
    }
    elseif ($action === PATTERNS_DELETE) {
      $result = array(
        'user_admin_role_delete_confirm',
      );
    }
    elseif ($action === PATTERNS_CREATE) {
      $result = array(
        'user_admin_roles',
      );
    }
  }
  elseif ($tag == 'permission') {
    $result = array(
      'user_admin_permissions',
    );
  }
  return patterns_results(PATTERNS_SUCCESS, t('Execution successful'), $result);
}