/*
Register widgets
172336
protected function registerBackendWidgets()
    {
        WidgetManager::instance()->registerFormWidgets(function ($manager) {
            $manager->registerFormWidget('Backend\FormWidgets\CodeEditor', 'codeeditor');
            $manager->registerFormWidget('Backend\FormWidgets\RichEditor', 'richeditor');
            $manager->registerFormWidget('Backend\FormWidgets\MarkdownEditor', 'markdown');
            $manager->registerFormWidget('Backend\FormWidgets\FileUpload', 'fileupload');
            $manager->registerFormWidget('Backend\FormWidgets\Relation', 'relation');
            $manager->registerFormWidget('Backend\FormWidgets\DatePicker', 'datepicker');
            $manager->registerFormWidget('Backend\FormWidgets\TimePicker', 'timepicker');
            $manager->registerFormWidget('Backend\FormWidgets\ColorPicker', 'colorpicker');
            $manager->registerFormWidget('Backend\FormWidgets\DataTable', 'datatable');
            $manager->registerFormWidget('Backend\FormWidgets\RecordFinder', 'recordfinder');
            $manager->registerFormWidget('Backend\FormWidgets\Repeater', 'repeater');
            $manager->registerFormWidget('Backend\FormWidgets\TagList', 'taglist');
            $manager->registerFormWidget('Backend\FormWidgets\MediaFinder', 'mediafinder');
            $manager->registerFormWidget('Backend\FormWidgets\NestedForm', 'nestedform');
        });
    }
1137037
protected function registerWidgets()
    {
        $default_widgets = ['LaravelAdminPanel\\Widgets\\UserDimmer', 'LaravelAdminPanel\\Widgets\\PostDimmer', 'LaravelAdminPanel\\Widgets\\PageDimmer'];
        $widgets = config('admin.dashboard.widgets', $default_widgets);

        foreach ($widgets as $widget) {
            Widget::group('admin::dimmers')->addWidget($widget);
        }
    }
291486
protected function registerWidgetsFinder()
    {
        $this->app->singleton('antares.ui-components.finder', function($app) {
            $config = [
                'path.app'  => $app->make('path'),
                'path.base' => $app->make('path.base'),
            ];

            return new Finder($app->make('files'), $config);
        });
    }
819441
public function registerJs() {
			if ( Yii::$app->request->isAjax ) {
				return;
			}
			$js = <<<'JS'
			$(document.body).on("click", "a.toggle-column", function(e) {
			    e.preventDefault();
			    $.post($(this).attr("href"), function(data) {
			        var pjaxId = $(e.target).closest("[data-pjax-container]").attr("id");
			        $.pjax.reload({container:"#" + pjaxId});
			    });
    return false;
});
JS;
			$this->grid->view->registerJs( $js, View::POS_READY, 'pheme-toggle-column' );
		}
70131
protected function registerSidebars()
    {
        do_action("before_theme_register_sidebars");

        foreach ($this->getConfig("sidebars") as $id => $sidebar):
            add_action("widgets_init", function () use ($id, $sidebar) {
                register_sidebar(array(
                    'name' => __($sidebar["name"], 'sections'),
                    'id' => $id,
                    'description' => __($sidebar["description"], 'sections'),
                    'before_widget' => $sidebar["before_widget"],
                    'after_widget' => $sidebar["after_widget"],
                    'before_title' => $sidebar["before_title"],
                    'after_title' => $sidebar["after_title"]
                ));
            });
        endforeach;

        do_action("after_theme_register_sidebars");
    }
217341
public function registerComponents()
    {
        // Check objects
        if (empty($this->paths)) {
            return;
        }

        // Work on file paths
        foreach ($this->paths as $action => $actionPaths) {
            // Work on paths
            $actionPaths = !is_array($actionPaths) ? [$actionPaths] : $actionPaths;

            // Work on file name
            $filepath = OL_ZEUS_CACHE.$this->classname.'-'.$action.'-components.php';

            // Check cache file
            if (!file_exists($filepath)) {
                // Store all in cache file
                ClassMapGenerator::dump($actionPaths, $filepath);
            }

            $classmap = include_once $filepath;

            // Instanciate new ClassLoader to load and register components
            $loader = new MapClassLoader($classmap);
            $loader->register();

            // Get current hook
            $current = current_filter();
            $function = in_array($action, ['widgets_init']) ? 'registerWidgets' : 'registerObjects';

            // Register post type
            if ($action === $current) {
                // Already inside an `init` action
                $this->$function($classmap);
            } else {
                // Outside an `init` action
                add_action($action, function () use ($classmap, $function) {
                    $this->$function($classmap);
                });
            }
        }
    }
277318
public function registerPlugin()
    {
        $view = $this->getView();
        $options = !empty($this->options) ? Json::encode($this->options) : '';
        $js = <<< JS
            function Noty(widgetId, options) {
                var finalOptions = $.extend({}, $options, options);
                return noty(finalOptions);
            }
JS;

        $view->registerJs($js, View::POS_END);
    }
289456
protected function registerBackendReportWidgets()
    {
        WidgetManager::instance()->registerReportWidgets(function ($manager) {
            $manager->registerReportWidget(\Cms\ReportWidgets\ActiveTheme::class, [
                'label'   => 'cms::lang.dashboard.active_theme.widget_title_default',
                'context' => 'dashboard'
            ]);
        });
    }
146888
def register_widgets():
    

    # special case
    # register external apps
    Page.create_content_type(
        ApplicationWidget, APPLICATIONS=settings.APPLICATION_CHOICES)

    for _optgroup, _widgets in six.iteritems(settings.WIDGETS):
        optgroup = _optgroup if _optgroup != 'ungrouped' else None
        for widget in _widgets:

            kwargs = {'optgroup': optgroup}

            # load class from strings
            if isinstance(widget, six.string_types):
                try:
                    WidgetCls = get_class_from_string(widget)
                except:
                    exc_info = sys.exc_info()
                    raise six.reraise(*exc_info)
            elif isinstance(widget, tuple):
                try:
                    WidgetCls = get_class_from_string(widget[0])
                    if len(widget) > 1:
                        kwargs.update(widget[1])
                except Exception as e:
                    raise Exception('%s: %s' % (mod, e))
            else:
                WidgetCls = widget

            Page.create_content_type(
                WidgetCls, **kwargs)
1218208
public void registerExternalWidgets(
        List<CmsExternalWidgetConfiguration> externalWidgetConfigurations,
        final Command callback) {

        final Set<String> initCalls = new HashSet<String>();
        for (CmsExternalWidgetConfiguration widgetConfiguration : externalWidgetConfigurations) {
            if (!m_widgetRegistry.containsKey(widgetConfiguration.getWidgetName())) {
                for (String cssResource : widgetConfiguration.getCssResourceLinks()) {
                    CmsDomUtil.ensureStyleSheetIncluded(cssResource);
                }
                for (String javaScriptResource : widgetConfiguration.getJavaScriptResourceLinks()) {
                    CmsDomUtil.ensureJavaScriptIncluded(javaScriptResource);
                }
                String initCall = widgetConfiguration.getInitCall();
                if (initCall != null) {
                    initCalls.add(initCall);
                }
            }
        }
        if (initCalls.isEmpty()) {
            callback.execute();
        } else {
            Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {

                /** The number of repeats. */
                private int m_repeats;

                /**
                 * @see com.google.gwt.core.client.Scheduler.RepeatingCommand#execute()
                 */
                public boolean execute() {

                    m_repeats++;
                    Iterator<String> it = initCalls.iterator();
                    while (it.hasNext()) {
                        String initCall = it.next();
                        if (tryInitCall(initCall)) {
                            it.remove();
                        }
                    }
                    if (initCalls.isEmpty()) {
                        callback.execute();
                        return false;
                    } else {
                        if (m_repeats < 100) {
                            return true;
                        } else {
                            showInitCallError(initCalls);
                            return false;
                        }
                    }

                }
            }, 50);
        }
    }
1197055
public function register()
    {
        $this->app['widget'] = $this->app->share(function ($app) {
            $blade = $app['view']->getEngineResolver()->resolve('blade')->getCompiler();

            return new Widget($blade, $app);
        });

        $this->app->booting(function () {
            $loader = AliasLoader::getInstance();
            $loader->alias('Widget', 'Pingpong\Widget\WidgetFacade');

            $file = app_path('widgets.php');

            if (file_exists($file)) {
                include $file;
            }
        });
    }
114906
@Override
    protected void defineWidgets() {

        initModule();

        setKeyPrefix(KEY_PREFIX);

        List destinations = getDestinations();

        addWidget(new CmsWidgetDialogParameter(m_exportpoint, "uri", PAGES[0], new CmsVfsFileWidget()));
        addWidget(
            new CmsWidgetDialogParameter(
                m_exportpoint,
                "configuredDestination",
                PAGES[0],
                new CmsComboWidget(destinations)));
        addWidget(new CmsWidgetDialogParameter(m_exportpoint, "destinationPath", PAGES[0], new CmsDisplayWidget()));

    }
1068438
@Override
    protected void defineWidgets() {

        super.defineWidgets();

        // widgets to display
        if (m_fieldconfiguration.getName() == null) {
            addWidget(new CmsWidgetDialogParameter(m_fieldconfiguration, "name", PAGES[0], new CmsInputWidget()));
        } else {
            addWidget(new CmsWidgetDialogParameter(m_fieldconfiguration, "name", PAGES[0], new CmsDisplayWidget()));
        }
        addWidget(
            new CmsWidgetDialogParameter(
                m_fieldconfiguration,
                "description",
                "",
                PAGES[0],
                new CmsInputWidget(),
                0,
                1));
    }
