@param DataType $component the component to be built
@param array    $options   parameters for building

@return string
511101
public static function build($component, array $options = [])
    {
        $name = empty($options['lowercase']) ?
            $component->name : strtolower($component->name);

        $parameters = '';
        if (! empty($component->parameters)) {
            $parameters = '(' . implode(',', $component->parameters) . ')';
        }

        return trim($name . $parameters . ' ' . $component->options);
    }
1241932
public static function build($component, array $options = [])
    {
        $ret = 'CASE ';
        if (isset($component->value)) {
            // Syntax type 0
            $ret .= $component->value . ' ';
            $val_cnt = count($component->compare_values);
            $res_cnt = count($component->results);
            for ($i = 0; $i < $val_cnt && $i < $res_cnt; ++$i) {
                $ret .= 'WHEN ' . $component->compare_values[$i] . ' ';
                $ret .= 'THEN ' . $component->results[$i] . ' ';
            }
        } else {
            // Syntax type 1
            $val_cnt = count($component->conditions);
            $res_cnt = count($component->results);
            for ($i = 0; $i < $val_cnt && $i < $res_cnt; ++$i) {
                $ret .= 'WHEN ' . Condition::build($component->conditions[$i]) . ' ';
                $ret .= 'THEN ' . $component->results[$i] . ' ';
            }
        }
        if (isset($component->else_result)) {
            $ret .= 'ELSE ' . $component->else_result . ' ';
        }
        $ret .= 'END';

        if ($component->alias) {
            $ret .= ' AS ' . Context::escape($component->alias);
        }

        return $ret;
    }
729272
public function datatable($options)
    {
        if (!isset($options['id']))
        {
            $options['id'] = 'ali-dta_' . md5(rand(1, 100));
        }
        $dt                       = Datatable::getInstance($options['id']);
        $config                   = $dt->getConfiguration();
        $options['js_conf']       = json_encode($config['js']);
        $options['js']            = json_encode($options['js']);
        $options['action']        = $dt->getHasAction();
        $options['action_twig']   = $dt->getHasRendererAction();
        $options['fields']        = $dt->getFields();
        $options['delete_form']   = $this->createDeleteForm('_id_')->createView();
        $options['search']        = $dt->getSearch();
        $options['search_fields'] = $dt->getSearchFields();
        $options['multiple']      = $dt->getMultiple();
        $options['sort']          = is_null($dt->getOrderField()) ? NULL : array(array_search(
                    $dt->getOrderField(), array_values($dt->getFields())), $dt->getOrderType());
        $main_template            = 'AliDatatableBundle:Main:index.html.twig';
        if (isset($options['main_template']))
        {
            $main_template = $options['main_template'];
        }
        $session                  = $this->_container->get('session');
        $rawjs                    = $this->_container
                ->get('templating')
                ->render('AliDatatableBundle:Internal:script.html.twig', $options);
        $sess_dtb                 = $session->get('datatable', array());
        $sess_dtb[$options['id']] = $rawjs;
        $session->set('datatable', $sess_dtb);

        return $this->_container
                        ->get('templating')
                        ->render($main_template, $options);
    }
158474
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->addModelTransformer($this)
            ->add('name', TextType::class, array())
            ->add('online', ChoiceType::class, array(
                'expanded' => true,
                'multiple' => false,
                'choices' => array(
                    'Yes' => true,
                    'No' => false,
                ),
            ))
            ->add('meta', MetadataType::class, array(
                'label' => false,
                'supported_metadata' => array('title', 'description', 'keywords'),
            ))
            ->add('submit', SubmitType::class)
        ;
    }
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;
            }
1215835
public static function build($component, array $options = [])
    {
        if (is_array($component)) {
            return implode(', ', $component);
        }

        return $component->old . ' TO ' . $component->new;
    }
862319
public function createFormBuilder($data = null, array $options = array())
    {
        $type = 'Symfony\Component\Form\Extension\Core\Type\FormType';
        return $this->container->get('form.factory')->createBuilder($type, $data, $options);
    }
1226459
public function buildForm(FormBuilderInterface $builder, array $options)
    {

        $configValue = $options['data'];
        $formOptions = array();
        if ( $configValue->getConfigType()->getOptions()
            && $typeOptions = json_decode($configValue->getConfigType()->getOptions())
        ) {
            $typeOptions = $this->_recursiveGetObjectVars($typeOptions);
            $formOptions = array_merge($formOptions, $typeOptions);
        }
        if ( $configValue->getOptions()
            && $valueOptions = json_decode($configValue->getOptions())
        ) {
            $valueOptions = $this->_recursiveGetObjectVars($valueOptions);
            $formOptions = array_merge($formOptions, $valueOptions);
        }
        $defaultFormOptions = array(
            'label' => $this->container->get('translator')->trans($configValue->getVLabel(), array(), 'VinceTAdminConfigurationBundle'),
            'label_attr' => array(
                'class' => 'control-label'
            ),
            'required' => false,
        );
        $formOptions = array_merge($formOptions, $defaultFormOptions);

        $dispatcher = $this->container->get('event_dispatcher');

        $event = new AdminConfigurationFormCreateOptionsEvent($configValue->getPath(), $formOptions);
        $dispatcher->dispatch(AdminConfigurationEvents::ADMIN_CONFIGURATION_FORM_OPTIONS_CREATE, $event);

        $formOptions = $event->getFormOptions();

        $builder
            ->add(
                'value',
                $configValue->getConfigType()->getFormType(),
                $formOptions
            );
    }
1118358
private function serializeComponents(array $components): string
    {
        return implode('|', array_map(function ($name, $value) {
            return sprintf('%s:%s', $name, $value);
        }, array_keys($components), $components));
    }
253540
public static function build($component, array $options = [])
    {
        $ret = $component->options . ' ';
        if ((isset($component->field)) && ($component->field !== '')) {
            $ret .= $component->field . ' ';
        }
        $ret .= TokensList::build($component->unknown);

        return $ret;
    }
1354147
public function components(array $components) : IColumn
    {
        foreach ($components as $key => $component) {
            if ($component instanceof IColumnComponent) {

            } elseif ($component instanceof IField) {
                $component = ColumnComponent::forField($component);
            } elseif ($component instanceof FieldBuilderBase) {
                $component = ColumnComponent::forField($component->build());
            } else {
                throw TypeMismatchException::format(
                        'Invalid array passed to %s: expecting elements to be instance of %s, %s found',
                        __METHOD__, IColumnComponent::class . '|' . IField::class . '|' . FieldBuilderBase::class, Debug::getType($component)
                );
            }

            $components[$key] = $component;
        }

        $this->components = $components;

        return $this->build();
    }
870752
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->addModelTransformer($this)

            ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($builder, $options) {
                $form = $event->getForm();
                $zone = $event->getData();

                // Create a component form for each into given zone
                $form->add('components', CollectionType::class, array(
                    'auto_initialize' => false,
                    'allow_add' => false,
                    'allow_delete' => false,
                    'entry_type' => ComponentType::class,
                    'entry_options' => array(
                        'variation' => $this->variationResolver->resolve((new VariationContext())->denormalize(array(
                            'theme' => $options['theme'],
                            'content_type' => $options['content_type'],
                            'template_type' => $options['template_type'],
                            'zone_type' => $zone->getZoneType(),
                        ))),
                    ),
                ));
            })
        ;
    }
654591
public function build($options)
    {
        $container = $this->container;
        $objType = isset($options['type']) ? $options['type'] : self::DEFAULT_TYPE;

        $obj = $this->factory->create($objType, [
            'logger' => $container['logger'],
            'view'   => $container['view']
        ]);
        $obj->setData($options);

        return $obj;
    }
581817
protected function component_name(string $component): string {

        if ($component === 'core' || strpos($component, 'core_')) {
            return get_string('componentcore', 'tool_analytics');

        } else {
            return get_string('pluginname', $component);
        }
    }
1255992
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        /** @var FamilyInterface $family */
        $family = $options['family'];

        /** @noinspection DateTimeConstantsUsageInspection */
        $builder
            ->add(
                'format',
                ChoiceType::class,
                [
                    'choices' => [
                        'CSV' => 'csv',
                        'JSON' => 'json',
                    ],
                ]
            )
            ->add(
                'csvDelimiter',
                ChoiceType::class,
                [
                    'choices' => [
                        'Semicolon ;' => ';',
                        'Comma ,' => ',',
                        'Tab \\t' => "\t",
                        'Pipe |' => '|',
                    ],
                ]
            )
            ->add(
                'csvEnclosure',
                ChoiceType::class,
                [
                    'choices' => [
                        '"' => '"',
                        "'" => "'",
                    ],
                ]
            )
            ->add(
                'csvEscape',
                ChoiceType::class,
                [
                    'choices' => [
                        'Backslash \\' => '\\',
                    ],
                ]
            )
            ->add(
                'onlySelectedEntities',
                CheckboxType::class,
                [
                    'required' => false,
                    'help_block' => 'If selected, only the entities with the following Ids will be exported',
                    'widget_checkbox_label' => 'label',
                ]
            )
            ->add(
                'selectedIds',
                TextType::class,
                [
                    'attr' => [
                        'readonly' => 'readonly',
                    ],
                    'required' => false,
                    'help_block' => 'These values comes from the last resultset found in session',
                ]
            )
            ->add(
                'dateFormat',
                ChoiceType::class,
                [
                    'choices' => [
                        'ISO 8601' => \DateTime::ISO8601,
                        'W3C/ATOM (RFC3339)' => \DateTime::W3C,
                        'Simple date: Y-m-d' => 'Y-m-d',
                        'Simple datetime: Y-m-d H:i' => 'Y-m-d H:i',
                    ],
                ]
            )
            ->add(
                'splitCharacter',
                ChoiceType::class,
                [
                    'choices' => [
                        'Comma ,' => ',',
                        'Pipe |' => '|',
                        'Semicolon ;' => ';',
                        'Slash /' => '/',
                    ],
                    'help_block' => 'For collection attributes',
                ]
            )
            ->add(
                'booleanFormat',
                ChoiceType::class,
                [
                    'choices' => [
                        '1/0' => 'binary',
                        'true/false' => 'boolean',
                        'yes/no' => 'english',
                    ],
                    'help_block' => 'For boolean attributes',
                ]
            )
            ->add(
                'attributes',
                FormType::class,
                [
                    'required' => false,
                    'help_label' => '<div class="btn-group"><button type="button" data-select-all="form_project_export[attributes]" class="btn btn-default">Select all</button><button type="button" data-select-none="form_project_export[attributes]" class="btn btn-default">Select none</button></div>',
                ]
            );

        /** @var FormBuilderInterface $attributesBuilder */
        $attributesBuilder = $builder->get('attributes');
        foreach ($family->getAttributes() as $attribute) {
            $attributesBuilder->add(
                $attribute->getCode(),
                AttributeExportConfigType::class,
                [
                    'required' => false,
                    'attribute' => $attribute,
                ]
            );
        }
    }
16741
public static function build($component, array $options = [])
    {
        if (is_array($component)) {
            return "(\n" . implode(",\n", $component) . "\n)";
        }

        if ($component->isSubpartition) {
            return trim('SUBPARTITION ' . $component->name . ' ' . $component->options);
        }

        $subpartitions = empty($component->subpartitions) ? '' : ' ' . self::build($component->subpartitions);

        return trim(
            'PARTITION ' . $component->name
            . (empty($component->type) ? '' : ' VALUES ' . $component->type . ' ' . $component->expr . ' ')
            . ((! empty($component->options) && ! empty($component->type)) ? '' : ' ') . $component->options . $subpartitions
        );
    }
802039
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->buildValuesForm($builder, $options);
        $this->buildDataForm($builder, $options);

        $builder->addEventListener(
            FormEvents::POST_SUBMIT,
            function (FormEvent $event) {
                $data = $event->getData();
                if ($data instanceof DataInterface) {
                    $data->setUpdatedAt(new \DateTime());
                }
            }
        );
    }