5.7... image selector not working?

Permalink
I made a block where some pictures must be selected.
What's the problem? I can add an image and the fID will be saved in my db table.
But on editing the block, the value is not set. There only appears a selector for selecting a new image. In 5.6 and older the same thing was no problem and shows the right image.

Loader::helper('concrete/asset_library')->image('pcThumbnail', 'pcThumbnail', t('Choose other Thumbnail'), $row['pcThumbnail']);


Using "file->" in stead of "image->" gave the same results.

Using htmlentities this shows:

<div class="ccm-file-selector" data-file-selector="pcThumbnail"></div> <script type="text/javascript"> $(function() { $('[data-file-selector=pcThumbnail]').concreteFileSelector({'inputName': 'pcThumbnail'}); }); </script>

By the way, the output of pcThumbnail

$row['pcThumbnail']=4


I am missing this value in the output of the function...

So, what's the problem? Is it a bug or...

henkvanhoffen
 
henkvanhoffen replied on at Permalink Reply
henkvanhoffen
I solved this issue myself by looking at the core file code.

In the past you could place just the value of fID (in this case pcThumbnail).
Now you must place the original File property fID.

if ($row['pcThumbnail'] > 0) {
        $pcThumbnail = File::getByID($row['pcThumbnail']);
}


the thumbnail AND fID will be placed:
Loader::helper('concrete/asset_library')->file('pcThumbnail', 'pcThumbnail', t('Choose File'), $pcThumbnail);


the output:
<div class="ccm-file-selector" data-file-selector="pcThumbnail"></div> <script type="text/javascript"> $(function() { $('[data-file-selector=pcThumbnail]').concreteFileSelector({'inputName': 'pcThumbnail', 'fID': 4}); }); </script>