Good day everybody,
I’m using vuejs3 for my frontend deployed with npm. So I was wondering if there is a way to “inject” the actual concrete file manager in my frontend?
// this is the file manager I meant:
$alh = $app->make(‘helper/concrete/file_manager’);
$alh->file($inputID, $inputName, $chooseText, $preselectedFile = null, $args = );
One solution we found was to render the file manager on the PHP side, which is also where the Vue script is rendered. And connect from the spa using a mutation-observer + triggers.
But could there be a better, cleaner solution?
I look forward to your opinions and ideas.
Thanks in advance.
Interesting question @jwhl, let me do some research and get back to you.
By contrast, the frontend file picker component is definitely a Vue JS component. If you want you to integrate the concrete file picker into your custom Vue application I would try something like the following (note: these examples use the user input but the principals are generally the same)
- Make sure your custom application uses
@concretecms/bedrock as a dependency.
- In your custom Vue application, import the component:
import ConcreteUserInput from '@concretecms/bedrock/assets/cms/components/form/ConcreteUserInput';
- Within the template of the Vue application, reference the component with its props:
<concrete-user-input choose-text="Select User" v-model="authorId" :css-class="this.invalidAuthor ? 'is-invalid' : null"></concrete-user-input>
You’ll also have to include Bedrock assets in your theme.