Skip to content

Commit c8a1b8a

Browse files
nvyushrdeutz
authored andcommitted
[com_contact] Move event trigger to correct place (#11719)
* [com_contact] Move event trigger to correct place 1) Event trigger of the event `afterDisplayTitle` is in the wrong place — when option 'show_contact_category' is 'show_with_link' it triggers BEFORE of displaying the title. 2) The option 'show_contact_category' can't be simultaneously 'show_no_link' and 'show_with_link', two `if` replaced with `if` - `elseif`. * Update default.php 3) The option 'presentation_style' can't be simultaneously 'sliders' and 'tabs' and 'plain', sequences of `if` replaced with if - elseif
1 parent 860bb67 commit c8a1b8a

File tree

1 file changed

+63
-93
lines changed

1 file changed

+63
-93
lines changed

components/com_contact/views/contact/tmpl/default.php

Lines changed: 63 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@
1010
defined('_JEXEC') or die;
1111

1212
$cparams = JComponentHelper::getParams('com_media');
13-
13+
$tparams = $this->params;
1414
jimport('joomla.html.html.bootstrap');
1515
?>
16+
1617
<div class="contact<?php echo $this->pageclass_sfx?>" itemscope itemtype="https://schema.org/Person">
17-
<?php if ($this->params->get('show_page_heading')) : ?>
18+
<?php if ($tparams->get('show_page_heading')) : ?>
1819
<h1>
19-
<?php echo $this->escape($this->params->get('page_heading')); ?>
20+
<?php echo $this->escape($tparams->get('page_heading')); ?>
2021
</h1>
2122
<?php endif; ?>
2223

23-
<?php if ($this->contact->name && $this->params->get('show_name')) : ?>
24+
<?php if ($this->contact->name && $tparams->get('show_name')) : ?>
2425
<div class="page-header">
2526
<h2>
2627
<?php if ($this->item->published == 0) : ?>
@@ -31,15 +32,13 @@
3132
</div>
3233
<?php endif; ?>
3334

34-
<?php if ($this->params->get('show_contact_category') == 'show_no_link') : ?>
35+
<?php $show_contact_category = $tparams->get('show_contact_category'); ?>
36+
37+
<?php if ($show_contact_category == 'show_no_link') : ?>
3538
<h3>
3639
<span class="contact-category"><?php echo $this->contact->category_title; ?></span>
3740
</h3>
38-
<?php endif; ?>
39-
40-
<?php echo $this->item->event->afterDisplayTitle; ?>
41-
42-
<?php if ($this->params->get('show_contact_category') == 'show_with_link') : ?>
41+
<?php elseif ($show_contact_category == 'show_with_link') : ?>
4342
<?php $contactLink = ContactHelperRoute::getCategoryRoute($this->contact->catid); ?>
4443
<h3>
4544
<span class="contact-category"><a href="<?php echo $contactLink; ?>">
@@ -48,47 +47,41 @@
4847
</h3>
4948
<?php endif; ?>
5049

51-
<?php if ($this->params->get('show_contact_list') && count($this->contacts) > 1) : ?>
50+
<?php echo $this->item->event->afterDisplayTitle; ?>
51+
52+
<?php if ($tparams->get('show_contact_list') && count($this->contacts) > 1) : ?>
5253
<form action="#" method="get" name="selectForm" id="selectForm">
5354
<?php echo JText::_('COM_CONTACT_SELECT_CONTACT'); ?>
54-
<?php echo JHtml::_('select.genericlist', $this->contacts, 'id', 'class="inputbox" onchange="document.location.href = this.value"', 'link', 'name', $this->contact->link);?>
55+
<?php echo JHtml::_('select.genericlist', $this->contacts, 'id', 'class="inputbox" onchange="document.location.href = this.value"', 'link', 'name', $this->contact->link); ?>
5556
</form>
5657
<?php endif; ?>
5758

