url_alias_permissions.module in URL Alias Permissions 7
Same filename and directory in other branches
This is the main script for the URL Alias Permissions module. It merely contains the implementation of hooks invoked by Drupal core.
File
url_alias_permissions.moduleView source
<?php
/**
* @file
* This is the main script for the URL Alias Permissions module. It merely
* contains the implementation of hooks invoked by Drupal core.
*/
/**
* Implements hook_help().
*/
function url_alias_permissions_help($path, $arg) {
switch ($path) {
// Main module help for the Field Permissions module.
case 'admin/help#url_alias_permissions':
return '<p>' . t('Grant access to users to edit and create path aliases for each content type.') . '</p>';
}
}
/**
* Implements of hook_permission().
*/
function url_alias_permissions_permission() {
$perms = array();
// Generate edit url alias permissions for all content types.
foreach (node_permissions_get_configured_types() as $type) {
$info = node_type_get_type($type);
$perms += array(
"edit {$type} URL alias" => array(
'title' => t('Create and edit %type_name URL alias', array(
'%type_name' => $info->name,
)),
),
);
}
return $perms;
}
/**
* Implements hook_form_BASE_FORM_ID_alter() for node_form().
*
* Check if they have access to set the path for the content type
*/
function url_alias_permissions_form_node_form_alter(&$form, &$form_state, $form_id) {
$form['path']['#access'] = user_access('edit ' . $form['type']['#value'] . ' URL alias');
}
Functions
Name | Description |
---|---|
url_alias_permissions_form_node_form_alter | Implements hook_form_BASE_FORM_ID_alter() for node_form(). |
url_alias_permissions_help | Implements hook_help(). |
url_alias_permissions_permission | Implements of hook_permission(). |