PHPackages                             open-csp/w-s-slots - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. open-csp/w-s-slots

ActiveMediawiki-extension

open-csp/w-s-slots
==================

This extension provides a mechanism to create new slots.

v4.6.1(1y ago)21.6k8[1 issues](https://github.com/Open-CSP/WSSlots/issues)GPL-2.0-or-laterPHP

Since Jul 13Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/Open-CSP/WSSlots)[ Packagist](https://packagist.org/packages/open-csp/w-s-slots)[ RSS](/packages/open-csp-w-s-slots/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (26)Used By (0)

WSSlots
=======

[](#wsslots)

This extension provides a mechanism to create new slots.

Installation
------------

[](#installation)

- Download an place the file(s) in a directory called `WSSlots` in your `extensions/` folder.
- Run Composer to install PHP dependencies, by issuing `composer install --no-dev` in the extension directory.
- Add the following code to the bottom of your LocalSettings.php:

    ```
    wfLoadExtension( 'WSSlots' );
    ```
- Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration
-------------

[](#configuration)

The extension provides the following configuration options:

### `$wgWSSlotsDefinedSlots`

[](#wgwsslotsdefinedslots)

This is an array of the slots to define. Each item in the array corresponds to the name of the slot to define. It is also possible to optionally configure the slot's content model and slot role layout, like so:

```
$wgWSSlotsDefinedSlots = [
    "example" => [
        "content_model" => "wikitext",
        "slot_role_layout" => [
            "display" => "none",
            "region" => "center",
            "placement" => "append"
        ]
    ]
];
```

This configuration variable is also exposed as a JavaScript variable and can be accessed like so:

```
var site_slots = mw.config.get('wgWSSlotsDefinedSlots');
```

Please note that this only covers slots created by the WSSlots extension.

For more information on content models see [MediaWiki.org](https://www.mediawiki.org/wiki/Manual:Page_content_models) and for more information on slot role layouts see [here](https://doc.wikimedia.org/mediawiki-core/master/php/classMediaWiki_1_1Revision_1_1SlotRoleHandler.html#a42a50a9312fd931793c3573808f5b8a1).

### `$wgWSSlotsDefaultContentModel`

[](#wgwsslotsdefaultcontentmodel)

This is the default content model to use, if no content model is given explicitly.

### `$wgWSSlotsDefaultSlotRoleLayout`

[](#wgwsslotsdefaultslotrolelayout)

This is the default slot role layout to use, if no slot role layout is given explicitly.

### `$wgWSSlotsSemanticSlots`

[](#wgwsslotssemanticslots)

This configuration parameter defines which slots should be analysed for semantic annotations.

### `$wgWSSlotsDoPurge`

[](#wgwsslotsdopurge)

This configuration option specifies whether to purge the page after a slot edit is performed.

### `$wgWSSlotsOverrideActions`

[](#wgwsslotsoverrideactions)

When set to true, all actions are replaced by slot-aware actions when available. When set to an array, each item in the array specifies an action to replace with its slot aware counterpart. See [\#Actions](#Actions) below for a list of available slot-aware actions.

Parser functions
----------------

[](#parser-functions)

### `#slot`

[](#slot)

The extension provides the `#slot` parser function to get the content of a specific slot. For example, `{{#slot: main}}` returns the content of the `main` slot. You can optionally specify a page as the second parameter. For instance, `{{#slot: main | Foobar }}` gets the `main` slot from the page `Foobar`. An additional third parameter can be set to anything to have the returned content parsed.

### `#slotdata`

[](#slotdata)

The extension provides the `#slotdata` parser function to get structured content from a specific slot. The syntax of the parser function is as follows:

```
{{#slotdata:  | [ | [ | [ | []]]]}}

```

- ``: The name of the slot to get the data from.
- `` (optional, default: `{{FULLPAGENAME}}` ): The name of the page to get the data from.
- `` (optional, default: ``): The key of the value to return. Use a JSONPath expression to traverse the path in your structure, regardless whether you are accessing JSON or wiki template content. Both dot and bracket styles of notation are acceptable. To retrieve the raw content of an element, add '\_text' as the final node. For instance, if your wiki page uses a single template called "Log" and you want to get the content of a template parameter "Hours spent today", you can request it with the following expression: `Log[0]["Hours spent today"]["_text"]`, or alternatively, `Log.0\["Hours spent today"\].\_text`.
- `` (optional, default: ``): The search to perform before looking for the key, should be of the form `key=value`. If the given key-value pair is not unique, the first enclosing block that contains that pair will be used.
- `` (optional, default: false): Whether to return the result in a manner that [ArrayFunctions](https://www.mediawiki.org/wiki/Extension:ArrayFunctions) understands. Requires ArrayFunctions to be installed and enabled.

This function is aware of the content model of the page. This means that it parses a page differently, depending on what the content model is. The content models from which it can extract structured data are:

- `JsonContent`: Parses the page as JSON;
- `WikitextContent`: Parses the page using a wikitext parser to get template calls.

### `#slottemplates` (deprecated)

[](#slottemplates-deprecated)

The extension also provides the `#slottemplates` parser function that returns the templates in a specific slot as a multidimensional array. This parser function required WSArrays to be installed.

The parser function has two modes of operation. It can either process templates non-recursively (DEPRECATED), or it can process them recursively (RECOMMENDED). With the non-recursive parser function, multiple templates with the same name are not supported and nested template calls are not processed. With recursive parsing, this is supported. Recursive parsing also supports retrieving the original unparsed content of an argument.

The syntax of the parser function is as follows:

```
{{#slottemplates:  |  |  |  }}

```

Lua functions
-------------

[](#lua-functions)

The following Lua functions are available:

### `mw.slots.slotContent(slotName, pageName)`

[](#mwslotsslotcontentslotname-pagename)

Mirrors the functionality of the #slot parser function and makes it available in Lua. It takes the following parameters:

- `slotName` (required, string): The name of the slot to get the content for;
- `pageName` (optional, string, default=`{{PAGENAME}}`): The name of the page to get the slot from.

### `mw.slots.slotTemplates(slotName, pageName)` (deprecated)

[](#mwslotsslottemplatesslotname-pagename-deprecated)

Mirrors the functionality of the #slottemplates parser function and makes it available in Lua. It takes the following parameters:

- `slotName` (required, string): The name of the slot to get the templates for;
- `pageName` (optional, string, default=`{{PAGENAME}}`): The name of the page to get the slot from.

This function is deprecated and will be replaced by `mw.slots.slotData()` soon.

### `mw.slots.slotContentModel(slotName, pageName)`

[](#mwslotsslotcontentmodelslotname-pagename)

Returns the content model of the specified slot. It takes the following parameters:

- `slotName` (required, string): The name of the slot to get the content model for;
- `pageName` (optional, string, default=`{{PAGENAME}}`): The name of the page to get the slot from.

### `mw.slots.slotData(slotName, pageName)`

[](#mwslotsslotdataslotname-pagename)

Mirrors the functionality of the #slotdata parser function and makes it available in Lua. This function omits any advanced selection tools (JSONPath). It takes the following parameters:

- `slotName` (required, string): The name of the slot to get the data for;
- `pageName` (optional, string, default=`{{PAGENAME}}`): The name of the page to get the slot from.

Actions
-------

[](#actions)

### `rawslot`

[](#rawslot)

Slot-aware version of `action=raw` (see [RawAction](https://m.mediawiki.org/wiki/Manual:RawAction.php)). Returns the content of the specified slot as raw value (format depends on the slot content model). Example:

```
/wiki/MyMultislotPage?action=rawslot&slot=someslot

```

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance59

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~63 days

Recently: every ~162 days

Total

22

Last Release

432d ago

Major Versions

v1.4.2 → v2.0.02022-04-04

v2.2.0 → v3.0.02022-05-13

v3.1.1 → v4.0.02022-08-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/5d85f137453ecb54df149f98574746640c79d7f8532b7af7e237107723cd0947?d=identicon)[xxmarijnw](/maintainers/xxmarijnw)

![](https://www.gravatar.com/avatar/448156344db8c81e27f2e002c7c12f0b7f028b48ccfb5fe3cd40e391e6723989?d=identicon)[Designburo](/maintainers/Designburo)

---

Top Contributors

[![marijnvanwezel](https://avatars.githubusercontent.com/u/96489967?v=4)](https://github.com/marijnvanwezel "marijnvanwezel (136 commits)")[![simontaurus](https://avatars.githubusercontent.com/u/52674635?v=4)](https://github.com/simontaurus "simontaurus (8 commits)")[![D-Groenewegen](https://avatars.githubusercontent.com/u/10888726?v=4)](https://github.com/D-Groenewegen "D-Groenewegen (2 commits)")[![CmdrRob](https://avatars.githubusercontent.com/u/56593048?v=4)](https://github.com/CmdrRob "CmdrRob (2 commits)")[![WSViktorS](https://avatars.githubusercontent.com/u/22930183?v=4)](https://github.com/WSViktorS "WSViktorS (1 commits)")[![YvarRavy](https://avatars.githubusercontent.com/u/56068734?v=4)](https://github.com/YvarRavy "YvarRavy (1 commits)")[![DanielWTQ](https://avatars.githubusercontent.com/u/122580891?v=4)](https://github.com/DanielWTQ "DanielWTQ (1 commits)")[![Designburo](https://avatars.githubusercontent.com/u/7594925?v=4)](https://github.com/Designburo "Designburo (1 commits)")[![Krinkle](https://avatars.githubusercontent.com/u/156867?v=4)](https://github.com/Krinkle "Krinkle (1 commits)")

---

Tags

slots

### Embed Badge

![Health badge](/badges/open-csp-w-s-slots/health.svg)

```
[![Health](https://phpackages.com/badges/open-csp-w-s-slots/health.svg)](https://phpackages.com/packages/open-csp-w-s-slots)
```

###  Alternatives

[clerkinc/backend-php

2755.0k](/packages/clerkinc-backend-php)[polar-sh/sdk

4014.5k4](/packages/polar-sh-sdk)[getkirby/layouts

Kirby Layouts

428.4k](/packages/getkirby-layouts)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
