@name updateMetadata

Updates metadata with icons.

@param SiteConfig $config
@param SiteTree $owner
@param $metadata
@return void
184706
public function updateMetadata(SiteConfig $config, SiteTree $owner, &$metadata) {

		// decode into array
		$data = json_decode($owner->OpenGraphData, true);

		// check for data or throw an error
		if ($data) {

			// check if off
			if ($data['og:type'] !== 'off') {

				// Header
				$metadata .= $owner->MarkupComment('Open Graph');

				// Type
				$metadata .= $owner->MarkupOpenGraph('og:type', $data['og:type']);

				// URL
				$metadata .= $owner->MarkupOpenGraph('og:url', $owner->AbsoluteLink());

				// Site Name
				$siteName = ($data['og:site_name']) ? $data['og:site_name'] : $config->Title;
				$metadata .= $owner->MarkupOpenGraph('og:site_name', $siteName, true);

				// Title
				$title = ($data['og:title']) ? $data['og:title'] : $owner->Title;
				$metadata .= $owner->MarkupOpenGraph('og:title', $title, true);

				// Description
				$description = ($data['og:description']) ? $data['og:description'] : $owner->GenerateDescription();
				$metadata .= $owner->MarkupOpenGraph('og:description', $description, true);

				// Image
				if ($owner->OpenGraphImage()->exists()) {
					$metadata .= $owner->MarkupOpenGraph('og:image', $owner->OpenGraphImage()->getAbsoluteURL());
				}

			} else {

				// OFF
				$metadata .= $owner->MarkupComment('Open Graph [ off ]');

			}

		} else {

			// ERROR
			$metadata .= $owner->MarkupComment('Open Graph [ error ]');

		}

	}
1040457
public function add_metadata_manifest(cc_i_metadata_manifest $met) {
        $metanode = $this->node("//imscc:manifest[@identifier='".
                                $this->activemanifest->manifestID().
                                "']/imscc:metadata");
        $nmeta = $this->activemanifest->create_metadata_node($met, $this->doc, $metanode);
        $metanode->appendChild($nmeta);
    }
836905
public function update( $model, $config = [] ) {

		$admin = isset( $config[ 'admin' ] ) ? $config[ 'admin' ] : false;

		if( $admin ) {

			return parent::update( $model, [
				'attributes' => [ 'roleId', 'status' ]
			]);
		}
		else {

			$model->syncedAt = DateUtil::getDateTime();
		}

		return parent::update( $model, [
			'attributes' => [ 'syncedAt' ]
		]);
	}
313096
public function creatOrUpdateByParent( $parent, $metas, $config = [] ) {

		$modelClass = static::$modelClass;

		// Disable all existing metas for given type
		if( isset( $config[ 'type' ] ) && isset( $config[ 'disable' ] ) ) {

			$this->disableByType( $parent, $config[ 'type' ] );
		}

		// Create/Update given metas
		if( !empty( $metas ) && count( $metas ) > 0 ) {

			foreach( $metas as $meta ) {

				$model = new $modelClass();

				$model->name	= $meta[ 'name' ];
				$model->label	= empty( $meta[ 'label' ] ) ? $meta[ 'name' ] : $meta[ 'label' ];
				$model->value	= $meta[ 'value' ];
				$model->type	= $meta[ 'type' ];
				$model->active	= true;
				$model->icon	= !empty( $meta[ 'icon' ] ) ? $meta[ 'icon' ] : null;

				$model->modelId	= $parent->id;

				$model->valueType = empty( $meta[ 'valueType' ] ) ? $modelClass::VALUE_TYPE_TEXT : $meta[ 'valueType' ];

				if( isset( $meta[ 'id' ] ) ) {

					$model->id		= $meta[ 'id' ];
					$model->icon	= !empty( $meta[ 'icon' ] ) ? $meta[ 'icon' ] : $model->icon;

					parent::update( $model, [ 'attributes' => [ 'icon', 'name', 'value', 'active', 'type', 'valueType' ] ] );
				}
				else {

					parent::create( $model );
				}
			}
		}
	}
638747
public function updateCMSFields(FieldList $fields)
    {
        // Insert Meta Tab:
        
        $fields->insertAfter(
            Tab::create(
                'Meta',
                $this->owner->getMetaTabTitle()
            ),
            'Main'
        );
        
        // Iterate Meta Field Configuration:
        
        foreach ($this->owner->getMetaFieldConfig() as $name => $spec) {
            
            if ($spec) {
                
                // Initialise:
                
                $params = [];
                $before = null;
                $method = "getMeta{$name}Fields";
                
                // Determine Specification Type:
                
                if (is_array($spec)) {
                    $tab    = isset($spec['tab'])    ? $spec['tab']    : 'Root.Meta';
                    $method = isset($spec['method']) ? $spec['method'] : "getMeta{$name}Fields";
                    $before = isset($spec['before']) ? $spec['before'] : null;
                    $params = isset($spec['params']) ? $spec['params'] : [];
                } else {
                    $tab = $spec;
                }
                
                // Add Fields to Specified Tab:
                
                if ($this->owner->hasMethod($method)) {
                    $fields->addFieldsToTab($tab, $this->owner->$method($params), $before);
                }
                
            }
            
        }
        
        // Remove Meta Tab (if empty):
        
        if (!$fields->fieldByName('Root.Meta')->getChildren()->exists()) {
            $fields->removeFieldFromTab('Root', 'Meta');
        }
    }
505982
private function updateConfigOverridedSectionsForSite(Config $config)
    {
        if (false === $this->application->isStarted()) {
            throw new BBException('Application is not started, we are not able to persist multiple site config.');
        }

        $default_sections = $this->configurator->getConfigDefaultSections($config);
        $current_sections = $config->getAllRawSections();

        $sections_to_update = array_keys(Collection::array_diff_assoc_recursive($default_sections, $current_sections));
        $sections_to_update = array_unique(array_merge(
            $sections_to_update,
            array_keys(Collection::array_diff_assoc_recursive($current_sections, $default_sections))
        ));

        $override_site = $config->getRawSection('override_site') ?: array();
        $site_uid = $this->application->getSite()->getUid();
        if (false === array_key_exists($site_uid, $override_site)) {
            $override_site[$site_uid] = array();
        }

        $override_sections_site = &$override_site[$site_uid];

        foreach ($sections_to_update as $section) {
            if ('override_site' !== $section) {
                $override_sections_site[$section] = $config->getRawSection($section);
            }
        }

        $config->deleteAllSections();
        foreach ($this->configurator->getConfigDefaultSections($config) as $section_name => $section_settings) {
            $config->setSection($section_name, $section_settings);
        }

        $config->setSection('override_site', $override_site, true);
    }
1360504
public function updateMetadata(ProcessingMetadata $metadata)
    {
        $this->recordThat(TaskMetadataWasUpdated::record($this->id(), $metadata));
    }
69987
public function setData($property = AnDomain::ACCESS_PUBLIC, $default = null)
    {
        $config_file_path = ANPATH_SITE.DS.'components'.DS.$this->package.DS.'config.json';

        if(file_exists($config_file_path)) {

            $app_config = json_decode(file_get_contents($config_file_path));
            $fields = $app_config->fields;

            foreach ($fields as $field) {
                $key = $field->name;
                if(isset($property['meta'][$key])){
                    $this->setValue($key, $property['meta'][$key]);
                }
            }
        }

        parent::setData($property, $default);
    }
343943
protected function addMetaTag(&$tags, $property = null, $content = null)
    {
        if (is_array($content)) {
            
            foreach ($content as $value) {
                $this->addMetaTag($tags, $property, $value);
            }
            
        } else {
            
            if ($content) {
                $tags .= $this->getMetaTag($property, $content);
            }
            
        }
    }
593216
protected function configToolMetadata(ConfigXML $config, $id)
    {
        $tool = $config->toArray('/config/tool')[0];

        $this->config(static::TOOL_ID, $id);
        $this->config(static::TOOL_NAME, (empty($tool['name']) ? $id : $tool['name']));
        $configPath = dirname($this->config(static::TOOL_CONFIG_FILE));

        $params = [
            'description' => static::TOOL_DESCRIPTION,
            'icon' => static::TOOL_ICON_URL,
            'domain' => static::TOOL_DOMAIN,
            'launch-privacy' => static::TOOL_LAUNCH_PRIVACY,
            'authenticate' => static::TOOL_LAUNCH_URL
        ];

        foreach ($params as $src => $dest) {
            if (empty($tool[$src])) {
                $this->clearConfig($dest);
            } else {
                if (substr($dest, -4) == '_URL') {
                    $this->config($dest, DataUtilities::URLfromPath(
                        $tool[$src],
                        $_SERVER,
                        $configPath)
                    );
                } else {
                    $this->config($dest, $tool[$src]);
                }
            }
        }

        if (empty($this->config(static::TOOL_LAUNCH_PRIVACY))) {
            $this->config(static::TOOL_LAUNCH_PRIVACY, static::DEFAULT_LAUNCH_PRIVACY);
        }

        if (empty($this->config(static::TOOL_LAUNCH_URL))) {
            $this->config(static::TOOL_LAUNCH_URL, DataUtilities::URLfromPath($_SERVER['SCRIPT_FILENAME']));
        }

        $this->log('Tool metadata configured');
    }
682088
public function update($path, $contents, Config $config)
    {
        if (! $config->has('visibility') && ! $config->has('ACL')) {
            $config->set(static::$metaMap['ACL'], $this->getObjectACL($path));
        }
        // $this->delete($path);
        return $this->write($path, $contents, $config);
    }
474656
private function update(PropertyMetadata $propertyMetadata, array $metadata): PropertyMetadata
    {
        $metadataAccessors = [
            'description' => 'get',
            'readable' => 'is',
            'writable' => 'is',
            'writableLink' => 'is',
            'readableLink' => 'is',
            'required' => 'is',
            'identifier' => 'is',
            'iri' => 'get',
            'attributes' => 'get',
        ];

        foreach ($metadataAccessors as $metadataKey => $accessorPrefix) {
            if (null === $metadata[$metadataKey]) {
                continue;
            }

            $propertyMetadata = $propertyMetadata->{'with'.ucfirst($metadataKey)}($metadata[$metadataKey]);
        }

        if ($propertyMetadata->hasSubresource()) {
            return $propertyMetadata;
        }

        return $propertyMetadata->withSubresource($this->createSubresourceMetadata($metadata['subresource'], $propertyMetadata));
    }
1328080
private function setDefaultValuesOnMetadata(MetadataInterface $metadata, array $defaultValues)
    {
        foreach ($defaultValues as $propertyPath => $value) {
            if (null !== $this->propertyAccessor->getValue($metadata, $propertyPath)) {
                continue;
            }

            $this->propertyAccessor->setValue($metadata, $propertyPath, $value);
        }
    }
658457
public function readExtendedMetadata($meta, array &$config)
    {
        if (!$meta instanceof ExtensibleClassMetadata) {
            return;
        }

        $config = array_merge_recursive($config, $meta->getExtension(
            $this->getExtensionName()
        ));
    }
1147408
public function updateMetadata(EventInterface $event) {
        $request = $event->getRequest();

        $event->getDatabase()->updateMetadata(
            $request->getUser(),
            $request->getImageIdentifier(),
            $event->getArgument('metadata')
        );

        $event->getDatabase()->setLastModifiedNow(
            $request->getUser(),
            $request->getImageIdentifier()
        );
    }
1305420
protected function buildCollectionCacheKey(AssociationMetadata $association, $ownerId)
    {
        /** @var ClassMetadata $metadata */
        $metadata = $this->metadataFactory->getMetadataFor($association->getSourceEntity());

        return new CollectionCacheKey($metadata->getRootClassName(), $association->getName(), $ownerId);
    }
1065574
public function updateCachedMetadata()
    {
        $ed = $this->getEntitiesDescriptor();
        $ed = $this->exclude($ed);
        $ed = $this->filter($ed);
        $this->addSignature($ed);

        $xml = $ed->toXML();
        $xml = $xml->ownerDocument->saveXML($xml);

        if ($this->cacheGenerated !== null) {
            Logger::debug($this->logLoc.'Saving generated metadata to cache.');
            $this->addCacheItem($this->cacheId, $xml, time() + $this->cacheGenerated, $this->cacheTag);
        }

        return $xml;
    }