Embeds the form sections inside the current form.

@param IForm $embeddedForm

@return static
973735
public function embed(IForm $embeddedForm)
    {
        foreach ($embeddedForm->getSections() as $section) {
            $this->addSection($section);
        }

        foreach ($embeddedForm->getProcessors() as $processor) {
            $this->process($processor);
        }

        return $this;
    }
874875
protected function definition_inner(&$mform) {

        $norepeats          = $this->_customdata['norepeats'];          // number of dimensions to display
        $descriptionopts    = $this->_customdata['descriptionopts'];    // wysiwyg fields options
        $current            = $this->_customdata['current'];            // current data to be set

        $mform->addElement('hidden', 'norepeats', $norepeats);
        $mform->setType('norepeats', PARAM_INT);
        // value not to be overridden by submitted value
        $mform->setConstants(array('norepeats' => $norepeats));

        for ($i = 0; $i < $norepeats; $i++) {
            $mform->addElement('header', 'dimension'.$i, get_string('dimensionnumber', 'workshopform_comments', $i+1));
            $mform->addElement('hidden', 'dimensionid__idx_'.$i);
            $mform->setType('dimensionid__idx_'.$i, PARAM_INT);
            $mform->addElement('editor', 'description__idx_'.$i.'_editor',
                                get_string('dimensiondescription', 'workshopform_comments'), '', $descriptionopts);
        }

        $mform->registerNoSubmitButton('noadddims');
        $mform->addElement('submit', 'noadddims', get_string('addmoredimensions', 'workshopform_comments',
                workshop_comments_strategy::ADDDIMS));
        $mform->closeHeaderBefore('noadddims');
        $this->set_data($current);
    }
1065649
final protected function defineForm(StagedFormObjectDefinition $form)
    {
        $form->stage(function (FormObjectDefinition $form) {
            $form->section('Object', [
                    ObjectForm::objectField($form->field($this->object), $this->dataSource)
            ]);
        });

        $this->defineFormStages($form);
    }
1188455
protected function definition_inner($mform) {
        global $CFG;

        // Add the answer (choice) fields to the form.
        $this->definition_answer_choice($mform);

        $this->add_combined_feedback_fields(true);
        $this->add_interactive_settings(true, true);
    }
962635
private function buildEditForm()
    {
        $form = '';
        foreach ($this->fields as $field) {
            $title = addslashes($field->label);
            $label = $field->title;
            if (in_array($field->validation,
                    $this->starred) && $field->type != 'password' && $field->type != 'file' && $field->type != 'photo'
            ) {
                $title .= '*';
            }
            if ($field->type == 'relationship') {
                $label = $field->relationship_name . '_id';
            }
            if ($field->type == 'checkbox') {
                $field->default = '$' . $this->model . '->' . $label . ' == 1';
            }
            $temp = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR . 'fields' . DIRECTORY_SEPARATOR . $field->type);
            $temp = str_replace([
                'old(\'$LABEL$\')',
                '$LABEL$',
                '$TITLE$',
                '$VALUE$',
                '$STATE$',
                '$SELECT$',
                '$TEXTEDITOR$',
                '$HELPER$',
                '$WIDTH$',
                '$HEIGHT$',
            ], [
                'old(\'$LABEL$\',$' . $this->resource . '->' . $label . ')',
                $label,
                $title,
                $field->type != 'radio' ?
                    $field->value != '' ? ', "' . $field->value . '"' : ''
                    : "'$field->value'",
                $field->default,
                '$' . $field->relationship_name,
                $field->texteditor == 1 ? ' ckeditor' : '',
                $this->helper($field->helper),
                $field->dimension_w,
                $field->dimension_h,
            ], $temp);
            $form .= $temp;
        }
        $this->formFieldsEdit = $form;
    }
216185
public function form($form = null)
    {
        if (func_num_args() === 1) {
            $form = $form ?: [];
            $this->_form = $form;
            $this->set($form);
            return $this;
        }
        return $this->_form;
    }
1237174
public function setForm(\Opifer\CmsBundle\Entity\Form $form = null)
    {
        $this->form = $form;

        return $this;
    }
