You are here

function hosting_platform_form_publish_path_validate in Hosting 7.3

Element validator for publish_path. Only run when field is editable. (New node or failed validation and no makefile.)

1 string reference to 'hosting_platform_form_publish_path_validate'
hosting_platform_form in platform/hosting_platform.module
Implements hook_form().

File

platform/hosting_platform.module, line 611
Platform node type definition.

Code

function hosting_platform_form_publish_path_validate($element, &$form_state, &$form) {
  $platform_base_path = variable_get('hosting_platform_base_path', '/var/aegir/platforms/');

  // If platform path doesn't already begin with the basepath and does not begin with a "/", append default base path.
  if (strpos($element['#value'], $platform_base_path) !== 0 && strpos($element['#value'], '/') !== 0) {
    $full_path = hosting_path_normalize($platform_base_path . '/' . $element['#value']);
    form_set_value($element, $full_path, $form_state);
  }
}