1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

Override a Specific Field

Jul 1, 2013
Override a Specific Field
  • Each row of your List is rendered with components/com_fabrik/views/table/tmpl/default_row.php. The standard file for this looks like:

    PHP:
    <?php
        defined('_JEXEC') or die( 'Restricted access');
    ?>
     
    <tr id="<?php echo $this->_row->id;?>" class="<?php echo $this->_row->class;?>">
        <?php foreach ($this->headings as $heading=>$label) {&nbsp;?>
            <td <?php echo $this->cellClass[$heading]?>><?php echo @$this->_row->data->$heading;?></td>
        <?php }?>
    </tr>
    If we want to alter a single cell, in this case replacing the 'email' value with the text 'email address withheld', we can do this:
    PHP:
    <?php
        defined('_JEXEC') or die( 'Restricted access');
    ?>
     
    <tr id="<?php echo $this->_row->id;?>" class="<?php echo $this->_row->class;?>">
        <?php foreach ($this->headings as $heading=>$label) {&nbsp;?>
            <td <?php echo $this->cellClass[$heading]?>>
            <?php if ($heading == 'tablename___email') {
                    echo "email address witheld';
                } else {
                    echo @$this->_row->data->$heading;
                }?>

            </td>
        <?php }?>
    </tr>
    Easy when you know how.
joeray likes this.