Skip to content
Snippets Groups Projects
Select Git revision
  • 00b4e32c6dcff8ca9b038c59b81e93b11737ac25
  • main default protected
  • step-3263
  • feature/plugins-cli
  • feature/vite
  • step-2484-peerreview
  • biest/issue-5051
  • tests/simplify-jsonapi-tests
  • fix/typo-in-1a70031
  • feature/broadcasting
  • database-seeders-and-factories
  • feature/peer-review-2
  • feature-feedback-jsonapi
  • feature/peerreview
  • feature/balloon-plus
  • feature/stock-images-unsplash
  • tic-2588
  • 5.0
  • 5.2
  • biest/unlock-blocks
  • biest-1514
21 results

RouteMap.php

Blame
  • Forked from Stud.IP / Stud.IP
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    CoursewareExcalidrawBlockPlugin.php 2.21 KiB
    <?php
    
    use Courseware\CoursewarePlugin;
    
    class CoursewareExcalidrawBlockPlugin extends StudIPPlugin implements \SystemPlugin, CoursewarePlugin
    {
        public function __construct()
        {
            parent::__construct();
    
            require_once __DIR__ . '/vendor/autoload.php';
            \PageLayout::addScript($this->getPluginUrl() . '/courseware-block/dist/courseware-whiteboard-block.umd.min.js');
            \PageLayout::addStylesheet($this->getPluginURL() . '/courseware-block/dist/courseware-whiteboard-block.css');
    
            // Render a script tag which sets global javascript variables needed for the plugin to function
            $factory = new Flexi_TemplateFactory(dirname(__FILE__) . '/views');
            $template = $factory->open('coursewareblock/set_global_variables');
            $template->set_attribute('plugin', $this);
            $script = $template->render();
            \PageLayout::addBodyElements($script);
    
            // Add CSS to set the correct icon for the block in the block adder
            $icon = Icon::create('block-canvas');
            \PageLayout::addStyle(
                '.cw-blockadder-item-list .cw-blockadder-item.cw-blockadder-item-excalidraw {
                background-image:url(' . $icon->asImagePath() . ')
            }'
            );
        }
    
        /**
         * Implement this method to register more block types.
         *
         * You get the current list of block types and must return an updated list
         * containing your own block types.
         *
         * @param array $otherBlockTypes the current list of block types
         *
         * @return array the updated list of block types
         */
        public function registerBlockTypes(array $otherBlockTypes): array
        {
            $otherBlockTypes[] = \CoursewareExcalidrawBlock\ExcalidrawBlock::class;
    
            return $otherBlockTypes;
        }
    
        /**
         * Implement this method to register more container types.
         *
         * You get the current list of container types and must return an updated list
         * containing your own container types.
         *
         * @param array $otherContainerTypes the current list of container types
         *
         * @return array the updated list of container types
         */
        public function registerContainerTypes(array $otherContainerTypes): array
        {
            return $otherContainerTypes;
        }
    
    
    }