Plugin with another plugin in?

Plugin with another plugin in?

de Dld Dld -
Número de respuestas: 8

Hi, 

It's possible to create a plugin, local, for example, with another plugin in, a block plugin type? Then, you can install a local plugin that it's conected with the new block. 

Promedio de valoraciones: -
En respuesta a Dld Dld

Re: Plugin with another plugin in?

de Tim Hunt -
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers
Yes.

In the version.php file for a plugin, you can declare that it requires another plugin. E.g.

$plugin->dependencies = [
'filter_embedquestion' => 2022032900,
'quiz_answersheets' => 2022033000
];

(And the dependency can be two-way if required, e.g. the block and the local plugin both depend on the other one.)
En respuesta a Tim Hunt

Re: Plugin with another plugin in?

de Dld Dld -
Hi, Tim.

Thanks for your answer! Then, we should create two plugins, one local and one block,right? but ... it would not be possible to create, for example, only a local plugin with the dependencies and the content and characteristics of the block, all within a single plugin, in this case local, right? We would have to install two plugins, right?
En respuesta a Dld Dld

Re: Plugin with another plugin in?

de Davo Smith -
Imagen de Core developers Imagen de Peer reviewers Imagen de Plugin developers
If you don't need any functionality that is specific to 'local' plugins, then you could just create a block plugin and put all the functionality within that.

But if you need a plugin that can be added as a block (to a sidebar or the user dashboard) and be managed alongside other blocks, then it has to be a block plugin - you cannot create a local plugin and ask it to behave like a block.
En respuesta a Davo Smith

Re: Plugin with another plugin in?

de Dld Dld -
Hi, Davo.
Thanks for your answer! The idea was to create a local plugin to modify a form, but I have seen that it makes more sense for it to create a profilefield plugin. In addition, I have seen that a plugin has already been created with the functionality I was looking for: uploading files in the profile of each user. What I would like is to connect this plugin with a block, which will be in each course and that would show the file that the teacher has uploaded within his profile.
I would like to know if it would be possible to perform all these functionalities from a single plugin or it is inevitable to have to create two different plugins
En respuesta a Dld Dld

Re: Plugin with another plugin in?

de Dld Dld -
I found this plugin: OBF displayer block https://moodle.org/plugins/block_obf_displayer?lang=es

This is a block plugin it appears with a dependency, but in the compressed file there is only the block, where do you get the local plugin that requires the entire plugin to be installed?
En respuesta a Dld Dld

Re: Plugin with another plugin in?

de Leon Stringer -
Imagen de Core developers Imagen de Particularly helpful Moodlers

I found this plugin: OBF displayer block https://moodle.org/plugins/block_obf_displayer?lang=es

Are you asking where to get the local_obf plugin? In your link under the Plugin End Of Life heading (near the top of the page) is the link to this.

En respuesta a Leon Stringer

Re: Plugin with another plugin in?

de Dld Dld -
Thanks for your answer, Leon.
When I am going to install the plugin, I get the warning that I have to install the local plugin to keep going. It also gives me the option to install it without having to search it on the internet. I want to know how you do that, just putting the dependency will be enough for Moodle to search for the plugin name and type and that's it? If I create two plugins, from scratch, a local one and a plugin and make them dependent on each other, would I have to upload it on the official Moodle plugin website so that when one installs this same notice? I don't know if I'm explaining
En respuesta a Dld Dld

Re: Plugin with another plugin in?

de Dld Dld -
Thanks you all. The solution is the one they had already discussed before, the use of dependencies. In some cases, when the plugins are uploaded to the Moodle website, we are allowed to install these plugins directly. Instead, if they are plugins that have not been uploaded to the Moodle plugins page, we will have to install them manually, uploading the files