58-
<?php if ($this->params->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>
59+
<?php if ($tparams->get('show_tags', 1) && !empty($this->item->tags->itemTags)) : ?>
5960
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
6061
<?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
6162
<?php endif; ?>
6263

6364
<?php echo $this->item->event->beforeDisplayContent; ?>
65+
66+
<?php $presentation_style = $tparams->get('presentation_style'); ?>
6467

65-
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
68+
<?php if ($presentation_style == 'sliders') : ?>
6669
<?php echo JHtml::_('bootstrap.startAccordion', 'slide-contact', array('active' => 'basic-details')); ?>
67-
<?php endif; ?>
68-
69-
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
70-
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'basic-details')); ?>
71-
<?php endif; ?>
72-
73-
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
7470
<?php echo JHtml::_('bootstrap.addSlide', 'slide-contact', JText::_('COM_CONTACT_DETAILS'), 'basic-details'); ?>
75-
<?php endif; ?>
76-
77-
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
71+
<?php elseif ($presentation_style == 'tabs') : ?>
72+
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'basic-details')); ?>
7873
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'basic-details', JText::_('COM_CONTACT_DETAILS')); ?>
74+
<?php elseif ($presentation_style == 'plain') : ?>
75+
<?php echo '<h3>' . JText::_('COM_CONTACT_DETAILS') . '</h3>'; ?>
7976
<?php endif; ?>
8077

81-
<?php if ($this->params->get('presentation_style') == 'plain'):?>
82-
<?php echo '<h3>' . JText::_('COM_CONTACT_DETAILS') . '</h3>'; ?>
83-
<?php endif; ?>
84-
85-
<?php if ($this->contact->image && $this->params->get('show_image')) : ?>
78+
<?php if ($this->contact->image && $tparams->get('show_image')) : ?>
8679
<div class="thumbnail pull-right">
8780
<?php echo JHtml::_('image', $this->contact->image, JText::_('COM_CONTACT_IMAGE_DETAILS'), array('align' => 'middle', 'itemprop' => 'image')); ?>
8881
</div>
8982
<?php endif; ?>
9083

91-
<?php if ($this->contact->con_position && $this->params->get('show_position')) : ?>
84+
<?php if ($this->contact->con_position && $tparams->get('show_position')) : ?>
9285
<dl class="contact-position dl-horizontal">
9386
<dd itemprop="jobTitle">
9487
<?php echo $this->contact->con_position; ?>
@@ -98,111 +91,90 @@
9891

9992
<?php echo $this->loadTemplate('address'); ?>
10093

101-
<?php if ($this->params->get('allow_vcard')) : ?>
102-
<?php echo JText::_('COM_CONTACT_DOWNLOAD_INFORMATION_AS');?>
94+
<?php if ($tparams->get('allow_vcard')) : ?>
95+
<?php echo JText::_('COM_CONTACT_DOWNLOAD_INFORMATION_AS'); ?>
10396
<a href="<?php echo JRoute::_('index.php?option=com_contact&amp;view=contact&amp;id=' . $this->contact->id . '&amp;format=vcf'); ?>">
104-
<?php echo JText::_('COM_CONTACT_VCARD');?></a>
97+
<?php echo JText::_('COM_CONTACT_VCARD'); ?></a>
10598
<?php endif; ?>
10699

107-
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
100+
<?php if ($presentation_style == 'sliders') : ?>
108101
<?php echo JHtml::_('bootstrap.endSlide'); ?>
109-
<?php endif; ?>
110-
111-
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
102+
<?php elseif ($presentation_style == 'tabs') : ?>
112103
<?php echo JHtml::_('bootstrap.endTab'); ?>
113104
<?php endif; ?>
114105

