Skip to content

Commit

Permalink
View constructor accepts one arg only
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed May 21, 2022
1 parent 5ef237a commit 3ada5b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions demos/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

\Atk4\Ui\Header::addTo($app)->set('Welcome to Agile Toolkit Demo!!');

$t = \Atk4\Ui\Text::addTo(\Atk4\Ui\View::addTo($app, [false, 'green', 'ui' => 'segment']));
$t = \Atk4\Ui\Text::addTo(\Atk4\Ui\View::addTo($app, [false, 'class.green' => true, 'ui' => 'segment']));
$t->addParagraph('Take a quick stroll through some of the amazing features of Agile Toolkit.');

\Atk4\Ui\Button::addTo($app, ['Begin the demo..', 'huge primary fluid', 'iconRight' => 'right arrow'])
\Atk4\Ui\Button::addTo($app, ['Begin the demo..', 'class.huge primary fluid' => true, 'iconRight' => 'right arrow'])
->link('tutorial/intro.php');

\Atk4\Ui\Header::addTo($app)->set('What is new in Agile Toolkit 2.0');

$t = \Atk4\Ui\Text::addTo(\Atk4\Ui\View::addTo($app, [false, 'green', 'ui' => 'segment']));
$t = \Atk4\Ui\Text::addTo(\Atk4\Ui\View::addTo($app, [false, 'class.green' => true, 'ui' => 'segment']));
$t->addParagraph('In this version of Agile Toolkit we introduce "User Actions"!');

\Atk4\Ui\Button::addTo($app, ['Learn about User Actions', 'huge basic primary fluid', 'iconRight' => 'right arrow'])
\Atk4\Ui\Button::addTo($app, ['Learn about User Actions', 'class.huge basic primary fluid' => true, 'iconRight' => 'right arrow'])
->link('tutorial/actions.php');
2 changes: 1 addition & 1 deletion demos/init-app.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static function get_class(\Closure $createAnonymousClassFx): string
$layout->addMenuItem('Recursive Views', [$path . 'recursive'], $menu);

// view demo source page on Github
\Atk4\Ui\Button::addTo($layout->menu->addItem()->addClass('aligned right'), ['View Source', 'teal', 'icon' => 'github'])
\Atk4\Ui\Button::addTo($layout->menu->addItem()->addClass('aligned right'), ['View Source', 'class.teal' => true, 'icon' => 'github'])
->on('click', $app->jsRedirect('https://github.com/atk4/ui/blob/develop/' . $relUrl, true));
}
unset($layout, $rootUrl, $relUrl, $demosUrl, $path, $menu);
4 changes: 2 additions & 2 deletions src/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ public function __construct($label = [])
unset($defaults[0]);
}

// @TODO func_num_args() > 1!!!!
if (func_num_args() > 2 || count(array_filter($defaults, 'is_int', \ARRAY_FILTER_USE_KEY)) > 0) { // prevent bad usage
if (func_num_args() > 1 || count(array_filter($defaults, 'is_int', \ARRAY_FILTER_USE_KEY)) > 0) { // prevent bad usage
var_dump(func_get_args());
debug_print_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);

throw new \Error('Too many method arguments');
}
Expand Down

0 comments on commit 3ada5b7

Please sign in to comment.