You are here

function _pm_permission_permission_belonged in Drupal PM (Project Management) 7.3

Same name and namespace in other branches
  1. 8 includes/pm.permission.inc \_pm_permission_permission_belonged()

Helper function to generate belonged to permission set.

Parameters

string $type: Node bundle machine name.

string $name: Node bundle name that could be used for display.

Return value

array $permissions Array equivalent to the return of hook_permission().

1 call to _pm_permission_permission_belonged()
pm_permission_permission_per_bundle in includes/pm.permission.inc
Creates an array of permission name for the given node bundle.

File

includes/pm.permission.inc, line 273
Main module file for the pm_permission module.

Code

function _pm_permission_permission_belonged($type, $name, $belonged) {
  $permissions["PM permission {$type}: view own {$belonged}"] = array(
    'title' => t('%type_name: View content in own %belonged', array(
      '%type_name' => $name,
      '%belonged' => $belonged,
    )),
    'description' => t('For %type_name assigned to the same %belonged as a user, allows the user to view the %type_name and see the %type_name in lists or dropdowns elsewhere on the site.', array(
      '%type_name' => $name,
      '%belonged' => $belonged,
    )),
  );
  $permissions["PM permission {$type}: update own {$belonged}"] = array(
    'title' => t('%type_name: Edit content in own %belonged', array(
      '%type_name' => $name,
      '%belonged' => $belonged,
    )),
    'description' => t('For %type_name assigned to the same %belonged as a user, allows the user to edit the %type_name.', array(
      '%type_name' => $name,
      '%belonged' => $belonged,
    )),
  );
  $permissions["PM permission {$type}: delete own {$belonged}"] = array(
    'title' => t('%type_name: Delete in own %belonged', array(
      '%type_name' => $name,
      '%belonged' => $belonged,
    )),
    'description' => t('For %type_name assigned to the same %belonged as a user, allows the user to delete the %type_name.', array(
      '%type_name' => $name,
      '%belonged' => $belonged,
    )),
  );
  return $permissions;
}