Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
civicrm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plugins
civicrm
Commits
837533ce
Verified
Commit
837533ce
authored
6 years ago
by
Coleman Watts
Committed by
Kevin Cristiano
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Standardize weights of tabs and extract basic tabs to function
Signed-off-by:
Kevin Cristiano
<
kcristiano@tadpole.cc
>
parent
fbf56476
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
civicrm/CRM/Contact/Page/View/Summary.php
+57
-45
57 additions, 45 deletions
civicrm/CRM/Contact/Page/View/Summary.php
civicrm/CRM/Grant/Info.php
+1
-1
1 addition, 1 deletion
civicrm/CRM/Grant/Info.php
with
58 additions
and
46 deletions
civicrm/CRM/Contact/Page/View/Summary.php
+
57
−
45
View file @
837533ce
...
...
@@ -306,6 +306,54 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
return
parent
::
getTemplateFileName
();
}
/**
* @return array
*/
public
static
function
basicTabs
()
{
return
[
[
'id'
=>
'summary'
,
'url'
=>
'#contact-summary'
,
'title'
=>
ts
(
'Summary'
),
'weight'
=>
0
,
],
[
'id'
=>
'activity'
,
'title'
=>
ts
(
'Activities'
),
'class'
=>
'livePage'
,
'weight'
=>
70
,
],
[
'id'
=>
'rel'
,
'title'
=>
ts
(
'Relationships'
),
'class'
=>
'livePage'
,
'weight'
=>
80
,
],
[
'id'
=>
'group'
,
'title'
=>
ts
(
'Groups'
),
'class'
=>
'ajaxForm'
,
'weight'
=>
90
,
],
[
'id'
=>
'note'
,
'title'
=>
ts
(
'Notes'
),
'class'
=>
'livePage'
,
'weight'
=>
100
,
],
[
'id'
=>
'tag'
,
'title'
=>
ts
(
'Tags'
),
'weight'
=>
110
,
],
[
'id'
=>
'log'
,
'title'
=>
ts
(
'Change Log'
),
'weight'
=>
120
,
],
];
}
/**
* @return array
* @throws \CRM_Core_Exception
...
...
@@ -344,53 +392,24 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
'count'
=>
CRM_Contact_BAO_Contact
::
getCountComponent
(
$u
,
$this
->
_contactId
),
'class'
=>
'livePage'
,
];
// make sure to get maximum weight, rest of tabs go after
// FIXME: not very elegant again
if
(
$weight
<
$elem
[
'weight'
])
{
$weight
=
$elem
[
'weight'
];
}
}
}
$rest
=
[
'activity'
=>
[
'title'
=>
ts
(
'Activities'
),
'class'
=>
'livePage'
,
],
'rel'
=>
[
'title'
=>
ts
(
'Relationships'
),
'class'
=>
'livePage'
,
],
'group'
=>
[
'title'
=>
ts
(
'Groups'
),
'class'
=>
'ajaxForm'
,
],
'note'
=>
[
'title'
=>
ts
(
'Notes'
),
'class'
=>
'livePage'
,
],
'tag'
=>
[
'title'
=>
ts
(
'Tags'
),
],
'log'
=>
[
'title'
=>
ts
(
'Change Log'
),
],
];
// show the tabs only if user has generic access to CiviCRM
$accessCiviCRM
=
CRM_Core_Permission
::
check
(
'access CiviCRM'
);
foreach
(
$rest
as
$k
=>
$v
)
{
if
(
$accessCiviCRM
&&
!
empty
(
$this
->
_viewOptions
[
$k
]))
{
$allTabs
[]
=
$v
+
[
'id'
=>
$k
,
foreach
(
self
::
basicTabs
()
as
$tab
)
{
if
(
$tab
[
'id'
]
==
'summary'
)
{
$allTabs
[]
=
$tab
;
}
elseif
(
$accessCiviCRM
&&
!
empty
(
$this
->
_viewOptions
[
$tab
[
'id'
]]))
{
$allTabs
[]
=
$tab
+
[
'url'
=>
CRM_Utils_System
::
url
(
"civicrm/contact/view/
$k
"
,
"civicrm/contact/view/
{
$tab
[
'id'
]
}
"
,
"reset=1&cid=
{
$this
->
_contactId
}
"
),
'weight'
=>
$weight
,
'count'
=>
CRM_Contact_BAO_Contact
::
getCountComponent
(
$k
,
$this
->
_contactId
),
'count'
=>
CRM_Contact_BAO_Contact
::
getCountComponent
(
$tab
[
'id'
],
$this
->
_contactId
),
];
$weight
+
=
10
;
$weight
=
$tab
[
'weight'
]
+
10
;
}
}
...
...
@@ -421,13 +440,6 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
CRM_Utils_Hook
::
tabs
(
$allTabs
,
$this
->
_contactId
);
CRM_Utils_Hook
::
tabset
(
'civicrm/contact/view'
,
$allTabs
,
$context
);
$allTabs
[]
=
[
'id'
=>
'summary'
,
'url'
=>
'#contact-summary'
,
'title'
=>
ts
(
'Summary'
),
'weight'
=>
0
,
];
// now sort the tabs based on weight
usort
(
$allTabs
,
[
'CRM_Utils_Sort'
,
'cmpFunc'
]);
return
$allTabs
;
...
...
This diff is collapsed.
Click to expand it.
civicrm/CRM/Grant/Info.php
+
1
−
1
View file @
837533ce
...
...
@@ -117,7 +117,7 @@ class CRM_Grant_Info extends CRM_Core_Component_Info {
return
array
(
'title'
=>
ts
(
'Grants'
),
'url'
=>
'grant'
,
'weight'
=>
5
0
,
'weight'
=>
6
0
,
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment