display repeating group in custom template

chris.paschen

Chris Paschen
I'm trying to create a custom Fabrik Details template, based on the great tutorial by rob (http://fabrikar.com/help/tutorials/details/3/30) - which means I've basically gutted the original template code.

I've tried to go to the standard template files to understand how to insert just the repeating group, but I'm always getting all of the data from the list/form, not just the repeating group.

I've searched the forum and all the tutorials and WIKI and can't find how to do this. Is there some documentation (or the 'next' video in that process from Rob) that would explain how to do this?

Here's a general idea of what I'm trying to do...

Group A (a 'location' entry)
Group B (a list of files that are associated with Group A / a location) - repeating

In the custom template I'm using Rob's technique


PHP:
$Location= $this->groups['myLOCATION'];
$LocationElements = $Location->elements;
 
$title = $LocationElement['title']->element;


to create the main part of the template.

But I can't figure out how to be able to insert a list of the associated files, that are stored in the files table/list which are an associated list using a repeating group.

All the data (admin-side) is working properly, I just can't figure out how to specifically output JUST that Group B data in a certain place (i.e within a div).

Note: If I just use the code from the bootstrap template ...

PHP:
<?php
                    foreach ($this->groups as $group) :
                        $this->group = $group;
                        ?>
                            <div class="<?php echo $group->class; ?>" id="group<?php echo $group->id;?>" style="<?php echo $group->css;?>">
                                <?php
                                // Load the group template - this can be :
                                //  * default_group.php - standard group non-repeating rendered as an unordered list
                                //  * default_repeatgroup.php - repeat group rendered as an unordered list
                                //  * default_repeatgroup_table.php - repeat group rendered in a table.
                                $this->elements = $group->elements;
                                echo $this->loadTemplate($group->tmpl);
                                if (!empty($group->outro)) : ?>
                                    <div class="groupoutro"><?php echo $group->outro ?></div>
                                <?php
                                endif;
                                ?>
                            </div>
                        <?php
                    endforeach;
                    ?>

It not only displays the 'files', but also all the original data (title, etc.).


NOTE (again) - I'm not looking for anyone to code this for me (esp. in the community area), I'm just trying to see if there is ANY documentation on how this should be coded, so I can understand better IF this is possible and if so, how to learn and understand how it should work.

Thanks
 
OK ... I've dug around for a couple more days and can't find any way to make this work.

I've purchased a subscription with hopes that someone can assist with this - however, I don't seem to have access to post in the standard form (only here in the community forum).

Can someone move this over to the standard form and check to see why I'm not able to post over there?
 
Yes, that gave me a starting point. I needed something just a bit different, but I've managed to use what was posted there.
(I'll try to post my modifications soon for others to use)
 
Maybe I'm missing something, but why didn't you just edit the group settings for the parent table and set the set 'Show group' to
'Yes but hidden'? Then set the Label used for the repeat group containing the list of files to be an appropriate placeholder from the parent group - e.g. {parent_list___location}.

If you want a repeat group for each file, then join that table containing the files to the parent. If you want to display all the files in single element then create a datbasejoin element (containing a list of the associated files) in another table and join that group (shown as readonly?) to the parent.

Some sort of visualization of how you want the form to look would help.
 
Bauer - sorry for not providing an example.
Attached is what I was trying (and have been able) to create.
What I probably just need is a custom element - an 'uploadfile' element that can be displayed as a download (clickable) icon (to match the type of file), along with a name displayed underneath that. Because I couldn't get that, I've re-created that in the template by just having all the necessary data in the repeating group for each file. Also, the group must be displayed in a box (i.e. div) in a specific place on the page.

If someone else has done this and knows a better way (using the built-in Fabrik features) please point me in the proper direction. I'm still learning about 'best-practices' when it comes to Fabrik.

ScreenShot Note: The two PDFs ('download files') are in a repeating group that includes: uploadfile, databasejoin (that links to a 'filetype' table for the icon), field (for the file caption/title). All the other items on the page (title, image, videolink, etc.) are all in the main form/group.
 

Attachments

  • custom-repeating-group-display-example.png
    custom-repeating-group-display-example.png
    316.7 KB · Views: 524
I had some time today and wanted to play around with that file upload element plugin myself anyhow - as I've never really used it before.

I used your needs (and borrowed your image from your website) as an example - and have something for you. (See attachment)

To duplicate attachment example...
Copy out the standard bootstrap form template and renamed it to 'bootstrap_auto" and make one simple change.
In the default_group.php file changed line 28 from <div class="row-fluid"> to <div class="row-auto">.

Add 2 'field' text elements to the parent table, 'seminar_name' and 'presented_by' - and set their 'Access' to 'Special' for Form(add), Form (edit), and Details .

In the repeat table I add a file upload element.

Set the template for the form to use the new bootstrap_auto template on the front end and the standard bootstrap template for admin.

Then in the form (my id #133) add into the 'Introduction'...
Code:
<div class="intro133_header">{test_list___seminar_name}</div>
<div class="intro133_subhead">{test_list___presented_by}</div>
(This will be used to replace the normal form heading with element placeholders from the parent table row)

In the Element settings for the parent list/table set Add, Edit, and View Access for all elements (except id) to 'Special'.

In the Group settings for the repeat table set the 'Access' for both Add and Delete to 'Special' because you are really using the upload element as read-only to users - yet want to be able to add or edit the files as admin.

Do the same for the file upload element itself (set the 'Access' for both Add and Delete to 'Special' ) .

Also, to match your example, change the 'Intro' text in the group settings for the repeat table to...
Code:
<div class="intro_splash"><img alt="reaching the parents of youth" src="/images/reaching_the_parents_of_youth.png" height="148" width="200" /></div>
<div class="intro_head"><span class="intro_comment">These are the files/resources of the Reaching the Parents of Youth Seminar</span><br />
<h3>Download Files</h3></div>

This adds the splash image and heading text. (The actual label/title of the form will be hidden.) The classes were added to allow styling via css - i.e. to allow the repeat groups (files) to appear below the Intro text and yet to the right of the 'splash' image - like in your example.

Then set the css for the row-auto divs width to 'auto' (what were the 'row-fluid' divs which are set to use 100% width). This way you are able to make it so that each of the element div containers will just fall in right next to each other, left-to right, with their width determined only by the width of the element.

Besides eliminating the 'row-fluid' class, the BIG KEY to this working is to set the number of Columns in the group setting for the repeat group to 1 (leave the Columns widths blank) - and adding display:inline-flex and some padding to the css. I have been using this trick on a lot of my forms, as I'm sorta old-school and really not a big fan of everything bootstrap.

Below are the changes made to the custom_css.php file of the bootstrap-auto template (with comments added)...
Code:
/* Hide of the normal form header */
/* hide/remove blank space left by nav heading */
/* Hide entire parent group html */
/* Hide the Repeat Group legend */
/* Hide form action buttons (Save, etc) */
.page-header,
form[id^=form_133] div.row-fluid.nav,
fieldset#group310,
fieldset#group408 legend,
form[id^=form_133] div.form-actions {
    display:none;
}
 
form[id^=form_133] {
    margin:0;
}
 
/* style parent table intro text (new title, subtitle) */
.intro133_header {
    font-size:36px;
    line-height:36px;
    font-weight:bold;
}
 
.intro133_subhead {
    font-size:14px;
    line-height:12px;
    padding: 4px 0 15px 5px;
}
 
fieldset#group408 .groupintro {
    display: inline-block;
    width:auto;
}
 
/* set repeat group position to relative
  so absolute position can be used on intro_head */
fieldset#group408 {
    position:relative;
}
 
/* Height will be height of the form */
/* Needed to compensate for word wrap of long file names */
.intro_splash {
    display: inline-block;
    height: 200px;
}
 
/* change this left position to 20+ width of splash image */
.intro_head {
    display:inline-block;
    position:absolute;
    left:220px;
    top:0px;
}
 
/* display all subgroups as inline-block */
/* top position compensates for intro_head */
.fabrikSubGroup {
    display: inline-block;
    padding: 0 15px 15px;
    position: relative;
    top: 70px;
    vertical-align: top;
}
 
