UpdateTabDTO
extends AbstractBaseDto
in package
Data Transfer Object for updating a Canvas Tab
This DTO handles the data structure for updating Canvas tabs. Only position and hidden properties can be updated according to Canvas API.
Usage: $updateDto = new UpdateTabDTO(position: 3, hidden: false); $tab = Tab::update('assignments', $updateDto);
Table of Contents
Properties
- $hidden : bool|null
- $position : int|null
- $apiPropertyName : string
- The name of the property in the API
Methods
- __construct() : mixed
- Create a new UpdateTabDTO instance
- getHidden() : bool|null
- Get the hidden status
- getPosition() : int|null
- Get the position
- setHidden() : void
- Set the hidden status
- setPosition() : void
- Set the position
- toApiArray() : array<string|int, array<string, mixed>>
- Convert to API multipart format
- toArray() : array<string, mixed>
- Convert to array for API requests
- formatMultipartValue() : mixed
- Format a value for multipart form contents
Properties
$hidden
public
bool|null
$hidden
= null
$position
public
int|null
$position
= null
$apiPropertyName
The name of the property in the API
protected
string
$apiPropertyName
= 'tab'
Methods
__construct()
Create a new UpdateTabDTO instance
public
__construct([int|null $position = null ][, bool|null $hidden = null ]) : mixed
Parameters
- $position : int|null = null
-
Position of the tab (1-based, max 50)
- $hidden : bool|null = null
-
Whether the tab should be hidden
Tags
getHidden()
Get the hidden status
public
getHidden() : bool|null
Return values
bool|nullgetPosition()
Get the position
public
getPosition() : int|null
Return values
int|nullsetHidden()
Set the hidden status
public
setHidden(bool|null $hidden) : void
Parameters
- $hidden : bool|null
setPosition()
Set the position
public
setPosition(int|null $position) : void
Parameters
- $position : int|null
-
Position (1-based, max 50)
Tags
toApiArray()
Convert to API multipart format
public
toApiArray() : array<string|int, array<string, mixed>>
Return values
array<string|int, array<string, mixed>>toArray()
Convert to array for API requests
public
toArray() : array<string, mixed>
Return values
array<string, mixed>formatMultipartValue()
Format a value for multipart form contents
protected
static formatMultipartValue(mixed $value) : mixed
Booleans must be converted explicitly: Guzzle's multipart encoder string-casts contents, turning false into an empty string instead of 'false', which Canvas may interpret differently than an unset flag.
Parameters
- $value : mixed
-
The value to format