I have a custom component I am creating. I am trying to implement custom fields for several of my views. I have custom fields added currently and I can create a custom field and custom field groups for each of the views that I am wanting, but I can't seem to get them to show up on my edit layout.
Here is the code for my edit layout.
<?php
//NO DIRECT ACCESS
defined('_JEXEC') or die('Restricted access');
?>
<form action="<?php echo JRoute::_('index.php?option=com_example&layout=edit&id='.(int) $this->item->id);?>" method="post" name="adminForm" id="adminForm" class="form-validate">
<fieldset class="adminform">
<legend><?php echo JText::_('Client Details'); ?></legend>
<?php foreach($this->form->getFieldset() as $field): ?>
<?php if (!$field->hidden): ?>
<?php echo $field->label; ?>
<?php endif; ?>
<?php echo $field->input; ?>
<?php endforeach; ?>
</fieldset>
<fieldset class="adminform">
<legend><?php echo JText::_('Custom Fields'); ?></legend>
<?php
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');
$customFields = FieldsHelper::getFields('com_example.clients', $this->item, true);
echo '<pre>';
print_r($customFields);
echo '</pre>';
?>
<?php foreach($customFields as $field): ?>
<?php if (!$field->hidden): ?>
<?php echo $field->label; ?>
<?php endif; ?>
<?php echo $field->input; ?>
<?php endforeach; ?>
</fieldset>
<div>
<input type="hidden" name="task" value="client.edit" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
I when I print_r() the $customFields variable I can see the custom field that I created, but for the life of me I can't figure out how to convert that stdObject over to the actual form field. Anyone have any ideas on this? I am sure it is something simple but I don't see the answer in the Joomla Component Dev Tutorials online.