• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How are phrases for permissions fetched?

Luxus

Well-known member
#1
Some Permission phrases like permission_general_view aren't in admin templates although they are clearly there in the html output. And they can't be found in any core files either. The html for them is this:
Code:
<tr class="permission">
	<th>{$permission.title}:</th>
$permission.title is a variable for phrases. I have searched the core files for $permission.title. No results besides a few in the admin_templates.xml file of the install directory. So this begs the question how those phrases are fetched, or more specifically, how does $permission.title work?
 

Jeremy

Well-known member
#2
You would really want to look for $permission['title'] or the specific Controller actions for those templates you found to see how $permission is populated.
 

xf_phantom

Well-known member
#3
Phrase titles for adminnavigation, cronjobs, options, user permissions, style properties, thread prefixes, trophies, userfields and warnings are generated by the model

e.g. for the admin permission, you'll want to check the XenForo_Model_Permission

PHP:
ppublic function prepareAdminPermission(array $permission)
{
$permission['title'] = new XenForo_Phrase($this->getAdminPermissionTitlePhraseName(
$permission['admin_permission_id']
));
 
return $permission;
}