115-
<?php if ($this->params->get('show_email_form') && ($this->contact->email_to || $this->contact->user_id)) : ?>
116-
117-
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
106+
<?php if ($tparams->get('show_email_form') && ($this->contact->email_to || $this->contact->user_id)) : ?>
107+
<?php if ($presentation_style == 'sliders') : ?>
118108
<?php echo JHtml::_('bootstrap.addSlide', 'slide-contact', JText::_('COM_CONTACT_EMAIL_FORM'), 'display-form'); ?>
119-
<?php endif; ?>
120-
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
109+
<?php elseif ($presentation_style == 'tabs') : ?>
121110
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'display-form', JText::_('COM_CONTACT_EMAIL_FORM')); ?>
111+
<?php elseif ($presentation_style == 'plain') : ?>
112+
<?php echo '<h3>' . JText::_('COM_CONTACT_EMAIL_FORM') . '</h3>'; ?>
122113
<?php endif; ?>
123114

124-
<?php if ($this->params->get('presentation_style') == 'plain'): ?>
125-
<?php echo '<h3>' . JText::_('COM_CONTACT_EMAIL_FORM') . '</h3>'; ?>
126-
<?php endif; ?>
127-
128-
<?php echo $this->loadTemplate('form'); ?>
115+
<?php echo $this->loadTemplate('form'); ?>
129116

130-
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
117+
<?php if ($presentation_style == 'sliders') : ?>
131118
<?php echo JHtml::_('bootstrap.endSlide'); ?>
132-
<?php endif; ?>
133-
134-
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
119+
<?php elseif ($presentation_style == 'tabs') : ?>
135120
<?php echo JHtml::_('bootstrap.endTab'); ?>
136121
<?php endif; ?>
137122
<?php endif; ?>
138123

139-
<?php if ($this->params->get('show_links')) : ?>
124+
<?php if ($tparams->get('show_links')) : ?>
140125
<?php echo $this->loadTemplate('links'); ?>
141126
<?php endif; ?>
142127

143-
<?php if ($this->params->get('show_articles') && $this->contact->user_id && $this->contact->articles) : ?>
144-
145-
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
128+
<?php if ($tparams->get('show_articles') && $this->contact->user_id && $this->contact->articles) : ?>
129+
<?php if ($presentation_style == 'sliders') : ?>
146130
<?php echo JHtml::_('bootstrap.addSlide', 'slide-contact', JText::_('JGLOBAL_ARTICLES'), 'display-articles'); ?>
147-
<?php endif; ?>
148-
149-
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
131+
<?php elseif ($presentation_style == 'tabs') : ?>
150132
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'display-articles', JText::_('JGLOBAL_ARTICLES')); ?>
151-
<?php endif; ?>
152-
153-
<?php if ($this->params->get('presentation_style') == 'plain'):?>
154-
<?php echo '<h3>' . JText::_('JGLOBAL_ARTICLES') . '</h3>'; ?>
133+
<?php elseif ($presentation_style == 'plain') : ?>
134+
<?php echo '<h3>' . JText::_('JGLOBAL_ARTICLES') . '</h3>'; ?>
155135
<?php endif; ?>
156136

157137
<?php echo $this->loadTemplate('articles'); ?>
158138

159-
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
139+
<?php if ($presentation_style == 'sliders') : ?>
160140
<?php echo JHtml::_('bootstrap.endSlide'); ?>
161-
<?php endif; ?>
162-
163-
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
141+
<?php elseif ($presentation_style == 'tabs') : ?>
164142
<?php echo JHtml::_('bootstrap.endTab'); ?>
165143
<?php endif; ?>
166-
167144
<?php endif; ?>
168145

