Update Form Fields in a PDF Document.

@param array $fieldArray Fields in an array
@param string $documentFolder Where the template resides

@return bool
@throws Exception
555100
public function updateFormFields(array $fieldArray, $documentFolder = '')
    {
        if (count($fieldArray) === 0)
            throw new Exception('Field array cannot be empty');

        //build URI
        $strURI = Product::$baseProductUri . '/pdf/' . $this->getFileName() . '/fields?folder=' . $documentFolder;

        //sign URI
        $signedURI = Utils::sign($strURI);

        $postData = json_encode(array(
            'List' => $fieldArray
        ));

        //get response stream
        $responseStream = Utils::processCommand($signedURI, 'PUT', 'JSON', $postData);
        $json = json_decode($responseStream);

        $v_output = Utils::validateOutput($responseStream);

        if ($v_output === '') {
            //Save docs on server
            $folder = new Folder();

            if ($documentFolder) {
                $outputStream = $folder->getFile($documentFolder . '/' . $this->getFileName());
            } else {
                $outputStream = $folder->getFile($this->getFileName());
            }

            $outputPath = AsposeApp::$outPutLocation . $this->getFileName();
            Utils::saveFile($outputStream, $outputPath);
            return $outputPath;
        } else
            return $v_output;
    }
1241626
public function setDocumentPersister(string $documentName, Persisters\DocumentPersister $persister) : void
    {
        $this->persisters[$documentName] = $persister;
    }
443116
public function updateCMSFields(FieldList $fields)
    {
        // Create Style Fields:
        
        $fields->addFieldToTab(
            'Root.Style',
            FieldSection::create(
                'ImageResizeStyle',
                $this->owner->fieldLabel('ImageResizeStyle'),
                [
                    DimensionsField::create(
                        'ImageResize',
                        $this->owner->fieldLabel('ImageResize')
                    ),
                    DropdownField::create(
                        'ImageResizeMethod',
                        $this->owner->fieldLabel('ImageResizeMethod'),
                        $this->tools()->getResizeMethods()
                    )->setEmptyString(' ')->setAttribute('data-placeholder', _t(__CLASS__ . '.NONE', 'None'))
                ]
            )
        );
    }
34371
private function persistDocument($data, $document, $locale, $articleUuid)
    {
        if (array_key_exists('title', $data)) {
            throw new ParameterNotAllowedException('title', get_class($document));
        }

        $article = $this->getDocumentManager()->find($articleUuid, $locale);

        if (!array_key_exists('template', $data)) {
            $data['template'] = $article->getStructureType();
        }

        $formType = $this->getMetadataFactory()->getMetadataForAlias('article_page')->getFormType();

        $form = $this->createForm(
            $formType,
            $document,
            [
                // disable csrf protection, since we can't produce a token, because the form is cached on the client
                'csrf_protection' => false,
            ]
        );
        $form->submit($data, false);

        $document->setParent($article);

        if (!$form->isValid()) {
            throw new InvalidFormException($form);
        }

        $this->getDocumentManager()->persist(
            $document,
            $locale,
            [
                'user' => $this->getUser()->getId(),
                'clear_missing_content' => false,
                'auto_name' => false,
                'auto_rename' => false,
            ]
        );
    }
477090
public static MozuUrl updateTreeDocumentContentUrl(String documentListName, String documentName)
	{
		UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documentTree/{documentName}/content?folderPath={folderPath}&folderId={folderId}");
		formatter.formatUrl("documentListName", documentListName);
		formatter.formatUrl("documentName", documentName);
		return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
	}
126942
public function updateCMSFields(FieldList $fields)
    {
        $owner = $this->owner;

        $fields->removeByName(
            array(
                'SiteTreeID',
                'Anchor'
            )
        );

        // Insert site tree field after the file selection field
        $fields->insertAfter(
            'Type',
            DisplayLogicWrapper::create(
                TreeDropdownField::create(
                    'SiteTreeID',
                    _t('Links.PAGE', 'Page'),
                    'SiteTree'
                ),
                TextField::create(
                    'Anchor',
                    _t('Links.ANCHOR', 'Anchor/Querystring')
                )->setRightTitle(_t('Links.ANCHORINFO', 'Include # at the start of your anchor name or, ? at the start of your querystring'))
            )->displayIf("Type")->isEqualTo("SiteTree")->end()
        );

        // Display warning if the selected page is deleted or unpublished
        if ($owner->SiteTreeID && !$owner->SiteTree()->isPublished()) {
            $fields
                ->dataFieldByName('SiteTreeID')
                ->setRightTitle(_t('Links.DELETEDWARNING', 'Warning: The selected page appears to have been deleted or unpublished. This link may not appear or may be broken in the frontend'));
        }
    }
188635
public function updateFormFields(FieldList $fields, $controller, $formName, $context)
    {
        $image = isset($context['Record']) ? $context['Record'] : null;
        if ($image && $image->appCategory() === 'image') {
            $fields->insertAfter(
                'Title',
                FocusPointField::create('FocusPoint', $image->fieldLabel('FocusPoint'), $image)
                    ->setReadonly($formName === 'fileSelectForm')
            );
        }
    }
