Skip to content

Commit e997fde

Browse files
committed
Fix constructor parameter naming to match schema keys
The SlideFactory maps data keys to constructor parameter names, so the parameter must be named 'components' to match the schema key, not 'callbackOrComponents'. This was preventing the components array from being passed to the constructor. Changed: - Blank: $callbackOrComponents -> $components - BlankWithTitle: $callbackOrComponents -> $components This maintains backward compatibility since the parameter still accepts callable|array and uses is_callable() to differentiate.
1 parent 1ac4ce7 commit e997fde

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/SlideMasters/Blank.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use BernskioldMedia\LaravelPpt\Support\ComponentFactory;
99

1010
/**
11-
* @method static static make(callable|array $callbackOrComponents)
11+
* @method static static make(callable|array $components)
1212
*/
1313
class Blank extends BaseSlide implements DynamicallyCreatable
1414
{
@@ -19,16 +19,16 @@ class Blank extends BaseSlide implements DynamicallyCreatable
1919
/**
2020
* Create a blank slide.
2121
*
22-
* @param callable|array $callbackOrComponents Either a callback for custom content or an array of component definitions
22+
* @param callable|array $components Either a callback for custom content or an array of component definitions
2323
*/
24-
public function __construct(callable|array $callbackOrComponents = [])
24+
public function __construct(callable|array $components = [])
2525
{
26-
if (is_callable($callbackOrComponents)) {
26+
if (is_callable($components)) {
2727
// Backward compatibility: use callback pattern
28-
$this->contents = $callbackOrComponents;
28+
$this->contents = $components;
2929
} else {
3030
// New pattern: use component definitions
31-
$this->componentsData = $callbackOrComponents;
31+
$this->componentsData = $components;
3232
}
3333
}
3434

src/SlideMasters/BlankWithTitle.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use BernskioldMedia\LaravelPpt\Support\ComponentFactory;
1010

1111
/**
12-
* @method static static make(string $title, callable|array|null $callbackOrComponents = null)
12+
* @method static static make(string $title, callable|array|null $components = null)
1313
*/
1414
class BlankWithTitle extends BaseSlide implements DynamicallyCreatable
1515
{
@@ -22,20 +22,20 @@ class BlankWithTitle extends BaseSlide implements DynamicallyCreatable
2222
* Create a blank slide with a title.
2323
*
2424
* @param string $title The slide title
25-
* @param callable|array|null $callbackOrComponents Either a callback for custom content or an array of component definitions
25+
* @param callable|array|null $components Either a callback for custom content or an array of component definitions
2626
*/
2727
public function __construct(
2828
string $title,
29-
callable|array|null $callbackOrComponents = null
29+
callable|array|null $components = null
3030
) {
3131
$this->title($title);
3232

33-
if (is_callable($callbackOrComponents)) {
33+
if (is_callable($components)) {
3434
// Backward compatibility: use callback pattern
35-
$this->contents = $callbackOrComponents;
36-
} elseif (is_array($callbackOrComponents)) {
35+
$this->contents = $components;
36+
} elseif (is_array($components)) {
3737
// New pattern: use component definitions
38-
$this->componentsData = $callbackOrComponents;
38+
$this->componentsData = $components;
3939
}
4040
}
4141

0 commit comments

Comments
 (0)