Skip to content
Snippets Groups Projects
Commit 347f751f authored by Neil Drumm's avatar Neil Drumm :wave:
Browse files

Issue #3491859: Update project name restrictions to follow GitLab

parent 5ca13f29
No related branches found
No related tags found
1 merge request!312Issue # 3494493: Documentation: Document Maintainer Widget
......@@ -1865,13 +1865,15 @@ function drupalorg_maintainers_json($project) {
* @see drupalorg_project_form_node_form_alter()
* @see https://www.php.net/manual/en/functions.user-defined.php
* @see https://www.drupal.org/node/2172891
* @see https://docs.gitlab.com/ee/user/reserved_names.html
*/
function drupalorg_project_machine_name_validate($element, &$form_state, $form) {
if (($form['#id'] === 'project-promote-project-form' || !isset($form_state['values']['field_project_type'][LANGUAGE_NONE][0]['value']) || $form_state['values']['field_project_type'][LANGUAGE_NONE][0]['value'] == 'full')
&& !preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $element['#value'])) {
form_error($element, t('@title must follow <a href="@url">PHP naming convention</a>.', array(
&& !(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $element['#value']) && preg_match('/[a-zA-Z0-9]$/', $element['#value']))) {
form_error($element, t('@title must follow <a href="@url">PHP naming convention</a>, and can not start or end with a special character.', [
'@title' => $element['#title'],
'@url' => 'https://www.php.net/manual/en/functions.user-defined.php')));
'@url' => 'https://www.php.net/manual/en/functions.user-defined.php',
]));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment