Tags an asset with a tag.

No redirection and no response body, no flash message, for use by plupload (or similar).

@param Asset $asset
@param Tag $tag
@return void
@throws IllegalObjectTypeException
513127
public function tagAssetAction(Asset $asset, Tag $tag): void
    {
        $success = false;
        if ($asset->addTag($tag)) {
            $this->assetRepository->update($asset);
            $success = true;
        }
        $this->view->assign('value', $success);
    }
291314
public function clean_asset_tags($tag)
    {
        \preg_match_all(
            "!<link rel='stylesheet'\s?(id='[^']+')?\s+href='(.*)' type='text/css' media='(.*)' />!",
            $tag,
            $matches
        );
       
        if (empty($matches[2])) {
            return $tag;
        }

        $media = $matches[3][0] !== '' && $matches[3][0] !== 'all' ? ' media="' . $matches[3][0] . '"' : '';

        return "\t".'<link rel="stylesheet" href="' . $matches[2][0] . '"' . $media . '>' . "\n";
    }
1298426
public function assets(AssetFactory $asset)
    {
        $asset->add('fielder-tinymce', [
            'path' => FIELDER_URI.'public/js/tinymce.js',
            'dependences' => ['fielder'],
        ])->area('admin');

        Hook::action('admin_enqueue_scripts', function () {
            wp_enqueue_media();
        })->dispatch();
    }
253712
public function hasTag(Tag $tag)
    {
        foreach ($this->_tags as $knownTag) {
            if ($knownTag->getId() == $tag->getId()) {
                return true;
            }
        }

        return false;
    }
1307644
private function record_tag($tag)
    {
        if (isset($this->tags[$tag . 'count'])) { //check for the existence of this tag type
            $this->tags[$tag . 'count']++;
            $this->tags[$tag . $this->tags[$tag . 'count']] = $this->indent_level; //and record the present indent level
        } else { //otherwise initialize this tag type
            $this->tags[$tag . 'count'] = 1;
            $this->tags[$tag . $this->tags[$tag . 'count']] = $this->indent_level; //and record the present indent level
        }
        $this->tags[$tag . $this->tags[$tag . 'count'] . 'parent'] = $this->tags['parent']; //set the parent (i.e. in the case of a div this.tags.div1parent)
        $this->tags['parent'] = $tag . $this->tags[$tag . 'count']; //and make this the current parent (i.e. in the case of a div 'div1')
    }
