Figures out which method should be called as the controller.
@param object $widget
@return void
421625
public function normalize($widget): void
    {
        list($controllerMethod, $ctrlClass) = $this->determineDataMethod($widget);

        $this->checkControllerExists($ctrlClass);
        $this->checkDataMethodExists($ctrlClass);

        $widget->controller = $controllerMethod;
    }
491049
@Api
	public static void register(MapWidget mapWidget) {
		if (null == instance) {
			instance = new DynamicUrlController();
		}

		instance.extractHash();
		instance.setMap(mapWidget);
	}
81993
protected function notifyOfAdd($widget)
    {
        if (class_exists('SwatCheckbox') && $widget instanceof SwatCheckbox) {
            $this->widget_class = 'swat-form-field-checkbox';

            // don't set these properties if title_reversed is explicitly set in
            // the xml
            if ($this->title_reversed === null) {
                $this->title_reversed = true;
                $this->show_colon = false;
            }
        } elseif (
            class_exists('SwatSearchEntry') &&
            $widget instanceof SwatSearchEntry
        ) {
            $this->show_colon = false;
        }
    }
810516
protected function sendAddNotifySignal($widget)
    {
        $this->notifyOfAdd($widget);

        if ($this->parent !== null && $this->parent instanceof SwatContainer) {
            $this->parent->sendAddNotifySignal($widget);
        }
    }
168377
public function init()
    {
        parent::init();
        $this->createEmbeddedWidgets();

        $this->check_all->init();

        if ($this->show_check_all && $this->visible) {
            $this->parent->appendRow($this->check_all);
        }
    }
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 );
		}
	}
1178132
public function addWidget(WidgetPageWidget $widget)
    {
        if ($this->widgets->contains($widget) === false) {
            $widget->setWidgetPage($this);
            $this->widgets->add($widget);
        }

        return $this;
    }
38089
public function form(Classes\SCore\Base\Widget $Widget, array $args = []): Classes\SCore\WidgetForm
    {
        return $this->App->Di->get(Classes\SCore\WidgetForm::class, compact('Widget', 'args'));
    }
1348006
public function endWidget()
    {
        $data = (array) $this->run();

        $this->data = array_merge($this->attributes, $data);
    }
880880
public static function end(){
		$script = ob_get_clean();
		$widget = parent::end();
		
		if(preg_match("/^\\s*\\<script\\>(.*)\\<\\/script\\>\\s*$/s", $script, $matches)){
			$script = $matches[1];
		}
		
		$widget->view->registerJs($script, $widget->position, $widget->key);
		
	}
81319
public function init()
    {
        $this->attachBehavior('TbWidget', new TbWidget);
        $this->resolveId();
        if (isset($this->size)) {
            TbArray::defaultValue('size', $this->size, $this->htmlOptions);
        }
    }
1130596
public function onAfterInit(&$controller)
    {
        if ($this->autoInclude() && $js = $this->getPiwik(false)) {
            Requirements::customScript($js, 'piwiktrackingcode');
        }
    }
330537
public function add(WidgetAssetInterface $widget)
    {
        $widget->setKey();
        $this->queue[$widget->getKey()] = $widget;
    }
1058170
public function cmsWidget($widget)
    {
        $widget->setCurrentView($this->currentViewHelper->getCurrentView());

        try {
            $response = $this->widgetRenderer->renderContainer($widget, $widget->getCurrentView());
        } catch (\Exception $ex) {
            $response = $this->widgetExceptionHandler->handle($ex, $widget);
        }

        return $response;
    }
289295
private function initializeWidgetContext()
    {
        $this->widgetContext->setWidgetConfiguration($this->getWidgetConfiguration());
        $this->initializeWidgetIdentifier();
        $this->widgetContext->setControllerObjectName(get_class($this->controller));

        $extensionName = $this->getControllerContext()->getRequest()->getControllerExtensionName();
        $pluginName = $this->getControllerContext()->getRequest()->getPluginName();
        $this->widgetContext->setParentExtensionName($extensionName);
        $this->widgetContext->setParentPluginName($pluginName);
        $pluginNamespace = $this->extensionService->getPluginNamespace($extensionName, $pluginName);
        $this->widgetContext->setParentPluginNamespace($pluginNamespace);
        $this->widgetContext->setWidgetViewHelperClassName(get_class($this));

        if ($this->ajaxWidget === true) {
            $this->ajaxWidgetContextHolder->store($this->widgetContext);
        }
    }
390827
private function initializeWidgetContext()
    {
        if ($this->ajaxWidget === true) {
            if ($this->storeConfigurationInSession === true) {
                $this->ajaxWidgetContextHolder->store($this->widgetContext);
            }
            $this->widgetContext->setAjaxWidgetConfiguration($this->getAjaxWidgetConfiguration());
        }

        $this->widgetContext->setNonAjaxWidgetConfiguration($this->getNonAjaxWidgetConfiguration());
        $this->initializeWidgetIdentifier();

        $controllerObjectName = ($this->controller instanceof DependencyProxy) ? $this->controller->_getClassName() : get_class($this->controller);
        $this->widgetContext->setControllerObjectName($controllerObjectName);
    }
667503
public function delete(View $view, Widget $widget)
    {
        $this->builder->build($view);

        $widgetMap = $widget->getWidgetMap();
        $slot = $widgetMap->getSlot();

        $originalParent = $widgetMap->getParent();
        $originalPosition = $widgetMap->getPosition();

        $children = $this->resolver->getChildren($widgetMap, $view);
        $beforeChild = !empty($children[WidgetMap::POSITION_BEFORE]) ? $children[WidgetMap::POSITION_BEFORE] : null;
        $afterChild = !empty($children[WidgetMap::POSITION_AFTER]) ? $children[WidgetMap::POSITION_AFTER] : null;

        //we remove the widget from the current view
        if ($widgetMap->getView() === $view) {
            // If the widgetMap has substitutes, delete them or transform them in create mode
            if (count($widgetMap->getAllSubstitutes()) > 0) {
                foreach ($widgetMap->getAllSubstitutes() as $substitute) {
                    if ($substitute->getAction() === WidgetMap::ACTION_OVERWRITE) {
                        $substitute->setAction(WidgetMap::ACTION_CREATE);
                        $substitute->setReplaced(null);
                    } else {
                        $view->removeWidgetMap($widgetMap);
                    }
                }
            }
            //remove the widget map from the slot
            $view->removeWidgetMap($widgetMap);
        } else {
            //the widget is owned by another view (a parent)
            //so we add a new widget map that indicates we delete this widget
            $replaceWidgetMap = new WidgetMap();
            $replaceWidgetMap->setAction(WidgetMap::ACTION_DELETE);
            $replaceWidgetMap->addWidget($widget);
            $replaceWidgetMap->setSlot($slot);
            $replaceWidgetMap->setReplaced($widgetMap);

            $view->addWidgetMap($replaceWidgetMap);
        }

        //Move children for current WidgetMap View
        $this->moveChildren($view, $beforeChild, $afterChild, $originalParent, $originalPosition);

        //Move children WidgetMap for children from other View
        foreach ($widgetMap->getChildren() as $child) {
            if ($child->getView() === $view || $child->getView()->getTemplate() === $view) {
                $this->moveWidgetMap($child->getView(), $child, $originalParent, $originalPosition);
            }
        }
    }