591154
@Override
    protected void defineWidgets() {

        initModule();

        addWidget(new CmsWidgetDialogParameter(m_dependency, "name", PAGES[0], new CmsDisplayWidget()));
        addWidget(new CmsWidgetDialogParameter(m_dependency, "version.version", PAGES[0], new CmsDisplayWidget()));

    }
320674
@Override
    protected void defineWidgets() {

        // initialize the object to use for the dialog
        initLoginMessageObject();

        setKeyPrefix(KEY_PREFIX);

        // required to read the default values for the optional context parameters for the widgets
        CmsLoginMessage def = new CmsLoginMessage();

        addWidget(new CmsWidgetDialogParameter(m_loginMessage, "enabled", PAGES[0], new CmsCheckboxWidget()));
        addWidget(new CmsWidgetDialogParameter(m_loginMessage, "message", PAGES[0], new CmsTextareaWidget()));
        addWidget(new CmsWidgetDialogParameter(m_loginMessage, "loginForbidden", PAGES[0], new CmsCheckboxWidget()));
        addWidget(
            new CmsWidgetDialogParameter(
                m_loginMessage,
                "timeStart",
                String.valueOf(def.getTimeStart()),
                PAGES[0],
                new CmsCalendarWidget(),
                0,
                1));
        addWidget(
            new CmsWidgetDialogParameter(
                m_loginMessage,
                "timeEnd",
                String.valueOf(def.getTimeEnd()),
                PAGES[0],
                new CmsCalendarWidget(),
                0,
                1));
    }
1309728
protected function registerAssets()
    {
        $view = $this->getView();
        MarkdownEditorAsset::register($view);
        $varName = Inflector::variablize('editor_' . $this->id);
        $script = "var {$varName} = new SimpleMDE(" . $this->getEditorOptions() . ');';
        $view->registerJs($script);
        $css = <<<CSS
.wonail-markdown{z-index:{$this->zIndex};}
.wonail-markdown .editor-toolbar.fullscreen{z-index:{$this->zIndex}}
.wonail-markdown .CodeMirror-fullscreen{z-index: {$this->zIndex}}
.wonail-markdown .editor-statusbar{z-index: {$this->zIndex}}
CSS;
        $view->registerCss($css);
    }
65547
private static function register_widget( $widget_class ) {
		register_widget( $widget_class );

		$callback = [ $widget_class, 'post_registration' ];
		if ( is_callable( $callback, true ) ) {
			call_user_func( $callback );
		}
	}