800368
public function activateFormContext()
    {
        if (true === $this->formContext) {
            throw DuplicateEntryException::duplicatedFormContext();
        }

        $this->formContext = true;

        return $this;
    }
1225821
public function breakEmbedding():self
	{
		$this->append($this->embedment->getContent());
		$this->embedment= null;

		return $this;
	}
425612
public function getEmbedCode(EmbeddedAsset $embeddedAsset)
	{
		$dom = null;

		if ($embeddedAsset->code)
		{
			$errors = libxml_use_internal_errors(true);
			$entities = libxml_disable_entity_loader(true);

			try
			{
				$dom = new DOMDocument();
				$code = "<div>$embeddedAsset->code</div>";
				$isHtml = $dom->loadHTML($code, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);

				if (!$isHtml)
				{
					throw new ErrorException();
				}
			}
			catch (ErrorException $e)
			{
				// Corrupted code property, like due to invalid HTML.
				$dom = null;
			}
			finally
			{
				libxml_use_internal_errors($errors);
				libxml_disable_entity_loader($entities);
			}
		}

		return $dom;
	}
536057
public function withFormData(IForm $form)
    {
        call_user_func($this->callback, new FormDataWidget($this->name, $this->label, $this->authSystem, $this->requiredPermissions, $form));
    }
493619
public function & SetForm (\MvcCore\Ext\Forms\IForm & $form) {
		$this->form = & $form;
		return $this;
	}
1210532
public function createFormView(FormInterface $form)
    {
        $post = $this->eavManager->initializeEntity($form->getSchema());

        $form = $this->formFactory->create(PostType::class, $post, ['form_id' => $form->getId()]);

        return $form->createView();
    }
991564
protected function loadForm()
    {
        if (! $this->_form) {
            $options = array();

            if (\MUtil_Bootstrap::enabled()) {
                //$options['class'] = 'form-horizontal';
                $options['role'] = 'form';
            }

            $this->_form = $this->createForm($options);

            $this->addFormElements($this->_form);
        }
    }
881465
public function sectionStdEdit()
	{
		$templates = Templates::getInstance();
		$item = $templates->get(arg('id'), 'std', true);
		$form = array(
			'name' => 'editForm',
			'caption' => Eresus_Kernel::app()->getPage()->title . ADM_T_DIV . ADM_EDIT,
			'width' => '100%',
			'fields' => array (
				array('type'=>'hidden','name'=>'action', 'value'=>'update'),
				array('type'=>'hidden','name'=>'section', 'value'=>arg('section')),
				array('type'=>'hidden','name'=>'name'),
				array('type'=>'edit','name'=>'_name','label' => ADM_THEMES_FILENAME_LABEL,
					'width' => '200px', 'comment' => '.tmpl (' .
					$this->stdTemplates[$item['name']]['caption'].')',
					'disabled' => true, 'value'=>$item['name']),
				array('type'=>'text','name'=>'hint', 'value' =>
					isset($this->stdTemplates[$item['name']]['hint']) ?
						$this->stdTemplates[$item['name']]['hint']:'', 'extra' => 'id="templateHint"'),
				array('type'=>'memo','name'=>'code', 'height'=>'30', 'syntax' => 'html'),
			),
			'buttons' => array('ok', 'apply', 'cancel'),
		);
		/** @var TAdminUI $page */
		$page = Eresus_Kernel::app()->getPage();
		$result = $page->renderForm($form, $item);
		return $result;
	}
672518
public function setEmbeddable()
    {
        $this->cm->isEmbeddedClass = true;
        $this->cm->isMappedSuperclass = false;

        return $this;
    }
38249
public function getEmbeddedMessage(): EmbeddedMessageInterface
    {
        if (!$this->isEmbeddedMessage()) {
            throw new NotEmbeddedMessageException(\sprintf(
                'Attachment "%s" in message "%s" is not embedded message',
                $this->getPartNumber(),
                $this->getNumber()
            ));
        }

        return new EmbeddedMessage($this->resource, $this->getNumber(), $this->getPartNumber(), $this->getStructure()->parts[0]);
    }