- Posts: 210
- Thank you received: 3
How to get name of event custom field
- Patrick
- Topic Author
- Offline
- Elite Member
Less
More
4 years 5 months ago - 4 years 5 months ago #129289
by Patrick
How to get name of event custom field was created by Patrick
Hi
File event-properties.php does output event custom fields:
I now use this code in Override file themes/default/event/default.php.
Works fine.
But there I want to get one specific field. In configuration > Event custom field it has name "field_test".
How can I get this?
What I want to do in foreach:
if(field_test) { do something } else {do something else }
How can I do this?
Thanks.
Patrick
File event-properties.php does output event custom fields:
Code:
if (isset($item->paramData))
{
foreach ($item->paramData as $param)
{
if ($param['value'])
{
$paramValue = $param['value'];
// Make the link click-able
if (filter_var($paramValue, FILTER_VALIDATE_URL))
{
$paramValue = '<a href="' . $paramValue . '" target="_blank">' . $paramValue . '<a/>';
}
?>
<tr class="eb-event-property">
<td class="eb-event-property-label">
<strong><?php echo JText::_($param['title']); ?></strong>
</td>
<td class="eb-event-property-value">
<?php echo JText::_($paramValue); ?>
</td>
</tr>
<?php
}
}
}
I now use this code in Override file themes/default/event/default.php.
Works fine.
But there I want to get one specific field. In configuration > Event custom field it has name "field_test".
How can I get this?
What I want to do in foreach:
if(field_test) { do something } else {do something else }
How can I do this?
Thanks.
Patrick
Last edit: 4 years 5 months ago by Patrick.
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
4 years 5 months ago #129297
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic How to get name of event custom field
Change the code from:
to
Then you can get name of the field from $fieldName variable
Tuan
Code:
foreach ($item->paramData as $param)
to
Code:
foreach ($item->paramData as $fieldName => $param)
Then you can get name of the field from $fieldName variable
Tuan
The following user(s) said Thank You: Patrick
Please Log in or Create an account to join the conversation.
- Patrick
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 210
- Thank you received: 3
4 years 5 months ago #129300
by Patrick
Replied by Patrick on topic How to get name of event custom field
Hi Tuan
Works fine.
Thanks a lot.
Patrick
Works fine.
Thanks a lot.
Patrick
Please Log in or Create an account to join the conversation.
Moderators: Tuan Pham Ngoc
Support
Documentation
Information
Copyright © 2024 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.