@param Widget $widget

@return string
555143
protected function getHash(Widget $widget)
    {
        $hash = null;
        if (!$widget instanceof WidgetSlotInterface) {
            if ($widget->getMode() == Widget::MODE_BUSINESS_ENTITY
                && ($entity = $widget->getEntity())
                && method_exists($widget->getEntity(), 'getUpdatedAt')) {
                $hash = $this->generateBusinessEntityHash($widget);
            } elseif ($widget->getMode() == Widget::MODE_STATIC) {
                $hash = $this->generateHash($widget);
            }
        }

        return $hash;
    }
1141987
public function loadRichTextEditor($buffer, Widget $widget)
    {
        if ((null === $widget->rte)
            || ((0 !== (\strncmp($widget->rte, 'tiny', 4)))
                && (0 !== \strncmp($widget->rte, 'ace', 3)))
        ) {
            return $buffer;
        }

        $backendAdapter        = $this->framework->getAdapter(Backend::class);
        $templateLoaderAdapter = $this->framework->getAdapter(TemplateLoader::class);

        [$file, $type] = \explode('|', $widget->rte);

        $templateName = 'be_' . $file;
        // This test if the rich text editor template exist.
        $templateLoaderAdapter->getDefaultPath($templateName, 'html5');

        $template = new ContaoBackendViewTemplate($templateName);
        $template
            ->set('selector', 'ctrl_' . $widget->id)
            ->set('type', $type);

        if (0 !== \strncmp($widget->rte, 'tiny', 4)) {
            /** @deprecated Deprecated since Contao 4.0, to be removed in Contao 5.0 */
            $template->set('language', $backendAdapter->getTinyMceLanguage());
        }

        $buffer .= $template->parse();

        return $buffer;
    }
1277334
private String getWidgetName(String settingsWidget) {

        if (WIDGET_MAPPINGS.containsKey(settingsWidget)) {
            return WIDGET_MAPPINGS.get(settingsWidget).getName();
        } else {
            return CmsInputWidget.class.getName();
        }
    }
1115011
public function parameters($id, $widget)
    {
        $widget    = Widget::withoutGlobalScope('menu_assignment')->findOrNew($widget);
        $extension = $this->repository->findOrFail($id);
        $formView  = $extension->param('form');

        if (view()->exists($formView)) {
            return view($formView, compact('widget'));
        }

        return view('widgets.partials.none');
    }
1170461
public function getWidget($widgetType, $widgetId, User $user)
    {
        /** @var \Icap\PortfolioBundle\Repository\Widget\AbstractWidgetRepository $abstractWidgetRepository */
        $abstractWidgetRepository = $this->entityManager->getRepository('IcapPortfolioBundle:Widget\AbstractWidget');
        $widget = $abstractWidgetRepository->findOneByWidgetType($widgetType, $widgetId, $user);

        return $widget;
    }
763958
private function persistWidget($widgetConfiguration, Widget $widget)
    {
        $widget->setName($widgetConfiguration['name']);
        $widget->setContext(isset($widgetConfiguration['context']) ? $widgetConfiguration['context'] : []);
        $widget->setSources(isset($widgetConfiguration['sources']) ? $widgetConfiguration['sources'] : []);
        $widget->setClass(isset($widgetConfiguration['class']) ? $widgetConfiguration['class'] : null);
        $widget->setExportable($widgetConfiguration['exportable']);
        $widget->setTags(isset($widgetConfiguration['tags']) ? $widgetConfiguration['tags'] : []);

        $this->em->persist($widget);

        return $widget;
    }
1344563
public function getWidgetContent(int $id): string
    {
        $widget = $this->repository->getItemByID($id);

        if ($widget->id) {
            $view = $widget->view;

            if (view()->exists($view)) {
                $params = $widget->params;
                return view($view, array_merge(is_array($params) ? $params : [], ['widget' => $widget]));
            }
        }

        return '';
    }
425799
public static function get_widget_instance( $widget_id ) {
		global $wp_registered_widgets;

		if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) {
			return false;
		}

		$model = $wp_registered_widgets[ $widget_id ]['callback'][0];

		if ( ! is_a( $model, 'Lean\Widgets\Models\AbstractWidget' ) ) {
			return false;
		}

		$key = $wp_registered_widgets[ $widget_id ]['params'][0]['number'];

		$model->_set( $key );

		return $model;
	}
32159
public function addWidget($widget)
    {
        $this->widgets->add($widget); 
        $this->layoutWidget($widget);
        return $this;
    }
1178132
public function addWidget(WidgetPageWidget $widget)
    {
        if ($this->widgets->contains($widget) === false) {
            $widget->setWidgetPage($this);
            $this->widgets->add($widget);
        }

        return $this;
    }
392855
public function getWidgetQueryContent(Widget $widget)
    {
        $parameters = $this->getWidgetStaticContent($widget);

        $entity = $this->getWidgetQueryBuilder($widget)
                        ->setMaxResults(1)
                        ->getQuery()
                        ->getOneOrNullResult();

        $fields = $widget->getFields();
        $this->populateParametersWithWidgetFields($widget, $entity, $parameters);

        return $parameters;
    }
223255
public function setWidget(Widget $widget)
    {
        $this->widget = $widget;

        $this->widget->setOwner($this);

        return $this;
    }
119148
public function getWidgetName(Widget $widget)
    {
        $widgets = $this->container->getParameter('victoire_core.widgets');
        foreach ($widgets as $widgetParams) {
            if ($widgetParams['class'] === ClassUtils::getClass($widget)) {
                return $widgetParams['name'];
            }
        }

        throw new \Exception('Widget name not found for widget '.get_class($widget).'. Is this widget right declared in AppKernel ?');
    }
74635
public function getWidgetData(AbstractWidget $widget)
    {
        $widgetViews = array(
            'views' => array('view' => $this->getView($widget, $widget->getWidgetType())),
        );

        return $widget->getCommonData() + $widgetViews + $widget->getData();
    }
1065678
private function generateWidget(Widget $widget)
    {
        $environment   = $this->getEnvironment();
        $inputProvider = $environment->getInputProvider();

        if (('select' !== $inputProvider->getParameter('act'))
            && ('edit' !== $inputProvider->getParameter('mode'))
        ) {
            echo $widget->generate();

            return;
        }

        $model = $environment->getDataProvider()->getEmptyModel();
        $model->setProperty($widget->name, $widget->value);

        echo (new ContaoWidgetManager($environment, $model))->getWidget($inputProvider->getValue('name'))->generate();
    }
155138
public function getWidgetBusinessEntityContent(Widget $widget)
    {
        $entity = $widget->getEntity();
        $parameters = $this->getWidgetStaticContent($widget);

        $this->populateParametersWithWidgetFields($widget, $entity, $parameters);

        return $parameters;
    }
845795
public function render(): string {
		$out = $this->before();
		foreach ( $this->_widgets as $widget ) {
			$out .= $widget->render();
		}
		$out .= $this->after();

		$this->content = $out;

		return $this->template ? render( $this->template, $this->getAttributes() ) : $out;
	}