You are here

function eck_permission_label in Entity Construction Kit (ECK) 7.3

Permission label.

Parameters

string $string: A permission string.

Return value

string A label created from the permission string.a

1 call to eck_permission_label()
eck_permission in ./eck.permissions.inc
Implements hook_permission().

File

./eck.permissions.inc, line 16
Permissions.

Code

function eck_permission_label($string) {
  $replacements = array(
    "eck" => "",
    "*" => "administer",
    "bundle" => "bundles",
    "_" => " ",
  );
  $label = $string;
  foreach ($replacements as $current => $final) {
    $label = str_replace($current, $final, $label);
  }
  if (substr_count($label, "type") > 0) {
    $label = str_replace("entity type", "Entity Types", $label);
  }
  else {
    $label = str_replace("entity", "Entities", $label);
  }
  $label = trim($label);
  $label = ucwords($label);
  return $label;
}