Internal
extends Metadata
in package
Marks a code-API element as for WooCommerce internal use.
Discoverable through the _apiMetadata GraphQL field as an entry with
name = "internal" and value = true. The marking is informational —
authorization remains the job of {@see}, {@see},
and any plugin-supplied authorization attributes.
When a class, property or enum case has this attribute, the generated
GraphQL description is prefixed with [Internal] , and
when the element has no #[Description] at all, a default body
([Internal] For WooCommerce core internal usage only.) is emitted so the
marker still reaches stock introspection.
#[Internal] on a class marks only that class — its fields and enum cases
are not implicitly marked too. A tool that wants to treat the contents of
an internal type as internal by association must apply that rule itself
when it reads the metadata.
The attribute targets classes, properties, and enum cases; see {@see} for the reasoning behind excluding methods.
Table of Contents
- __construct() : mixed
- Construct an `internal` metadata entry with value `true`.
- get_name() : string
- The entry's name (e.g. `internal`, `beta`, `owner`).
- get_value() : bool|int|float|string|null
- The entry's scalar value.
- shows_in_metadata_query() : bool
- Whether the element carrying this attribute should appear in the `_apiMetadata` discovery query.
- transform_description() : string
- Prepend `[Internal] ` to the description, supplying a default body when the element has no `#[Description]` of its own. See {@see Metadata::transform_description()} for the contract.
Methods
__construct()
Construct an `internal` metadata entry with value `true`.
public
__construct() : mixed
Return values
mixed —get_name()
The entry's name (e.g. `internal`, `beta`, `owner`).
public
get_name() : string
Return values
string —get_value()
The entry's scalar value.
public
get_value() : bool|int|float|string|null
Return values
bool|int|float|string|null —shows_in_metadata_query()
Whether the element carrying this attribute should appear in the `_apiMetadata` discovery query.
public
shows_in_metadata_query() : bool
Returning false removes the element's row entirely from
_apiMetadata — neither this metadata entry nor any other
descriptor on the same target surfaces. The runtime gates and any
description transforms are unaffected. Useful for plugins that
attach internal routing or feature hints they prefer not to
broadcast through the discovery channel.
Despite the colloquial naming around it, this has nothing to do
with native GraphQL introspection (__schema / __type); those
queries continue to expose the schema's shape as usual.
Because this is an instance method, subclasses can decide conditionally based on their own constructor arguments.
Return values
bool —transform_description()
Prepend `[Internal] ` to the description, supplying a default body when the element has no `#[Description]` of its own. See {@see Metadata::transform_description()} for the contract.
public
transform_description(string $description) : string
Parameters
- $description : string
-
Incoming description (empty when no
#[Description]).
