Add a widget to the queue.

@param WidgetAssetInterface $widget
330537
public function add(WidgetAssetInterface $widget)
    {
        $widget->setKey();
        $this->queue[$widget->getKey()] = $widget;
    }
1205907
def _add_widget(self, widget):
        
        widgets = self.widgets()
        widgets += [widget]
        self._save_customization(widgets)
284965
public static function displayWidget($widget, $instance = array())
    {
        if (array_key_exists($widget, \Modularity\Module\WpWidget\WpWidget::getWidgetIndexList()) && class_exists($widget)) {
            the_widget($widget, $instance);
        } else {
            echo "Error: Widget prohibited or class not found.";
        }
    }
54836
public int addWidget (Widget widget, int colSpan, String... styles)
    {
        int row = getRowCount();
        setWidget(row, 0, widget, colSpan, styles);
        return row;
    }
129959
protected final void attach(Attachable widget) {
		if (user != null) {
			widget.addTo(user);
		} else {
			if (waitingForUser == null) waitingForUser = new LinkedList<Attachable>();
			waitingForUser.add(widget);
		}
	}
282126
public function addWidget($id)
    {
        if (!(int)$id) return $this;
        $this->widgets[] = $this->application->getWidget( (int)$id );
        return $this;  
    }
870860
public function setWidgets($widgets)
    {
        $this->widgets = $widgets;

        foreach ($widgets as $widget) {
            $widget->setView($this);
        }

        return $this;
    }
274367
public function deleteWidget(Widget $widget, View $view)
    {
        //we update the widget map of the view
        $this->widgetMapBuilder->build($view);
        $widgetMap = $widget->getWidgetMap();
        //the widget is removed only if the current view is the view of the widget
        if ($widgetMap->getView() == $view && $widgetMap->getAction() != WidgetMap::ACTION_DELETE) {
            //we remove the widget
            $this->entityManager->remove($widget);
        }

        //update the view deleting the widget
        $this->widgetMapManager->delete($view, $widget);

        //we update the view
        $this->entityManager->persist($view);

        $this->entityManager->flush();
    }
930360
protected function setWidgets($widgets, string $action)
    {
        // Fix exceptional event name
        $event = $action === 'syncWithoutDetaching' ? 'attach' : $action;

        // Hydrate Widgets
        $widgets = static::hydrateWidgets($widgets)->pluck('id')->toArray();

        // Fire the Widget syncing event
        static::$dispatcher->dispatch("inetstudio.widgets.{$event}ing", [$this, $widgets]);

        // Set Widgets
        $this->widgets()->$action($widgets);

        // Fire the Widget synced event
        static::$dispatcher->dispatch("inetstudio.widgets.{$event}ed", [$this, $widgets]);
    }
825851
public function packEnd(SwatWidget $widget)
    {
        if ($widget->parent !== null) {
            throw new SwatException(
                'Attempting to add a widget that already has a parent.'
            );
        }

        $this->children[] = $widget;
        $widget->parent = $this;

        if ($widget->id !== null) {
            $this->children_by_id[$widget->id] = $widget;
        }

        $this->sendAddNotifySignal($widget);
    }
1289226
public function addWidget(WidgetInterface $widget)
    {
        if ($this->hasWidget($widget)) {
            throw new \InvalidArgumentException(sprintf('Widget "%s" is already registered.', $widget->getName()));
        }

        $this->widgets[$widget->getName()] = $widget;

        return $this;
    }
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;
    }
1265381
public function edit(Widget $widget)
    {
        $widget->type     = old('type', $widget->type);
        $widget->template = old('template', $widget->template);

        return view('administrator.widgets.edit', compact('widget'));
    }
568202
def add_widget(self, widget):
        
        if self._buttons.get(widget):
            return
        btn = self.create_button(widget)
        cb = partial(self.focus_widget, w=widget)
        btn.clicked.connect(cb)
        self.layout().addWidget(btn)
        self._buttons[widget] = btn
997537
private function getWidgetContent(WidgetInterface $widget)
    {
        if (!isset($this->widgetContents[$widget->getName()])) {
            try {
                $this->widgetContents[$widget->getName()] = $widget->getContent();
            } catch (KernelHttpException $ex) {
                throw new HttpException($ex);
            }
        }

        return $this->widgetContents[$widget->getName()];
    }
256915
public static function attachAjaxUpdateEvent($widget)
    {
        $trigger = '$("#'.$widget->id.'").trigger("ajaxUpdate.editable");';

        //check if trigger already inserted by another column
        if(strpos($widget->afterAjaxUpdate, $trigger) !== false) return;

        //inserting trigger
        if(strlen($widget->afterAjaxUpdate)) {
            $orig = $widget->afterAjaxUpdate;
            if(strpos($orig, 'js:')===0) $orig = substr($orig,3);
            $orig = "\n($orig).apply(this, arguments);";
        } else {
            $orig = '';
        }
        $widget->afterAjaxUpdate = "js: function(id, data) {
            $trigger $orig
        }";

        $widget->registerClientScript();
    }
186530
public void setEditWidget(I_CmsEditWidget editWidget) {

        // the edit widget may be set only once
        assert m_editWidget == null;
        m_editWidget = editWidget;
        m_mainPanel.add(m_editWidget);
        m_editWidget.asWidget().addStyleName(I_CmsLayoutBundle.INSTANCE.form().widget());
    }