546677
public function updateCMSFields(FieldList $fields)
    {
        /** Only allow authors or higher! */
        $fields->addFieldToTab(
            'Root', // What tab
            TabSet::create(
                'Newssettings', _t('NewsSiteConfigExtension.NEWSCOMMENTS', 'News settings')
            )
        );
        if (($this->owner->AllowAuthors && $this->owner->canEdit(Member::currentUser())) || Member::currentUser()->inGroup('administrators')) {
            $userTabs = array();
            foreach (self::$config_tabs as $tab) {
                $userTabs[] = $this->$tab();
            }
            $fields->addFieldsToTab('Root.Newssettings', $userTabs);
        } else {
            $fields->addFieldToTab('Root.Newssettings', HeaderField::create('NoPermissions', _t('NewsSiteConfigExtension.PERMISSIONERROR', 'You do not have the permission to edit these settings')));
        }
        if (Member::currentUser()->inGroup('administrators')) {
            $adminTabs = array();
            foreach (self::$admin_tabs as $tab) {
                $adminTabs[] = $this->$tab();
            }
            $fields->addFieldsToTab('Root.Newssettings', $adminTabs, 'Help');
        }
    }
1016613
public void update(SwingBoxDocument doc, Viewport root, Dimension dim)
            throws IOException
    {
        ContentReader rdr = new ContentReader();
        List<ElementSpec> elements = rdr.update(root, dim, getCSSBoxAnalyzer());
        ElementSpec elementsArray[] = elements.toArray(new ElementSpec[0]);
        doc.create(elementsArray);
    }
831595
public function update($namespace, $document, $filter)
    {
        $bulk = new BulkWrite();

        try {
            $bulk->update($filter, key($document)[0] === '$' ? $document : ['$set' => $document], ['multi' => true]);
        } catch (\Exception $exception) {
            throw new MongodbException($exception->getMessage(), $exception->getCode(), $exception);
        }

        return $this->bulkWrite($namespace, $bulk)->getModifiedCount();
    }
807250
public function updateCMSFields(FieldList $fields)
    {
        $fields->addFieldsToTab(
            'Root.Actions',
            array(
                UploadField::create(
                    'ActionImage',
                    _t('Actions.IMAGE', 'Image')
                ),
                TextareaField::create(
                    'ActionSummary',
                    _t('Actions.SUMMARY', 'Summary')
                )->setRows(3),
                TextField::create(
                    'ActionLabel',
                    _t('Actions.LABEL', 'More')
                )
            )
        );
        return $fields;
    }
1022004
public function bulkUpdate($namespace, $documents, $primaryKey)
    {
        $bulk = new BulkWrite();

        foreach ($documents as $document) {
            $pkValue = $document[$primaryKey];
            unset($document[$primaryKey]);
            try {
                $bulk->update([$primaryKey => $pkValue], key($document)[0] === '$' ? $document : ['$set' => $document]);
            } catch (\Exception $exception) {
                throw new MongodbException($exception->getMessage(), $exception->getCode(), $exception);
            }
        }

        return $this->bulkWrite($namespace, $bulk)->getModifiedCount();
    }
483515
public function updateCMSFields(FieldList $fields)
    {
        // Update Field Objects (from parent):
        
        parent::updateCMSFields($fields);
        
        // Create Google Tab:
        
        $fields->findOrMakeTab(
            'Root.SilverWare.Services.Google',
            $this->owner->fieldLabel('Google')
        );
        
        // Define Placeholders:
        
        $placeholderAuto = _t(__CLASS__ . '.DROPDOWNAUTOMATIC', 'Automatic');
        
        // Create Field Objects:
        
        $fields->addFieldsToTab(
            'Root.SilverWare.Services.Google',
            [
                FieldSection::create(
                    'GoogleAPIConfig',
                    $this->owner->fieldLabel('GoogleAPIConfig'),
                    [
                        TextField::create(
                            'GoogleAPIKey',
                            $this->owner->fieldLabel('GoogleAPIKey')
                        )->setRightTitle(
                            _t(
                                __CLASS__ . '.GOOGLEAPIKEYRIGHTTITLE',
                                'Create credentials using the Google API Manager and paste the API key here.'
                            )
                        ),
                        DropdownField::create(
                            'GoogleAPILanguage',
                            $this->owner->fieldLabel('GoogleAPILanguage'),
                            $this->owner->getGoogleLanguageOptions()
                        )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholderAuto)
                    ]
                ),
                FieldSection::create(
                    'GoogleAnalyticsConfig',
                    $this->owner->fieldLabel('GoogleAnalyticsConfig'),
                    [
                        CheckboxField::create(
                            'GoogleAnalyticsEnabled',
                            $this->owner->fieldLabel('GoogleAnalyticsEnabled')
                        ),
                        TextField::create(
                            'GoogleAnalyticsTrackingID',
                            $this->owner->fieldLabel('GoogleAnalyticsTrackingID')
                        )->setAttribute('spellcheck', 'false')
                    ]
                ),
                FieldSection::create(
                    'GoogleVerificationConfig',
                    $this->owner->fieldLabel('GoogleVerificationConfig'),
                    [
                        TextField::create(
                            'GoogleVerificationCode',
                            $this->owner->fieldLabel('GoogleVerificationCode')
                        )->setAttribute('spellcheck', 'false')
                    ]
                )
            ]
        );
    }