169-
<?php if ($this->params->get('show_profile') && $this->contact->user_id && JPluginHelper::isEnabled('user', 'profile')) : ?>
170-
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
146+
<?php if ($tparams->get('show_profile') && $this->contact->user_id && JPluginHelper::isEnabled('user', 'profile')) : ?>
147+
<?php if ($presentation_style == 'sliders') : ?>
171148
<?php echo JHtml::_('bootstrap.addSlide', 'slide-contact', JText::_('COM_CONTACT_PROFILE'), 'display-profile'); ?>
172-
<?php endif; ?>
173-
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
149+
<?php elseif ($presentation_style == 'tabs') : ?>
174150
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'display-profile', JText::_('COM_CONTACT_PROFILE')); ?>
175-
<?php endif; ?>
176-
<?php if ($this->params->get('presentation_style') == 'plain'):?>
177-
<?php echo '<h3>' . JText::_('COM_CONTACT_PROFILE') . '</h3>'; ?>
151+
<?php elseif ($presentation_style == 'plain') : ?>
152+
<?php echo '<h3>' . JText::_('COM_CONTACT_PROFILE') . '</h3>'; ?>
178153
<?php endif; ?>
179154

180155
<?php echo $this->loadTemplate('profile'); ?>
181156

182-
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
157+
<?php if ($presentation_style == 'sliders') : ?>
183158
<?php echo JHtml::_('bootstrap.endSlide'); ?>
184-
<?php endif; ?>
185-
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
159+
<?php elseif ($presentation_style == 'tabs') : ?>
186160
<?php echo JHtml::_('bootstrap.endTab'); ?>
187161
<?php endif; ?>
188162
<?php endif; ?>
189163

190-
<?php if ($this->contact->misc && $this->params->get('show_misc')) : ?>
191-
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
164+
<?php if ($this->contact->misc && $tparams->get('show_misc')) : ?>
165+
<?php if ($presentation_style == 'sliders') : ?>
192166
<?php echo JHtml::_('bootstrap.addSlide', 'slide-contact', JText::_('COM_CONTACT_OTHER_INFORMATION'), 'display-misc'); ?>
193-
<?php endif; ?>
194-
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
167+
<?php elseif ($presentation_style == 'tabs') : ?>
195168
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'display-misc', JText::_('COM_CONTACT_OTHER_INFORMATION')); ?>
196-
<?php endif; ?>
197-
<?php if ($this->params->get('presentation_style') == 'plain'):?>
198-
<?php echo '<h3>' . JText::_('COM_CONTACT_OTHER_INFORMATION') . '</h3>'; ?>
169+
<?php elseif ($presentation_style == 'plain') : ?>
170+
<?php echo '<h3>' . JText::_('COM_CONTACT_OTHER_INFORMATION') . '</h3>'; ?>
199171
<?php endif; ?>
200172

201173
<div class="contact-miscinfo">
202174
<dl class="dl-horizontal">
203175
<dt>
204-
<span class="<?php echo $this->params->get('marker_class'); ?>">
205-
<?php echo $this->params->get('marker_misc'); ?>
176+
<span class="<?php echo $tparams->get('marker_class'); ?>">
177+
<?php echo $tparams->get('marker_misc'); ?>
206178
</span>
207179
</dt>
208180
<dd>
@@ -213,20 +185,18 @@
213185
</dl>
214186
</div>
215187

216-
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
188+
<?php if ($presentation_style == 'sliders') : ?>
217189
<?php echo JHtml::_('bootstrap.endSlide'); ?>
218-
<?php endif; ?>
219-
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
190+
<?php elseif ($presentation_style == 'tabs') : ?>
220191
<?php echo JHtml::_('bootstrap.endTab'); ?>
221192
<?php endif; ?>
222-
223193
<?php endif; ?>
224194

225-
<?php if ($this->params->get('presentation_style') == 'sliders') : ?>
195+
<?php if ($presentation_style == 'sliders') : ?>
226196
<?php echo JHtml::_('bootstrap.endAccordion'); ?>
227-
<?php endif; ?>
228-
<?php if ($this->params->get('presentation_style') == 'tabs') : ?>
197+
<?php elseif ($presentation_style == 'tabs') : ?>
229198
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
230199
<?php endif; ?>
200+
231201
<?php echo $this->item->event->afterDisplayContent; ?>
232202
</div>

0 commit comments

Comments
 (0)