Moodle 2.0 & Creating a custom block plugin

Moodle 2.0 & Creating a custom block plugin

Andre Clements發表於
Number of replies: 7

I'm following the instructions at http://docs.moodle.org/en/Development:Blocks#Ready.2C_Set.2C_Go.21 on a reasonably fresh beta of 2.0 at the point where the basic file has been created and I expect to see something about the block in Admin Notifications nothing seems to happen.

Does this work differently in 2.0?

I'm a relative newb to Moodle, the instance is running on XAMPP

Tx

評比平均分數: -
In reply to Andre Clements

Re: Moodle 2.0 & Creating a custom block plugin

Andre Clements發表於

Yes, there has to be a separate version.php file in the block's folder with eg.

<?php

$plugin->version = 20101118;

評比平均分數:Useful (2)
In reply to Andre Clements

Re: Moodle 2.0 & Creating a custom block plugin

Frank Ralf發表於
Hi Andre,

Documentation on Moodle 2.0 development is still in its infancy 眨眼
See Development:Migrating contrib code to 2.0 and User:Frank Ralf/Experience of converting a module to Moodle 2 for some pointers.

hth
Frank
In reply to Frank Ralf

Re: Moodle 2.0 & Creating a custom block plugin

Andre Clements發表於

Thanks Frank

I though'd id' just add a note about the version.php file on that documentation page but it keeps claiming I'm not logged in 複雜

In reply to Andre Clements

Re: Moodle 2.0 & Creating a custom block plugin

Frank Ralf發表於
Hi Andre,

In fact, Moodle Docs is driven by MediaWiki so your Moodle log-in is of no use. You will have to register separately for Moodle Docs to be able to edit pages. Just give it a try. Thanks for contributing!
In reply to Frank Ralf

Re: Moodle 2.0 & Creating a custom block plugin

Nitish Tyagi發表於

Hi,

I am using custom made block in Moodle 2.0 .I am trying to get few images appear in the block but they don't appear and it shows a broken image on the page.

Everything worked just fine in Moodle1.9.Any changes that i need to make in 2.0 for images to appear in the block.

Thank you.

In reply to Nitish Tyagi

Re: Moodle 2.0 & Creating a custom block plugin

Jenny Gray發表於

Have the images moved? Are you getting any errors to go with the broken image?  What happens if you call the image url itself rather than as the src of an <img> tag?

The old way of accessing the pix folder ($CFG->pixpath) is no longer supported.  Instead you might need to use the new $OUTPUT global, which can do something like $OUTPUT->pix_url('i/edit'); to get the url for the edit icon.  The $OUTPUT functions are well documented in the code, so I won't go through it all here, but basically you give the name of the image in the first parameter, and any plug-in location as a second parameter  - so you might need to add your block in there.

In reply to Frank Ralf

Re: Moodle 2.0 & Creating a custom block plugin

Mark Johnson發表於
Core developers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片

Moodle Docs and Moodle.org accounts are integrated - there's no SSO but it's the same username and password.