Skip to content

[6.x] Add explicit package param to installed tag#14858

Merged
jasonvarga merged 4 commits into
statamic:6.xfrom
daun:feature/installed-tag-param
Jun 23, 2026
Merged

[6.x] Add explicit package param to installed tag#14858
jasonvarga merged 4 commits into
statamic:6.xfrom
daun:feature/installed-tag-param

Conversation

@daun

@daun daun commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Allow using the installed tag with a param. Currently, only wildcard usage is supported.

{{ package_name = "scope/package" }}

{{ installed :package="package_name" }}yes{{ /installed }}

@jasonvarga jasonvarga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index() passes null into Composer::isInstalled(string $package) when package is missing/empty, throwing a TypeError and crashing the render (previously {{ installed }} just returned empty). Easy to hit via {{ installed :package="var" }} when var is unset. Can you guard it?

public function index()
{
    if (! $package = $this->params->get('package')) {
        return;
    }

    return $this->installed($package);
}

@daun

daun commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

@jasonvarga Right, good catch! I've pushed your proposed change.

@daun daun requested a review from jasonvarga June 23, 2026 07:57
@jasonvarga jasonvarga enabled auto-merge (squash) June 23, 2026 14:45
@jasonvarga jasonvarga merged commit 70fb0c3 into statamic:6.x Jun 23, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants