- Posts: 3
- Thank you received: 0
[SOLVED]: Hide specific group extrafield
- vcherub
- Topic Author
- Offline
- New Member
-
Less
More
11 years 2 months ago #1716
by vcherub
Hide specific group extrafield was created by vcherub
Hi there, I'm using this part of code
I need to hide group of extrafield called "Subtitle";
Extra fields from this group appear like item title. (Title appear when subtitle extrafield is empty)
Code:
<?php
$extraFieldsByGroup = JArrayHelper::pivot($this->item->extra_fields, 'group');
$db = JFactory::getDbo();
$query = "SELECT * FROM #__k2_extra_fields_groups";
$db->setQuery($query);
$groups = $db->loadAssocList('id');
foreach ($extraFieldsByGroup as $key=>$extrafields){
$defaultGroup = '';
if(!is_array($extrafields)) $extrafields = array($extrafields);
if($key == $this->item->category->extraFieldsGroup)
$defaultGroup = "class='mefg_default'";
?>
<div id="group" class="<?php echo $groups[$key]['name'];?>" >
<div class="<?php echo $groups[$key]['name'];?>">
<div><h3><?php echo JText::_($groups[$key]['name']); ?></h3></div>
<ul>
<?php foreach ($extrafields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<?php /*?><li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"><?php */?>
<?php if($extraField->type == 'header'): ?>
<h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<div>
<span class="itemExtraFieldsLabel"><?php echo JText::_($extraField->name); ?>:</span>
<span class="itemExtraFieldsValue <?php echo $extraField->alias; ?>"><?php echo $extraField->value; ?></span></div>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div></div>
<?php
}
?>
<div class="clr"></div>
I need to hide group of extrafield called "Subtitle";
Extra fields from this group appear like item title. (Title appear when subtitle extrafield is empty)
Please Log in or Create an account to join the conversation.
- vcherub
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 3
- Thank you received: 0
11 years 2 months ago #1717
by vcherub
Replied by vcherub on topic Hide specific group extrafield
Ok I've done it by css display: none
Please Log in or Create an account to join the conversation.