Closed diimpp closed 6 years ago
Hi,
i actually use this feature. Simply add your params in your form builder:
public function buildForm( FormBuilderInterface $builder, array $options )
{
$idLang = $options[ "id_lang" ];
$idModuleInstance = $options[ "modulable" ]->getModuleInstance()->getId();
$folderUpload = UFile::getFolderUpload( $options[ "app" ] );
$pathUpload = UFile::getPathUpload( $options[ "app" ] );
// ------------------------- DECLARE ---------------------------//
$builder->add( 'artContent', FroalaEditorType::class, array(
'property_path' => 'artContent[' . $idLang . ']', //
'label' => 'Contenu', //
'required' => false, //
'saveURL' => "kms_module_text_autosave", //
'saveParams' => array(
"id_module_instance" => $idModuleInstance, //
"id_lang" => $idLang
),
'imageUploadFolder' => $folderUpload,
'imageUploadPath' => $pathUpload,
'fileUploadFolder' => $folderUpload,
'fileUploadPath' => $pathUpload,
) );
}
As you can see i added some infos in the saveParams option.
Then i just retrieve them in my controller:
public function autosaveAction( Request $p_request, Site $p_site )
{
$manager = $this->get( "kms_manager_module_text" );
// ------------------------- DECLARE ---------------------------//
if( $p_request->getMethod() == 'POST' )
{
$manager->autosave(
$p_site, //
$p_request->get( "id_module_instance" ), //
$p_request->get( "id_lang" ), //
$p_request->get( "body" ) );
}
return new Response ();
}
Hope it helps.
@sguionni thank you, Simon! That's really helps, I wasn't aware, that froala option could be provided per instance via form type configuration.
Hey guys,
I've have several instances of froala editor through the site, so I need to different them by ID for auto-save feature.
So how do I do it?
From documentation,
but what's that suppose to mean? It will send some div contents with auto-save data or what? I've tried to put js function into it, css id, whatever, it's just send text value back to me, so in my experience
saveURLParams
andsaveParams
are non-dynamic and therefore useless.Do I miss something? Is there some magic word combination, that will allow to put JS function in bundle configuration?
Really lost with this feature, any help is appreciated.