615788
public function updatePageOptions(FieldList $fields)
    {
        $pageTypeField = $fields->fieldByName('PageType');
        foreach ($pageTypeField->getSource() as $classKey => $classValue) {
            if ($classKey == 'PlaceablePage') {
                foreach (PlaceablePageType::get() as $type) {
                    $html = sprintf('%s<strong class="title">%s</strong><span class="description">%s</span>',
                        ($type->Icon()->exists()) ? '<img class="page-icon" src="'.$type->Icon()->croppedImage(16,16)->URL.'" />': '<span class="page-icon"></span>',
                        $type->Title,
                        $type->Description
                    );
                    $PageTypes["$classKey-$type->ID"] = DBField::create_field('HTMLText', $html);
                }
            } else {
                $PageTypes["$classKey-0"] = $classValue;
            }
        }

        $numericLabelTmpl = '<span class="step-label"><span class="flyout">%d</span><span class="arrow"></span><span class="title">%s</span></span>';

        $fields->removeByName(
            array(
                'PageType',
                'RestrictedNote'
            )
        );
        $fields->addFields(
            array(
                OptionsetField::create(
                    'PageTypeFake',
                    sprintf($numericLabelTmpl, 2, _t('CMSMain.ChoosePageType', 'Choose page type')),
                    $PageTypes
                ),
                HiddenField::create('PageType','PageType'),
                HiddenField::create('PageTypeID','PageTypeID')
            )
        );
        return $fields;
    }
388201
public function setFieldValue($document, $field, $value)
    {
        if ($document instanceof Proxy && ! $document->__isInitialized()) {
            //property changes to an uninitialized proxy will not be tracked or persisted,
            //so the proxy needs to be loaded first.
            $document->__load();
        }

        $this->reflFields[$field]->setValue($document, $value);
    }
319923
public function updateSettingsFields(FieldList $fields)
    {
        $fields->removeByName('ClassName');
        $PageTypes = array();
        foreach ($this->owner->ClassDropdown as $classKey => $classValue) {
            if ($classKey == 'PlaceablePage') {
                foreach (PlaceablePageType::get()->map('ID','Title') as $placeableKey => $placeableValue) {
                    $PageTypes["$classKey-$placeableKey"] = $placeableValue;
                }
            } else {
                $PageTypes["$classKey-0"] = $classValue;
            }

        }
        $fields->addFieldsToTab(
            'Root.Settings',
            array(
                DropdownField::create(
                    'PageTypeFake',
                    _t('PlaceablePage.PAGETYPE', 'Page type'),
                    $PageTypes
                ),
                HiddenField::create('ClassName'),
                HiddenField::create('PageTypeID'),

            ),
            'ParentType'
        );
        return $fields;
    }
101745
public function updateCMSFields(FieldList $fields)
    {
        // Define Placeholder:
        
        $placeholder = _t(__CLASS__ . '.DROPDOWNSELECT', 'Select');
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                DropdownField::create(
                    'ListSourceID',
                    $this->owner->fieldLabel('ListSourceID'),
                    $this->getListSourceOptions()
                )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder)
            ]
        );
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'ListSourceOptions',
                $this->owner->fieldLabel('ListSourceOptions'),
                [
                    TextField::create(
                        'NumberOfItems',
                        $this->owner->fieldLabel('NumberOfItems')
                    ),
                    DropdownField::create(
                        'SortItemsBy',
                        $this->owner->fieldLabel('SortItemsBy'),
                        $this->owner->getSortItemsByOptions()
                    ),
                    CheckboxField::create(
                        'ReverseItems',
                        $this->owner->fieldLabel('ReverseItems')
                    ),
                    CheckboxField::create(
                        'ImageItems',
                        $this->owner->fieldLabel('ImageItems')
                    )
                ]
            )
        );
        
        // Create Pagination Options (if permitted):
        
        if ($this->owner->canPaginate()) {
            
            $fields->insertBefore(
                SelectionGroup::create(
                    'PaginateItems',
                    [
                        SelectionGroup_Item::create(
                            '0',
                            null,
                            $this->owner->fieldLabel('Disabled')
                        ),
                        SelectionGroup_Item::create(
                            '1',
                            TextField::create(
                                'ItemsPerPage',
                                $this->owner->fieldLabel('ItemsPerPage')
                            ),
                            $this->owner->fieldLabel('Enabled')
                        )
                    ]
                )->setTitle($this->owner->fieldLabel('PaginateItems')),
                'ReverseItems'
            );
            
        }
    }