How to get name of event custom field

  • Patrick
  • Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
More
2 weeks 3 days ago - 2 weeks 3 days 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:
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: 2 weeks 3 days ago by Patrick.

Please Log in or Create an account to join the conversation.

More
2 weeks 3 days 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:
foreach ($item->paramData as $param)

to
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
  • Expert Boarder
  • Expert Boarder
More
2 weeks 3 days 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

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc