chozma
Member
My first code contribution to you so I hope I have done this right! I haven't tackled GitHub yet, on my list of things to learn once I launch on my current project.
Code contribution details
The Yes/No element in List view displays a tick or a cross for 1 and 0 respectively. However at the moment it also displays a cross if there is no data/no record.
I don't find that particularly useful especially as I have lots of lists where I have joined data so I get lots of random crosses everywhere.
Here is a before and after of what I am talking about:
BEFORE - rows 2, 5 and 6 don't have associated mob records, so there is no data. Really these should be blank.
AFTER - blanks where they should be blanks in rows 2, 5 and 6.
The code was incredibly simple to change, only two lines really. The forum won't let me upload a PHP file to attach so its here at the bottom of this post:
I hope this is useful and that others somewhere might find it helpful too. Please let me know, thanks
fabrik_element_yesno_list.php
Code contribution details
The Yes/No element in List view displays a tick or a cross for 1 and 0 respectively. However at the moment it also displays a cross if there is no data/no record.
I don't find that particularly useful especially as I have lots of lists where I have joined data so I get lots of random crosses everywhere.
Here is a before and after of what I am talking about:
BEFORE - rows 2, 5 and 6 don't have associated mob records, so there is no data. Really these should be blank.
AFTER - blanks where they should be blanks in rows 2, 5 and 6.
The code was incredibly simple to change, only two lines really. The forum won't let me upload a PHP file to attach so its here at the bottom of this post:
I hope this is useful and that others somewhere might find it helpful too. Please let me know, thanks
fabrik_element_yesno_list.php
PHP:
<?php
/**
* Layout: Yes/No field list view
*
* @package Joomla
* @subpackage Fabrik
* @copyright Copyright (C) 2005-2014 fabrikar.com - All rights reserved.
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
* @since 3.2
*/
// No direct access
defined('_JEXEC') or die('Restricted access');
$d = $displayData;
$data = $d->value;
$tmpl = $d->tmpl;
$j3 = FabrikWorker::j3();
if ($data == '1') :
$icon = $j3 ? 'checkmark.png' : '1.png';
$opts = array('alt' => FText::_('JYES'));
echo FabrikHelperHTML::image($icon, 'list', $tmpl, $opts);
elseif($data == '0') :
$icon = $j3 ? 'remove.png' : '0.png';
echo FabrikHelperHTML::image($icon, 'list', $tmpl, array('alt' => FText::_('JNO')));
else :
//display nothing, there's no data
endif;