function path_admin_form

Form constructor for the path administration form.

Parameters

$path: An array containing the path ID, source, alias, and language code.

See also

path_admin_form_validate()

path_admin_form_submit()

path_admin_form_delete_submit()

Related topics

1 string reference to 'path_admin_form'
path_admin_edit in modules/path/path.admin.inc
Page callback: Returns a form creating or editing a path alias.

File

modules/path/path.admin.inc, line 127

Code

function path_admin_form($form, &$form_state, $path = array(
    'source' => '',
    'alias' => '',
    'language' => LANGUAGE_NONE,
    'pid' => NULL,
)) {
    $form['source'] = array(
        '#type' => 'textfield',
        '#title' => t('Existing system path'),
        '#default_value' => $path['source'],
        '#maxlength' => 255,
        '#size' => 45,
        '#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1.'),
        '#field_prefix' => url(NULL, array(
            'absolute' => TRUE,
        )) . (variable_get('clean_url', 0) ? '' : '?q='),
        '#required' => TRUE,
    );
    $form['alias'] = array(
        '#type' => 'textfield',
        '#title' => t('Path alias'),
        '#default_value' => $path['alias'],
        '#maxlength' => 255,
        '#size' => 45,
        '#description' => t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
        '#field_prefix' => url(NULL, array(
            'absolute' => TRUE,
        )) . (variable_get('clean_url', 0) ? '' : '?q='),
        '#required' => TRUE,
    );
    // This will be a hidden value unless locale module is enabled.
    $form['language'] = array(
        '#type' => 'value',
        '#value' => $path['language'],
    );
    $form['actions'] = array(
        '#type' => 'actions',
    );
    $form['actions']['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Save'),
    );
    if ($path['pid']) {
        $form['pid'] = array(
            '#type' => 'hidden',
            '#value' => $path['pid'],
        );
        $form['actions']['delete'] = array(
            '#type' => 'submit',
            '#value' => t('Delete'),
            '#submit' => array(
                'path_admin_form_delete_submit',
            ),
        );
    }
    return $form;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.