19declare(strict_types=1);
38 public function render(
Component $component, RenderInterface $default_renderer): string
51 $registry->
register(
"assets/js/dropzone.js");
53 parent::registerResources($registry);
60 $template = $this->
getTemplate(
"tpl.dropzone.html",
true,
true);
61 $template->setVariable(
'MODAL', $default_renderer->render($modal));
62 $template->setVariable(
'CONTENT', $default_renderer->render($dropzone->
getContent()));
63 $template->setVariable(
'WRAPPER_CLASS',
'ui-dropzone-wrapper');
70 return $template->get();
77 $template = $this->
getTemplate(
"tpl.dropzone.html",
true,
true);
78 $template->setVariable(
'MODAL', $default_renderer->render($modal));
79 $template->setCurrentBlock(
'with_message');
80 $template->setVariable(
'MESSAGE', $dropzone->
getMessage());
81 $template->parseCurrentBlock();
84 if (
null !== $upload_button) {
87 $upload_button = $upload_button->withOnClick(
88 $modal->getShowSignal()
91 $template->setVariable(
'BUTTON', $default_renderer->render($upload_button));
95 $template->touchBlock(
'bulky');
103 return $template->get();
108 return $dropzone->withAdditionalOnLoadCode(
static function (
$id) use ($dropzone) {
110 il.UI.Dropzone.init('$id');
112 // @TODO: we need to refactor the signal-management to prevent using jQuery here.
113 $(document).on('{$dropzone->getClearSignal()}', function () {
114 il.UI.Dropzone.removeAllFilesFromQueue('$id');
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
withAdditionalDrop(Signal $signal)
Get a component like this, triggering a signal of another component when files have been dropped.
bindAndApplyJavaScript(FileInterface $dropzone, Template $template)
initClientsideDropzone(FileInterface $dropzone)
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.
renderStandard(Standard $dropzone, RenderInterface $default_renderer)
render(Component $component, RenderInterface $default_renderer)
renderWrapper(Wrapper $dropzone, RenderInterface $default_renderer)
getMessage()
Get the message of this dropzone.
getUploadButton()
Get the button to upload the files to the server.
Base class for all component renderers.
cannotHandleComponent(Component $component)
This method MUST be called by derived component renderers, if.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
A component is the most general form of an entity in the UI.
Registry for resources required by rendered output like Javascript or CSS.
register(string $name)
Add a dependency.
Interface to templating as it is used in the UI framework.
setVariable(string $name, $value)
Set a variable in the current block.
An entity that renders components to a string output.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.