/* this was the row-fluid div
  display elements as inline-flex */
.row-auto {
    display: inline-table;
    max-width: 80px;
    width: auto;   
}
 
/* this gets rid of blank space between repeat subgroups
  left by hidden internal id element */
div.fabrikSubGroupElements div.row-auto:first-of-type {
    display:none;
}
 
/* add pdf icon */
div.fabrikRepeatGroup___test_list_joined___file:before {
    content:url('/images/jdownloads/fileimages/pdf.png')!important;
}
 
/* no option in the upload plugin to hide label */
div.row-auto div.fabrikElementContainer label.fabrikLabel {
    display:none;
}
 
/* set a max-width for the element filename */
a.download-archive {
    word-wrap: break-word;
}
A couple of issues...

It looks like this upload plugin was designed for uploading images. But it would be easy to get it working better for all types of files.

There is already a setting to use a 'default' image if no file was uploaded - but it only shows if no file was uploaded. (I thought I could just use that to display the PDF icon.) I have a folder containing thumbnails for most of the most common file/mime types. I'd like to see that implemented in this plugin- so that if the upload is not an image file - and there is no 'thumbnail' to be created, the appropriate thumbnail would be used for the mime/type of the file (like the PDF thumbnail in this example).

So what I did to get around that issue was to use the ':before' css pseudo element to insert a pdf icon above the file name.

