Adds an embed field.

@param   EmbeddedPropMetadata   $embed
@return  self
1624
public function addEmbed(EmbeddedPropMetadata $embed)
    {
        $this->validateEmbed($embed);
        $this->embeds[$embed->getKey()] = $embed;
        ksort($this->embeds);
        return $this;
    }
697451
function setDescription($description) {
        $description = (string) $description;
        
        if(\mb_strlen($description) > 2048) {
            throw new \InvalidArgumentException('Embed description can not be longer than 2048 characters');
        }
        
        $this->description = $description;
        return $this;
    }
1028886
public function addProductItemFieldData(ProductItemFieldData $productItemFieldData)
    {
        $productItemFieldData->setProduct($this);

        $this->productItemFieldDatas->add($productItemFieldData);

        return $this;
    }
45414
public function addFields(array $fieldData)
    {
        foreach ($fieldData as $k => $data) {
            $assoc = !is_numeric($k);
            $name = $assoc ? $k : $data;
            $field = ArrayData::create(
                [
                    'Name' => $name,
                    'Description' => $assoc ? $data : null,
                ]
            );
            $this->removeField($name);
            $this->fields->add($field);
        }

        return $this;
    }
9767
public void addEmbeddedImage(final String name, final DataSource imagedata) {
		embeddedImages.add(new AttachmentResource(name, imagedata));
	}
389630
protected function setEmbed($key, $value)
    {
        if (true === $this->isEmbedHasOne($key)) {
            return $this->setEmbedHasOne($key, $value);
        }
        if (true === $this->isEmbedHasMany($key)) {
            throw new \RuntimeException('You cannot set a hasMany embed directly. Please access using pushEmbed(), clear(), and/or remove()');
        }
        return $this;
    }
27733
protected function buildEmbeddedForm()
    {
        $form = new EmbeddedForm($this->column);

        $form->setParent($this->form);

        call_user_func($this->builder, $form);

        $form->fill($this->getEmbeddedData());

        return $form;
    }
812518
private function embedResource(array $embeds, ResourceObject $ro, array $query)
    {
        foreach ($embeds as $embed) {
            /* @var $embed Embed */
            if (! $embed instanceof Embed) {
                continue;
            }
            try {
                $templateUri = $this->getFullUri($embed->src, $ro);
                $uri = uri_template($templateUri, $query);
                $ro->body[$embed->rel] = clone $this->resource->get->uri($uri);
            } catch (BadRequestException $e) {
                // wrap ResourceNotFound or Uri exception
                throw new EmbedException($embed->src, 500, $e);
            }
        }
    }
209261
public static function create(array $properties): AddressEmbeddableInterface
    {
        if (array_key_exists(AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NUMBER, $properties)) {
            return new self(
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NUMBER],
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NAME],
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_STREET],
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_CITY],
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_POSTAL_AREA],
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_POSTAL_CODE],
                $properties[AddressEmbeddableInterface::EMBEDDED_PROP_COUNTRY_CODE]
            );
        }

        return new self(...array_values($properties));
    }
600493
protected function createEmbedViaData($data, $filename = null, $contentType = null)
    {
        return $this->getManager()->getDI()->get('\Swift_Image', [$data, $filename, $contentType]);
    }
789215
protected function startEmbedding( string$embedType ):self
	{
		$embedmentClass= '\\Htsl\\Embedment\\'.ucfirst($embedType).'Embedment';
		class_exists($embedmentClass) or $this->throw("Embed type $embedType not exists.");

		$this->embedment= new $embedmentClass($this);

		return $this;
	}
182664
private EmbeddedColumnInfo getEmbeddedColumn(TableInfo tableInfo, EmbeddableType embeddableType,
            String embeddableColName, Class embeddedEntityClass, Field field)
    {

        String[] orderByColumns = null;
        if (field.isAnnotationPresent(OrderBy.class))
        {
            OrderBy order = (OrderBy) field.getAnnotation(OrderBy.class);
            orderByColumns = order.value().split("\\s*,\\s*");
        }
        EmbeddedColumnInfo embeddedColumnInfo = new EmbeddedColumnInfo(embeddableType);
        embeddedColumnInfo.setEmbeddedColumnName(embeddableColName);
        Map<String, PropertyIndex> indexedColumns = IndexProcessor.getIndexesOnEmbeddable(embeddedEntityClass);
        List<ColumnInfo> columns = new ArrayList<ColumnInfo>();

        Set attributes = embeddableType.getAttributes();
        Iterator<Attribute> iter = attributes.iterator();

        while (iter.hasNext())
        {
            Attribute attr = iter.next();
            columns.add(getColumn(tableInfo, attr, indexedColumns.get(attr.getName()), orderByColumns));
        }
        embeddedColumnInfo.setColumns(columns);
        return embeddedColumnInfo;
    }
1290955
protected function createEmbeddedPath()
    {
        $path = upload_path('embedded');

        if ( ! file_exists($path))
        {
            if ( ! mkdir($path, 0777, true))
            {
                throw new RuntimeException('Directory (' . $path . ') could not be created.');
            }
        }
    }
1190787
public function setEmbeddedobjectscount($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->embeddedobjectscount !== $v) {
            $this->embeddedobjectscount = $v;
            $this->modifiedColumns[MxmapTableMap::COL_EMBEDDEDOBJECTSCOUNT] = true;
        }

        return $this;
    }
595661
protected Embedder newEmbedder() {
        Embedder embedder = null;
        EmbedderClassLoader classLoader = classLoader();
        if (injectableEmbedderClass != null) {
            embedder = classLoader.newInstance(InjectableEmbedder.class, injectableEmbedderClass).injectedEmbedder();
        } else {
            embedder = classLoader.newInstance(Embedder.class, embedderClass);
        }
        
        URL codeLocation = codeLocation();
        if (codeLocation != null) {
            embedder.configuration().storyReporterBuilder().withCodeLocation(codeLocation);
        }

        embedder.useClassLoader(classLoader);
        embedder.useEmbedderControls(embedderControls());
        if ( executorsClass != null ){
            ExecutorServiceFactory executorServiceFactory = classLoader.newInstance(ExecutorServiceFactory.class, executorsClass);
            embedder.useExecutorService(executorServiceFactory.create(embedder.embedderControls()));
        }
        embedder.useEmbedderMonitor(embedderMonitor());
        if (isNotEmpty(metaFilters)) {
            List<String> filters = new ArrayList<>();
            for (String filter : metaFilters) {
                if (filter != null) {
                    filters.add(filter);
                }
            }
            embedder.useMetaFilters(filters);
        }
        if (!systemProperties.isEmpty()) {
            embedder.useSystemProperties(systemProperties);
        }
        return embedder;
    }
1023503
public function addEmbedResource(AbstractResource $resource)
    {
        if (!in_array($resource, $this->embedResources)) {
            // Uses node ID as array key in order to avoid duplicates
            $this->embedResources[$resource->getResourceNode()->getId()] = $resource;
        }
    }
448077
public function addField(AttachmentField $field)
    {
        if (!isset($this->data['fields'])) {
            $this->data['fields'] = [];
        }

        $this->data['fields'][] = $field->data;

        return $this;
    }