Register a component

@param {Object} component Component
323171
function registerComponent(component) {
    const componentName = dashify(component.name);
    const componentLocalConfig = (component.local instanceof Array) ? component.local : [];
    while (componentLocalConfig.length < component.path.length) {
        componentLocalConfig.push([]);
    }
    const componentPath = component.path.slice(0).map(p => dashify(p));
    const componentRealPath = componentPath.map((p, i) => {
        return componentLocalConfig[i].dirsort ?
            `${(new String(componentLocalConfig[i].dirsort)).padStart(2, '0')}-${p}` : p;
    });
    const componentParent = path.join(app.components.get('path'), ...componentRealPath);
    const componentDirectory = path.join(componentParent, componentName);

    // Create the component directory
    if (!createCollection(app.components.get('path'), [...componentRealPath, componentName], componentLocalConfig)) {
        throw new Error(`Could not create component directory ${componentDirectory}`);
    }

    // Write out the template file
    const componentVariantName = componentName + (component.variant ? `--${dashify(component.variant)}` : '');
    const componentTemplate = path.join(componentDirectory, `${componentVariantName}.${component.extension}`);
    writeFile(componentTemplate, component.template);

    // Write out the preview template
    if (component.preview) {
        writeFile(path.join(componentParent, `_${componentName}-preview.t3s`), component.preview);
    }

    // Configure the component
    configureComponent(path.join(componentDirectory, `${componentName}.config.json`), component, componentPath);
}
866475
public void registerId(String id, BaseComponent component) {
        if (!StringUtils.isEmpty(id) && !container.hasAttribute(id)) {
            container.setAttribute(id, component);
        }
    }
932276
public ComponentAdapter registerComponentInstance(Object componentKey, Object componentInstance) throws PicoRegistrationException {
		if (componentInstance instanceof MutablePicoContainer) {
			MutablePicoContainer pc = (MutablePicoContainer) componentInstance;
			Object contrivedKey = new Object();
			String contrivedComp = "";
			pc.registerComponentInstance(contrivedKey, contrivedComp);
			try {
				if (this.getComponentInstance(contrivedKey) != null) {
					throw new PicoRegistrationException("Cannot register a container to itself. The container is already implicitly registered.");
				}
			} finally {
				pc.unregisterComponent(contrivedKey);
			}

		}
		ComponentAdapter componentAdapter = new InstanceComponentAdapter(componentKey, componentInstance);
		registerComponent(componentAdapter);
		return componentAdapter;
	}
1010419
public function register($name, $component)
    {
        // Closure
        if ($component instanceof \Closure) {
            $component = new ComponentDefine($component);
        }

        if ($component instanceof ComponentDefine) {
            $component->setContainer($this);
        }
        elseif (method_exists($component, 'raikiri') && ! $component instanceof ProphecySubjectInterface) {
            $component->setContainer($this);
        }

        $this->components[$name] = $component;
    }
473249
public void add(UIComponent... components)
	{
		for (UIComponent component : components)
		{
			if (component != null && component != this)
			{
				content.components.add(component);
				component.setParent(this);
				component.register(this);
			}
		}
		onContentUpdate();
	}
754808
public Application register(Object component, Map<Class<?>, Integer> contracts) {
        config.register(component, contracts);
        return this;
    }
1201319
public void registerComponentBindingsProvider(ServiceReference reference) {
		log.info("registerComponentBindingsProvider");
		log.info("Registering Component Bindings Provider {} - {}",
				new Object[] { reference.getProperty(Constants.SERVICE_ID),
						reference.getProperty(Constants.SERVICE_PID) });
		String[] resourceTypes = OsgiUtil.toStringArray(reference
				.getProperty(ComponentBindingsProvider.RESOURCE_TYPE_PROP),
				new String[0]);
		for (String resourceType : resourceTypes) {
			if (!this.containsKey(resourceType)) {
				put(resourceType, new HashSet<ServiceReference>());
			}
			log.debug("Adding to resource type {}", resourceType);
			get(resourceType).add(reference);
		}
	}
1280798
protected <T extends IComponent> void addComponent(Class<T> componentType, T component) {
        components.put(componentType, component);
    }
669171
public function registerServerNamespace()
    {
        foreach ($this->customComponents as $ns => $componentDir) {
            if (is_int($ns)) {
                $ns = $componentDir;
                $componentDir = ComposerHelper::getDirByNamespace($ns);
                $ns = rtrim($ns, "\\");
                $componentDir = rtrim($componentDir, "/");
            }

            $this->componentNamespaces[] = $ns;
            $componentDir = alias($componentDir);

            foreach ($this->serverScan as $dir) {
                $scanDir = $componentDir . DS . $dir;
                if (!is_dir($scanDir)) {
                    continue;
                }

                $scanNs = $ns . "\\" . $dir;
                $this->scanNamespaces[$scanNs] = $scanDir;
            }
        }
    }
623280
private function registerFormComponent()
    {
        $this->app->register(\Collective\Html\HtmlServiceProvider::class);
        $this->concord->registerAlias('Form', \Collective\Html\FormFacade::class);
        $this->concord->registerAlias('Html', \Collective\Html\HtmlFacade::class);
    }
1344215
public void remove(UIComponent component)
	{
		if (component.getParent() != this)
			return;

		content.components.remove(component);
		component.setParent(null);
		component.unregister(this);
		onContentUpdate();
	}
221365
public function addComponent(Component $component)
	{
		$component->setParentComponent($this);
		$component->setFormComponent($this->formComponent);
		
		$this->components[$component->getName()] = $component;
		
		// Set value if there is one
		$component->setRequestData(is_array($this->inputData) && array_key_exists($component->getName(), $this->inputData) ? $this->inputData[$component->getName()] : null);
	}
336303
function(component, eventNames) {
          eventNames = eventNames.trim().split(/\s+/);

          for (var i = 0, l = eventNames.length; i < l; i++) {
            var eventName = eventNames[i];
            this._registerEventHandler(component, eventName);
          }
        }
522836
public ComponentAdapter registerComponentImplementation(Object componentKey, Class componentImplementation) throws PicoRegistrationException {
		return registerComponentImplementation(componentKey, componentImplementation, (Parameter[]) null);
	}
485389
protected function registerComponents()
    {
        ComponentManager::instance()->registerComponents(function ($manager) {
            $manager->registerComponent(\Cms\Components\ViewBag::class, 'viewBag');
            $manager->registerComponent(\Cms\Components\Resources::class, 'resources');
        });
    }
559926
function addComponent(Component, options) {
                var name = options.name,
                    container = options.container;

                if (name === undefined) {
                    throw 'you have to define data.name for component.';
                } else if (container === undefined) {
                    throw 'You have to define container for component.';
                } else if (this.children[name] !== undefined) {
                    throw 'Component using name:' + name + '! already defined.';
                }
                var component = this.setComponent(Component, options),
                    instance = component.run(options.container);
                instance.setContext(this.context);
                this.children[name] = instance;
                return instance;
            }
3957
public void addToolbarComponent(BaseComponent component) {
        if (tbarContainer == null) {
            tbarContainer = new ToolbarContainer();
            shell.addToolbarComponent(tbarContainer);
            registerComponent(tbarContainer);
        }

        tbarContainer.addChild(component);
    }