There is no option to hide the label in the upload element configuration. :( But you can do that with css.

Also, if the file uploaded has spaces - the spaces are replaced with underscores. I understand the need for renaming the file itself, but I'd like to see the label used in the href link to the files so that it has the underscores removed - so the file names are displayed in a more user-friendly manner. I.e. so the file name will word-wrap and not take up so much horizontal real estate in the element div block.:(
(You can still take care of that - removing the underscores in the file labels - with some custom javascript.)

Use this example jQuery code in a custom javascript file used by the form - and you'll remove the underscores in the file names. I added to the css code above that I originally posted yesterday to allow for word-wrapping and max widths (new screen image attached)...
Code:
jQuery("div[id^=test_list_joined___file_]").each( function() {
    var thisLabel = jQuery(this).find("a").text(); 
    var newLabel = thisLabel.substr(0,thisLabel.lastIndexOf("."));
    jQuery(this).find("a").text(newLabel.replace(/_/g, " "));
});
Hope I'm not too late, or re-inventing the wheel for you. But nonetheless I learned a lot today. Thanks for the inspiration.
 

Attachments

  • admin.png
    admin.png
    125.8 KB · Views: 448
  • webinar.png
    webinar.png
    135.7 KB · Views: 405
  • wordwrap.png
    wordwrap.png
    132.6 KB · Views: 398
Bauer,
Thanks for all that work. It's given me a different way of looking at things.

As for displaying the icon, I found this VERY old thread:
http://fabrikar.com/forums/index.ph...element-in-table-view-solved.5954/#post-29851
That seems to cover the task; however, the code is very old and doesn't match-up with the current Fabrik layouts.

BTW ... it doesn't look like the fileupload element was JUST for images, because it does work with other files (although that might not have been the 'intent' of the element).

It would really be nice if this element were updated to automatically work for all files.

I also tried to find any documentation on how to modify (or create) custom Fabrik elements, but I couldn't. I wouldn't think it would be that hard to add the functionality directly into the element (as noted in the above old thread). That would make this element much more useful. (although I've already used it on almost every Fabrik set-up I have - they all need fileuploads at least somewhere).
 
I think it was Hugh (or Rob?) that mentioned to me once that yes, this plugin was originally written (by a 3rd party) for image uploads.

Like I said chris, I always enjoy working out other user's challenges - especially when it's something I know I will probably eventually need. My motto is "There's always more than one wat to skin a cat". Sort of a sick 'old saying' , but it fits.

Actually - other than just changing the 'row-fluid' class, that whole default_group.php file could be reworked to eliminate some of the needed css in my example.

There are 2 things that always bugged me about the default templates that come with fabrik...
1. Because padding is included as part of the css for the 'control-group' container that holds the element , even hidden elements are left 'shown' as empty space.
2. There is no direct way to easily identify that parent container for the element (to manipulate using css or javascript).

So I add the element id (prefaced with "elwrap_") as a class to the actual container holding the element (be it a row-fluid or row-auto div) - as well as the hidden style.
 
Yeah, I agree with you on 'you never know when you'll need it'. (And thanks for taking the time to share all that code!).
In my case, this specific issue (and the uploadfile element) is something that I know I will need to use on at least 2 other projects that I'm supposed to start next week.
And in those cases I need to have multiple different upload file types (doc, pdf, xls, ppt, etc.); all within the same uploadfile element - so I'm really trying to figure out a way to easily display the proper icon for the file. So the ':before' css option won't work for me (unfortunately). And I'd really like to just have one 'type' of modification like this (rather than modify it one way for one element, a different way for a different element/use).

This would be SO much better if there were some docs on the actual element file structure. This functionality should be added to the element itself (with a path to the icons). If you (or anyone) know of any documentation/tips on creating/modifying elements I'd really appreciate learning from someone else that has done this before :).
 
Here's the file icons in a zip file. Now it's just a matter of knowing where to add the code. I'll work on that. Then I can pass on proposed changes to the code and maybe someone will make our dreams come true for us. ;)
 

Attachments

  • fileimages.zip
    85.2 KB · Views: 225
Bauer,

I seem to have created 'thread scope creep' in this topic. We've gone from how to display the repeating group (which you've already helped resolve) to changing the function of the fileupload element.

I've moved this to a new thread to help keep things focused (and help others find this in the future):
http://fabrikar.com/forums/index.ph...lement-displaying-different-file-types.40365/

I asked there to see if anyone else has any ideas where we could change the code in the element itself.

Let's see if anyone is able to suggest where to add the code.
 
That's great - but I can't participate there. You'd think they'd give me a free pass for all my time I've put into this extension.:(

The only reason I never used this plugin before is because it didn't do what I needed at the time. I wanted to be able to upload files to a personal user folder outside the web root. I ended up using jSmallfob for that - which makes the support you get here look like something you'd get from a Mercedes dealer. (I don't think Eric has touched that code in years - but I tweaked it a bit and it does what I need.) Yet your problem and scenario got me to realize just how it could be used for downloads as well.

As it turns out, most of what you/we want is already covered (different icons for different file types) in the code for the fileuploads plugin. The only real problem is that the images for the other file types don't exist in the files supplied by fabrik - so it doesn't display one. The other thing is that those are just 16x16 images - great for the list - but not so great for forms.

So I copied all the filetype icons I provided in that last zip file into a 'file_icons' subfolder in media/com_fabrik/images - just to keep them all separate and easier to find if other plugins need to use them.

You can try these changes if you want. It's a matter of 10-15 minutes of cut n paste.
These were some pretty simple basic changes that I think will make the upload element a bit more 'user-friendly' - and covers everything you needed, and I can use as well. I have tested the changes and it seems to work fine. Now we only need to convince someone to add it to github.

I just added these 3 new 'Display' tab configuration options to plugins/fabrik_element/fileupload/fields.xml
(IN <fieldset name="plg-fileupload-display" label="PLG_ELEMENT_FILEUPLOAD_DISPLAY"> )
1. 'Show Icon' - Adds an option to include a large file-type icon with the element in form/detail view.
2. 'Icon Position' - Determines if the icon should be included inline (to the left of the file name) or by itself above the filename, like in your example.
3. 'Show Label' - Determines if the element label is shown or hidden. Especially in a case where you are showing nothing but a series of files in a repeat group like your example - it would look silly to keep showing the same label.
Code:
<field name="fu_show_icon"
    type="radio"
    class="btn-group"
    default="0"
    description="PLG_ELEMENT_FILEUPLOAD_SHOW_ICON"
    label="PLG_ELEMENT_FILEUPLOAD_SHOW_ICON_LABEL">
        <option value="0">JNO</option>
        <option value="1">JYES</option>
</field>
<field name="fu_icon_position"
    type="radio"
    class="btn-group"
    default="0"
    description="PLG_ELEMENT_FILEUPLOAD_ICON_POSITION"
    label="PLG_ELEMENT_FILEUPLOAD_SHOW_ICON_POSITION_LABEL">
        <option value="0">PLG_ELEMENT_FILEUPLOAD_LEFT</option>
        <option value="1">PLG_ELEMENT_FILEUPLOAD_TOP</option>
</field>
<field name="fu_showlabel"
    type="radio"
    class="btn-group"
    default="1"
    description="PLG_ELEMENT_FILEUPLOAD_SHOW_LABEL"
    label="PLG_ELEMENT_FILEUPLOAD_SHOW_LABEL_LABEL">
        <option value="0">JNO</option>
        <option value="1">JYES</option>
</field>
Added these new language vars to plugins/fabrik_element/fileupload/language/en-GB/en-GB.plg_fabrik_element_fileupload.ini
Code:
PLG_ELEMENT_FILEUPLOAD_SHOW_ICON="Display large icon for known file types in Form/Details view"
PLG_ELEMENT_FILEUPLOAD_SHOW_ICON_LABEL="Show icon"
PLG_ELEMENT_FILEUPLOAD_ICON_POSITION="Position of large icon in Form/Details view"
PLG_ELEMENT_FILEUPLOAD_SHOW_ICON_POSITION_LABEL="Icon position"
PLG_ELEMENT_FILEUPLOAD_SHOW_LABEL="Show element label"
PLG_ELEMENT_FILEUPLOAD_SHOW_LABEL_LABEL="Show label"
PLG_ELEMENT_FILEUPLOAD_TOP="Top"
PLG_ELEMENT_FILEUPLOAD_LEFT="Left"
Of all the models used by the fileupload element plugin - it looks like PDF is the only one where these new features would be used. (i.e. Showing a larger file type icon in the Form or Details view) So I only made changes (as noted in the code) to the render function in plugins/fabrik_element/fileupload/models/file.php and plugins/fabrik_element/fileupload/models/pdf.php
IN plugins/fabrik_element/fileupload/models/file.php...
PHP:
    public function render(&$model, &$params, $file)
    {
        jimport('joomla.filesystem.file');
   
        /*
        * $$$ hugh - TESTING - if $file is empty, we're going to just build an empty bit of DOM
        * which can then be filled in with the selected image using HTML5 in browser.
        */
        if (empty($file))
        {
            if ($params->get('make_thumbnail', false))
            {
                $maxWidth = $params->get('thumb_max_width', 125);
                $maxHeight = $params->get('thumb_max_height', 125);
                $this->output .= '<img style="width: ' . $maxWidth . 'px;" src="" alt=""></a>';
            }   
        }
        else
        {
            $filename = basename($file);
            $filename = strip_tags($filename);
            $ext = JFile::getExt($filename);
 
            if (!strstr($file, 'http://') && !strstr($file, 'https://'))
            {
                // $$$rob only add in livesite if we don't already have a full url (e.g. from amazons3)
 
                // Trim / or \ off the start of $file
                $file = JString::ltrim($file, '/\\');
                $file = COM_FABRIK_LIVESITE . $file;
            }
 
            $file = str_replace("\\", "/", $file);
            $file = $model->storage->preRenderPath($file);
            $thumb_path = COM_FABRIK_BASE . 'media/com_fabrik/images/' . $ext . '.png';
// ADDED LINE for label variable
// which replaces underscores with spaces and removes extension...       
            $fileLabel = str_replace('_',' ',substr($filename,0,strrpos($filename,'.')));
            // $$$ hugh - using 'make_thumbnail' to mean 'use default $ext.png as an icon
            // instead of just putting the filename.
            if ($params->get('make_thumbnail', false) && JFile::exists($thumb_path))
            {
                $thumb_file = COM_FABRIK_LIVESITE . "media/com_fabrik/images/" . $ext . ".png";
                $this->output .= "<a class=\"download-archive fabrik-filetype-$ext\" title=\"$file\" href=\"$file\">
                <img src=\"$thumb_file\" alt=\"$filename\"></a>";
            }
// ADDED ELSEIF   
            elseif($params->get('fu_show_icon')==1)
            {
                $jinput = JFactory::getApplication()->input;
                $view = $jinput->get('view');
                $ext = substr($filename,strrpos($filename,'.')+1);
                if($view=='list'){
                    $thumb_path = COM_FABRIK_BASE . 'media/com_fabrik/images/file_icons/' . $ext . '.png';
                    $thumb_url = file_exists($thumb_path) ? '<img src="' . COM_FABRIK_LIVESITE . 'media/com_fabrik/images/file_icons/' . $ext . '.png"
                    alt="' . $filename . '" width="16px" height="16px" /> ' : '';
                }
                else
                {
                    $img_break = $params->get('fu_icon_position')==1 ? '<br />' : '&nbsp;';
                    $thumb_path = COM_FABRIK_BASE . 'media/com_fabrik/images/file_icons/' . $ext . '.png';
                    $thumb_url = file_exists($thumb_path) ? '<img style="vertical-align: middle; margin-bottom: 4px;" src="'
                    . COM_FABRIK_LIVESITE . 'media/com_fabrik/images/file_icons/' . $ext . '.png" alt="' . $filename . '" />'.$img_break : '';
           
                }
                $fileLabel = $thumb_url.$fileLabel;   
                $this->output .= '<a class="download-archive fabrik-filetype-'.$ext.'" title="'.$file.'" href="'.$file.'">' . $fileLabel . '</a>';
            }       
            else
            {
//                $this->output .= "<a class=\"download-archive fabrik-filetype-$ext\" title=\"$file\" href=\"$file\">" . $filename . "</a>";
                $this->output .= '<a class="download-archive fabrik-filetype-'.$ext.'" title="'.$file.'" href="'.$file.'">' . $fileLabel . '</a>';
            }
        }
    }
IN plugins/fabrik_element/fileupload/models/pdf.php
PHP:
    public function render(&$model, &$params, $file)
    {
        jimport('joomla.filesystem.file');
        $filename = basename($file);
        $filename = strip_tags($filename);
        $ext = JFile::getExt($filename);
        if (!strstr($file, 'http://') && !strstr($file, 'https://'))
        {
            // $$$rob only add in livesite if we dont already have a full url (e.g. from amazons3)
            // $$$ hugh trim / or \ off the start of $file
            $file = JString::ltrim($file, '/\\');
            $file = COM_FABRIK_LIVESITE . $file;
        }
        $file = str_replace("\\", "/", $file);
        $file = $model->storage->preRenderPath($file);
        $this->output = '<a class="download-archive fabrik-filetype-' . $ext . '" title="' . $filename . '" href="' . $file . '">';
        if ($thumb_file = $this->getThumbnail($model, $params, $file))
        {
            $filename = '<img src="' . $thumb_file . '" alt="' . $filename . '" />';
        }
// ADDED ELSEIF   
        elseif($params->get('fu_show_icon')==1)
        {
            $ext = substr($filename,strrpos($filename,'.')+1);
            $img_break = $params->get('fu_icon_position')==1 ? '<br />' : '&nbsp;';
            $thumb_path = COM_FABRIK_BASE . 'media/com_fabrik/images/file_icons/' . $ext . '.png';
            $thumb_url = file_exists($thumb_path) ? '<img style="vertical-align: middle; margin-bottom: 4px;" src="' . COM_FABRIK_LIVESITE . 'media/com_fabrik/images/file_icons/' . $ext . '.png" alt="' . $filename . '" />'.$img_break : '';
            $filename = $thumb_url.' '.str_replace('_',' ',substr($filename,0,strrpos($filename,'.')));   
        }
        $this->output .= $filename . '</a>';
    }
 
Thinking about this - I'm not sure if it will fly - because as usual there's more to this than just my or your needs. But I figure it's at least worth passing it by the developers who understand the big picture quite a bit more than you or I.

Whether or not to remove the extension from the file name, or add spaces back where the underscores were added, might be something that might be needed as 2 other element configuration 'Display' options. But I would think that, most of the time, anyone would want to remove the underscores - and there is no need to show the extension if you are already displaying that icon for the file extension type.
=====
In a related issue that is wider than just this plugin...
Even when a label is set as 'hidden' in elements that allow it, the space used by the label will still be included in the html
because of this line in components/com_fabrik/models/element.php (line 1619) which always adds a space if the label is an empty string.
// $labelText = $labelText == '' ? '&nbsp;' : $labelText;
Why not just replace that line with?...
if ($labelText == '') return '';

If that space is included, the vertical space taken up in the form will be the line-height/font-size of the blank space PLUS any margin or padding. Yet I can understand how sometimes you might want the element itself to line up across in parallel with any adjoining elements, so maybe the best solution would be to include a 2nd option - In addition (or in lieu of) 'Hide label' - 'Remove label'. 'Hide label' params would do as it is now - and 'Remove label' would do as I show above - i.e. return an empty string so that the label is not even rendered in html.

...which could be handled by adding these 2 functions at the bottom of the fileupload.php file (borrowed from other element that has a hide label option) - and after changing that line in the element.php file
PHP:
    /**
    * Get the element's HTML label
    *
    * [USER=20939]param[/USER]  int    $repeatCounter  Group repeat counter
    * [USER=20939]param[/USER]  string  $tmpl          Form template
    *
    * @return  string  label
    */
    public function getLabel($repeatCounter = 0, $tmpl = '')
    {
        $params = $this->getParams();
        $element = $this->getElement();
        if (!$params->get('fu_showlabel', true))
        {
            $element->label = "";
            $element->label_raw = "";
        } 
 
        return parent::getLabel($repeatCounter, $tmpl);
    }
    /**
    * Get the element's raw label (used for details view, not wrapped in <label> tags
    *
    * @return  string  Label
    */
    protected function getRawLabel()
    {
        if (!$this->getParams()->get('fu_showlabel', true))
        {
            return '';
        }
        return parent::getRawLabel();
    }

I've suggested numerous times that there are a few configuration options that should be standard for ALL element plugins. Hide label - Readonly - and Hidden to name a few.

Oh, and I forgot to include these icons - from that last zip file I attached, batch-converted to 16x16 files. These can just be copied into the media/com_fabrik/images folder - and then most all file types will show an icon in a list (even without changing any code). IMO, all those image files should be included with fabrik - or the larger 48x48 images, and let them be dynamically resized to 16x16 when rendered in a list.
 

Attachments

  • 16x16.zip
    46.5 KB · Views: 223
Bauer, thanks again for digging through and suggesting code.
I didn't catch before that you were only at the 'community' level.
Having worked on the support side of extension development (actually, I oversaw support for a major Joomla extension for a few years), I understand their support structure. I also realize that there are always some shortcomings for any system.
However, I believe that any of us can do a pull request on the github repository and then post code changes for consideration (I say that in theory, I haven't tried that with Fabrik, so I don't know exactly how it would work).

As far as your specific changes, as long as the changes don't 'break' existing functionality (which it doesn't appear that they would - although I haven't gone through them in detail yet), then I would think they would be added.

Right now I'm in the process of just dealing with my needs the original way (for this weeks project) by just creating some custom template display options - which I think (after I document it) will be valuable for others - for those times when you just need something displayed they way you want it and quick (without modifying an element).

But I'll get back to testing this code and see if we can get some of this functionality added to the core element soon.
[i.e. I may be 'silent' on this for a few days, but I will be back.]

If anyone else is 'lurking' and wants to join in this process, I think it would be helplful to have input from others (and others willing to test).
 
OK. I understand. Likewise, my visibility around here is always influenced by many other factors.
One thing I discovered since my last post (where I suggested removing the 'control-group' div entirely if you are creating an inline auto-width template, since it's really not needed in that case) is that if you remove the control-group div there will be javascript error. I have since edited that post to nix that suggestion.:rolleyes:
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top