1132042
protected function initTag(VcsDriverInterface $driver, $packageName, $tag, $identifier)
    {
        if (null !== $this->filter && $this->filter->skip($this->assetType, $packageName, $tag)) {
            return;
        }

        if (!$parsedTag = Validator::validateTag($tag, $this->assetType, $this->versionParser)) {
            if ($this->verbose) {
                $this->io->write('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
            }

            return;
        }

        $this->initTagAddPackage($driver, $packageName, $tag, $identifier, $parsedTag);
    }
7320
public function flushByTag($tag)
    {
        $this->throwExceptionIfFrontendDoesNotExist();

        $this->logger->debug('SFC flushByTags', [$tag]);
        $identifiers = $this->findIdentifiersByTagIncludingExpired($tag);

        if ($this->isBoostMode()) {
            $this->getQueue()->addIdentifiers($identifiers);

            return;
        }

        foreach ($identifiers as $identifier) {
            $this->removeStaticFiles($identifier);
        }
        parent::flushByTag($tag);
    }
1204190
public void addTaggedComponent(final String tag, final WComponent component) {
		if (Util.empty(tag)) {
			throw new IllegalArgumentException("A tag must be provided.");
		}
		if (component == null) {
			throw new IllegalArgumentException("A component must be provided.");
		}

		TemplateModel model = getOrCreateComponentModel();
		if (model.taggedComponents == null) {
			model.taggedComponents = new HashMap<>();
		} else {
			if (model.taggedComponents.containsKey(tag)) {
				throw new IllegalArgumentException("The tag [" + tag + "] has already been added.");
			}
			if (model.taggedComponents.containsValue(component)) {
				throw new IllegalArgumentException("Component has already been added.");
			}
		}
		model.taggedComponents.put(tag, component);
		add(component);
	}
620273
protected void addTag(IcyTag tag)
	{
		tags.put(tag.getName(), tag);
		fireTagParsed(this, tag);
	}
941280
public function updateTags($tags)
    {
        $app = Application::getFacadeApplication();
        $tags = self::cleanTags($tags);
        $this->fvTags = $tags;
        $this->save();
        $this->logVersionUpdate(self::UT_TAGS);
        $fve = new FileVersionEvent($this);
        $app->make(EventDispatcherInterface::class)->dispatch('on_file_version_update_tags', $fve);
    }
530696
public static function validateTag($tag, AssetTypeInterface $assetType, VersionParser $parser = null)
    {
        if (\in_array($tag, array('master', 'trunk', 'default'), true)) {
            return false;
        }

        if (null === $parser) {
            $parser = new VersionParser();
        }

        try {
            $tag = $assetType->getVersionConverter()->convertVersion($tag);
            $tag = $parser->normalize($tag);
        } catch (\Exception $e) {
            $tag = false;
        }

        return $tag;
    }
33458
def asset_tags(asset_id)
      tag_summary = []
      asset_tag   = JSON.parse(AJAX.get(self, "/api/2.0/assets/#{asset_id}/tags", AJAX::CONTENT_TYPE::JSON, { per_page: 2_147_483_647 }))
      asset_tag['resources'].select { |r| r['asset_ids'].find { |i| i == asset_id } }.each do |json|
        tag_summary << TagSummary.parse(json)
      end
      tag_summary
    end
1342119
def set_asset_tag(asset_tag)
      @logger.warn '[Deprecated] `set_asset_tag` is deprecated. Please use `set_system_settings(AssetTag: <tag>)` instead.'
      new_action = { 'AssetTag' => asset_tag }
      response = rest_patch('/redfish/v1/Systems/1/', body: new_action)
      response_handler(response)
      true
    end
1132605
public function registerAssetChange(AssetInterface $asset)
    {
        if (!$asset->isInUse()) {
            return;
        }

        $cachingHelper = $this->getCachingHelper();

        foreach ($this->assetService->getUsageReferences($asset) as $reference) {
            if (!$reference instanceof AssetUsageInNodeProperties) {
                continue;
            }

            $workspaceHash = $cachingHelper->renderWorkspaceTagForContextNode($reference->getWorkspaceName());

            $this->registerChangeOnNodeIdentifier($workspaceHash . '_' . $reference->getNodeIdentifier());
            $this->registerChangeOnNodeType($reference->getNodeTypeName(), $reference->getNodeIdentifier(), $workspaceHash);

            $assetIdentifier = $this->persistenceManager->getIdentifierByObject($asset);

            $tagName = 'AssetDynamicTag_' . $workspaceHash . '_' . $assetIdentifier;
            $this->tagsToFlush[$tagName] = sprintf('which were tagged with "%s" because asset "%s" has changed.', $tagName, $assetIdentifier);
        }
    }
1182091
protected function buildRuntimeTagRendererException(TagInterface $tag)
    {
        $msg = sprintf('No template tag renderer has been found for the "%s_%s" tag', $tag->getCategory(), $tag->getType());

        if ($tag instanceof RequireTagInterface) {
            $msg .= sprintf(' with the asset "%s"', $tag->getPath());
        }

        return new RuntimeTagRendererException($msg);
    }
1290528
protected function isValidTag(string $tag, Message $message = null): void
    {
        $allowedTag = $this->getAllowedTag();
        if (!\in_array($tag, $allowedTag, true)) {
            throw new InvalidKeyException(sprintf(
                'tag must be either "%s".',
                implode(', ', $allowedTag)
            ));
        }

        if ($tag === SendInterface::TAG_ISSUE_RESOLUTION && $message !== null && !$message instanceof GenericTemplate) {
            throw new InvalidClassException(sprintf(
                'message must be an instance of %s if tag is set to %s.',
                GenericTemplate::class,
                SendInterface::TAG_ISSUE_RESOLUTION
            ));
        }
    }
1236498
public static void writeTag(DataOutput out, Tag tag) throws IOException {
        out.writeByte(TagRegistry.getIdFor(tag.getClass()));
        out.writeUTF(tag.getName());
        tag.write(out);
    }