Registers a widget area

@param string $name     The display name
@param string $location The area location
@param string $id       The unique identifier
4528
public function registerWidget($name, $location, $id)
    {
        $tab = '    ';
        $indent = str_repeat($tab, 5);

        register_sidebar([
            'name'          => $name,
            'id'            => sprintf('%s-%s', $location, $id),
            'class'         => sprintf('%s-%s', $location, $id),
            'before_widget' => sprintf('<div id="%%1$s" class="%s-widget %%2$s">', $location),
            'after_widget'  => sprintf('</div><!-- .%s-widget -->%s', $location, PHP_EOL),
            'before_title'  => sprintf('<h3 class="%s-widget-title">', $location),
            'after_title'   => '</h3>'
        ]);
    }
1195804
public function clone(string $id, string $name): ?string
  {
    if ( \bbn\str::is_uid($id) && ($id_menu = $this->add(['text' => $name])) ){
      if ( ($bits = $this->pref->get_full_bits($id)) && !$this->_clone($id_menu, $bits) ){
        return null;
      }
      return $id_menu;
    }
    return null;
  }
117258
private function createLocationAddForm(Location $location): FormInterface
    {
        return $this->formFactory->addLocation(
            new ContentLocationAddData($location->getContentInfo())
        );
    }
290440
public function registerFormWidget($className, $widgetInfo = null)
    {
        if (!is_array($widgetInfo)) {
            $widgetInfo = ['code' => $widgetInfo];
        }

        $widgetCode = $widgetInfo['code'] ?? null;

        if (!$widgetCode) {
            $widgetCode = Str::getClassId($className);
        }

        $this->formWidgets[$className] = $widgetInfo;
        $this->formWidgetHints[$widgetCode] = $className;
    }
668207
public function setVisible(int $id): void
    {
        $sourceNodeData = $this->locationGateway->getBasicNodeData($id);

        $this->locationGateway->setNodeWithChildrenVisible($sourceNodeData['path_string']);
    }
953569
public function registerDriver($name, DriverInterface $driver)
    {
        $name = strtolower($name);
        $this->drivers[$name] = $driver;
    }
649522
public function insert(Widget $widget, View $view, $slotId, $position, $widgetReference)
    {
        $quantum = $this->em->getRepository('VictoireWidgetMapBundle:WidgetMap')->findOneBy([
            'view'     => $view,
            'slot'     => $slotId,
            'position' => $position,
            'parent'   => $widgetReference,
            'action'   => [
                WidgetMap::ACTION_CREATE,
                WidgetMap::ACTION_OVERWRITE,
            ],
        ]);

        if ($quantum) {
            $widget->setWidgetMap($quantum);
            $view->addWidgetMap($quantum);
        } else {
            $parent = null;
            if ($widgetReference) {
                $parent = $this->em->getRepository('VictoireWidgetMapBundle:WidgetMap')->find($widgetReference);
            }
            //create the new widget map
            $widgetMapEntry = new WidgetMap();
            $widgetMapEntry->setAction(WidgetMap::ACTION_CREATE);
            $widgetMapEntry->setSlot($slotId);
            $widgetMapEntry->setPosition($position);
            $widgetMapEntry->setParent($parent);
            $widget->setWidgetMap($widgetMapEntry);

            $view->addWidgetMap($widgetMapEntry);
        }
    }
278261
protected function registerWidget($name, $args)
    {
        try {
            $template = $this->getTemplate('widget.php');
            // Replace arguments
            $template = preg_replace(
                [
                    '/\{0\}/',
                    '/\{1\}/',
                    '/\{2\}/',
                ],
                [
                    $name,
                    $this->config['type'] == 'theme' ? 'theme' : strtolower($this->config['namespace']),
                    strtolower($this->config['namespace']),
                ],
                $template
            );
            // Check if folder exists.
            if (!is_dir($this->rootPath.'/app/Widgets'))
                mkdir($this->rootPath.'/app/Widgets');
            // Pull contents
            file_put_contents(
                $this->rootPath.'/app/Widgets/'.$name.'.php',
                $template
            );
            // Update composer.json autoload
            $json = json_decode(file_get_contents($this->rootPath.'/composer.json'));
            $jsonUpdated = false;
            if (!isset($json->autoload->{'psr-0'})) {
                $json->autoload->{'psr-0'} = ['' => []];
            }
            if (is_array($json->autoload->{'psr-0'})
                && !in_array('app\\Widgets', $json->autoload->{'psr-0'}[''])
            ) {
                $json->autoload->{'psr-0'}[''][] = 'app\\Widgets';
                $jsonUpdated = true;
            }
            if (is_array($json->autoload->{'psr-0'}->{_empty_})
                && !in_array('app\\Widgets', $json->autoload->{'psr-0'}->{_empty_})
            ) {
                $empty = $json->autoload->{'psr-0'}->{_empty_};
                unset($json->autoload->{'psr-0'}->{_empty_});
                $json->autoload->{'psr-0'} = ['' => $empty];
                $json->autoload->{'psr-0'}[''][] = 'app\\Widgets';
                $jsonUpdated = true;
            }
            if ($jsonUpdated) {
                file_put_contents(
                    $this->rootPath.'/composer.json',
                    $this->prettyJson(json_encode($json))
                );
            }
            // Add to main
            $builder = Builder::parser($this->rootPath.'/app/Main.php');
            $builder->addVisitor(new AddMethodCallVisitor('init', 'add_widget', [$name]));
            $builder->build();
            // Dump autoload
            $this->_print('Widget registered!');
            $this->_lineBreak();
            exec( 'composer dump-autoload' );
        } catch (Exception $e) {
            file_put_contents(
                $this->rootPath.'/error_log',
                $e->getMessage()
            );
            throw new NoticeException('Command "'.$this->key.'": Fatal error ocurred.');
        }
    }
