ConditionalAutoPlacement
in package
implements
ConditionalInterface
FinalYes
Conditional auto-placement configuration.
Allows ad placement settings to change based on conditions, such as disabling ads on small screens.
Tags
Table of Contents
Interfaces
- ConditionalInterface
- Interface for all conditional objects.
Properties
- $advertisement : AdvertisementAutoPlacement|null
- The advertisement configuration.
- $conditions : array<int, Condition>
- The conditions that must be met.
- $enabled : bool|null
- Whether auto-placement is enabled.
Methods
- addCondition() : $this
- Add a condition.
- disableOnCompact() : self
- Create a conditional that disables ads on compact screens.
- hasConditions() : bool
- Check if any conditions have been set.
- jsonSerialize() : array<string, mixed>
- {@inheritdoc}
- setAdvertisement() : $this
- Set the advertisement configuration.
- setEnabled() : $this
- Set whether auto-placement is enabled.
Properties
$advertisement
The advertisement configuration.
private
AdvertisementAutoPlacement|null
$advertisement
= null
$conditions
The conditions that must be met.
private
array<int, Condition>
$conditions
= []
$enabled
Whether auto-placement is enabled.
private
bool|null
$enabled
= null
Methods
addCondition()
Add a condition.
public
addCondition(Condition $condition) : $this
Parameters
- $condition : Condition
-
The condition to add.
Return values
$thisdisableOnCompact()
Create a conditional that disables ads on compact screens.
public
static disableOnCompact() : self
Return values
self —A new instance.
hasConditions()
Check if any conditions have been set.
public
hasConditions() : bool
Return values
bool —True if conditions exist.
jsonSerialize()
{@inheritdoc}
public
jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>setAdvertisement()
Set the advertisement configuration.
public
setAdvertisement(AdvertisementAutoPlacement $advertisement) : $this
Parameters
- $advertisement : AdvertisementAutoPlacement
-
The ad configuration.
Return values
$thissetEnabled()
Set whether auto-placement is enabled.
public
setEnabled(bool $enabled) : $this
Parameters
- $enabled : bool
-
Whether enabled.