CONTRIBUTING.md - Add documentation for new contributors (#8152)
[civicrm-core.git] / CRM / Grant / Info.php
index 45d93e6b261eae205dba82bc7aa1d92326b6d63a..ff42c27a8ed3e08ecad5595d869cfcdba3d4ed19 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2016                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -31,7 +31,7 @@
  * abstract class.
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
+ * @copyright CiviCRM LLC (c) 2004-2016
  * $Id$
  *
  */
@@ -61,15 +61,34 @@ class CRM_Grant_Info extends CRM_Core_Component_Info {
   /**
    * @inheritDoc
    * @param bool $getAllUnconditionally
+   * @param bool $descriptions
+   *   Whether to return permission descriptions
    *
    * @return array
    */
-  public function getPermissions($getAllUnconditionally = FALSE) {
-    return array(
-      'access CiviGrant',
-      'edit grants',
-      'delete in CiviGrant',
+  public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
+    $permissions = array(
+      'access CiviGrant' => array(
+        ts('access CiviGrant'),
+        ts('View all grants'),
+      ),
+      'edit grants' => array(
+        ts('edit grants'),
+        ts('Create and update grants'),
+      ),
+      'delete in CiviGrant' => array(
+        ts('delete in CiviGrant'),
+        ts('Delete grants'),
+      ),
     );
+
+    if (!$descriptions) {
+      foreach ($permissions as $name => $attr) {
+        $permissions[$name] = array_shift($attr);
+      }
+    }
+
+    return $permissions;
   }
 
   /**