Converting blocks from Concrete v8 -> v9

Hi

We have a lot of v8 custom blocks I’d like to use in v9.

Some work without issue, but there seems to be an issue with ones that have Image/File fields to do with jQuery.

When you edit the block in v9, you get the error:
$(…).concreteFileSelector is not a function

I guess the core JS has changed. Is there a guide on how to convert these File fields to work in v9?

Thanks
Dave

I’ve been upgrading a lot of sites and I haven’t run into this issue. What is the current code for your file fields? We just use

<?php echo Core::make('helper/concrete/asset_library')->image('ccm-image', 'image', t('Choose Image'), $imgObj); ?>

Thanks for the reply. So the code is from a Repeatable field in a Block Designer custom block:

<div data-file-selector-input-name="<?php echo $view->field('images'); ?>[{{id}}][img]" class="ccm-file-selector ft-image-img-file-selector" data-file-selector-f-id="{{ img }}"></div>

Yeah, underlying code has changed. Those pickers use Vue.js now.
Not sure why file pickers were so harshly deprecated. As far as I remember “old” page pickers are still working (I researched it more than year ago, so something could have been changed).

Anyway for how to create file pickers in javascript, you can check file() method in:

public/concrete/src/Application/Service/FileManager.php

Copy html structure and js code. Replace php variables/code with js equivalent code.

For real, working code, you can see it in action here:

(or just generate block using package, to see how it is working).

Thanks that’s good to know, I’ll have a play with it