Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block plugins #196

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Block plugins #196

wants to merge 5 commits into from

Conversation

tgloeggl
Copy link
Member

SImpler Mechanismus, um Courseware-Blöcke durch Plugins hinzufügen zu können.
Es gibt ein paar Einschränkungen:

  • Blöcke dürfen keine less-Stylesheets verwenden (nur reines CSS) oder das Plugin lädt die less-Datei selbst
  • Die JS-Dateien eines solchen Plugin-Blocks müssen angepasst werden, da webpack nicht darüber läuft. Um auf die Module wie AuthorView, StudenView, block_types.add(...) etc. zuzugreifen, gibt es das globale Objekt "courseware", welches diese Module enthält.

Um einen Block zu registrieren, schreibt man sich für die entsprechende Notification ein:

NotificationCenter::addObserver('MyPluginClass', 'addBlocks', 'CoursewareRegisterBlocks');

In der Methode addBlocks steht dann folgendes:

public static function addBlocks($course_id)
{
    Courseware::addBlock('MyPluginClass', 'blocks/MyBlock');
}

Beispielhafte Verwendung siehe:
https://github.com/elan-ev/studip-opencast-plugin/tree/opencast-courseware-block/blocks/OpenCastBlock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant