Changeset View
Changeset View
Standalone View
Standalone View
src/view/form/control/AphrontFormPolicyControl.php
| Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | protected function getOptions() { | ||||
| foreach ($this->policies as $policy) { | foreach ($this->policies as $policy) { | ||||
| if ($policy->getPHID() == PhabricatorPolicies::POLICY_PUBLIC) { | if ($policy->getPHID() == PhabricatorPolicies::POLICY_PUBLIC) { | ||||
| // Never expose "Public" for capabilities which don't support it. | // Never expose "Public" for capabilities which don't support it. | ||||
| $capobj = PhabricatorPolicyCapability::getCapabilityByKey($capability); | $capobj = PhabricatorPolicyCapability::getCapabilityByKey($capability); | ||||
| if (!$capobj || !$capobj->shouldAllowPublicPolicySetting()) { | if (!$capobj || !$capobj->shouldAllowPublicPolicySetting()) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| } | } | ||||
| $policy_short_name = id(new PhutilUTF8StringTruncator()) | |||||
| ->setMaximumGlyphs(28) | |||||
| ->truncateString($policy->getName()); | |||||
| $options[$policy->getType()][$policy->getPHID()] = array( | $options[$policy->getType()][$policy->getPHID()] = array( | ||||
| 'name' => phutil_utf8_shorten($policy->getName(), 28), | 'name' => $policy_short_name, | ||||
| 'full' => $policy->getName(), | 'full' => $policy->getName(), | ||||
| 'icon' => $policy->getIcon(), | 'icon' => $policy->getIcon(), | ||||
| ); | ); | ||||
| } | } | ||||
| // If we were passed several custom policy options, throw away the ones | // If we were passed several custom policy options, throw away the ones | ||||
| // which aren't the value for this capability. For example, an object might | // which aren't the value for this capability. For example, an object might | ||||
| // have a custom view pollicy and a custom edit policy. When we render | // have a custom view pollicy and a custom edit policy. When we render | ||||
| ▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines | |||||