444554
public function registerAssetJs($name, $position = CClientScript::POS_END) {
		
		$this->cs->registerScriptFile($this->getAssetsUrl() . "/js/{$name}", $position);
	}
238880
public function registr($place, $controller)
    {
        if (preg_match('/^[a-z0-9]+:[a-z0-9]+:[_a-z0-9]+$/i', $controller)) {
            if (!isset($this->widgets[$place])) {
                $this->widgets[$place][] = $controller;
            } elseif (!in_array($controller, $this->widgets[$place])) {
                $this->widgets[$place][] = $controller;
            }

            return true;
        }

        return false;
    }
1274724
public function add($name, $title, $properties, $controllerClass)
    {

        register_widget(new Widget($name, $title, $properties, $this->plugin, $controllerClass));
    }
248098
public function registerTheme($id, $name, $path = '', $targets = array(), $templates = array() )
    {
        if (preg_match('/^[a-zA-Z0-9]*$/', $id) === 0) {
            throw new \common_Exception('Invalid id "'.$id.'"');
        }
        if (!is_array($targets) || count($targets) === 0){
            throw new \common_Exception('No targets were provided for theme '.$id);
        }

        foreach ($targets as $target) {
            if(!$this->isRegistered($target)){
                throw new \common_Exception('Target '.$target.' does not exist');
            } else {

                $array = $this->get($target);

                foreach ($array['available'] as $theme) {
                    if ($theme['id'] == $id) {
                        throw new \common_Exception('Theme '.$id.' already exists for target '.$target);
                    }
                }

                $theme = array(
                    'id' => $id,
                    'name' => $name
                );

                //the path is optional
                if($path){
                    $theme['path'] = $path;
                }

                //register templates
                if(is_array($templates) && count($templates) > 0){
                    $theme['templates'] = array();
                    foreach($templates as $templateId => $tpl){
                        $theme['templates'][$templateId] = $tpl;
                    }
                }

                $array['available'][] = $theme;
            }
            $this->set($target, $array);
        }
    }
1108686
public function set($name, Location $location)
    {
        return $this->cache->put($name, $location->toArray(), $this->expires);
    }
172935
public function addTarget(Target $target, string $name = null)
    {
        if ($name === null) {
            $this->_targets[] = $target;
        } else {
            $this->_targets[$name] = $target;
        }
    }
484894
public function updateSection($id, $name, $identifier)
    {
        $query = $this->dbHandler->createUpdateQuery();
        $query->update(
            $this->dbHandler->quoteTable('ezsection')
        )->set(
            $this->dbHandler->quoteColumn('name'),
            $query->bindValue($name)
        )->set(
            $this->dbHandler->quoteColumn('identifier'),
            $query->bindValue($identifier)
        )->where(
            $query->expr->eq(
                $this->dbHandler->quoteColumn('id'),
                $query->bindValue($id, null, \PDO::PARAM_INT)
            )
        );

        $query->prepare()->execute();
    }
545537
public function setVisible(int $id): void
    {
        $this->logger->logCall(__METHOD__, ['location' => $id]);
        $this->persistenceHandler->locationHandler()->setVisible($id);

        $this->cache->invalidateTags(['location-path-data-' . $id]);
    }
1270116
public function sendBlock($id, $data, $name = null)
    {
        $this->output("id: {$id}\n");
        if (strlen($name) && $name !== null) {
            $this->output("event: {$name}\n");
        }
        $this->output($this->wrapData($data)."\n\n");
        flush();
    }