Static getter (factory) method for Components
Wireframe::component( string $component_name, array $args =  ) : \Wireframe\Component
Added in Wireframe 0.8.0.
This method accepts a name of a component – such as "Card", assuming that you've created a component with that name first – and the arguments for component as an array, and returns an instance of the component. If the component can't be found, this method will throw a WireException.
<?php foreach ($pages->find('template=member') as $member): ?> <?= Wireframe::component('Member', ['item' => $member]) ?> <?php endforeach; ?>
Note: in the example above we're echoing the returned object directly. This is possible because Component::__toString() returns the rendered markup of the component.
Static getter (factory) method for Pages
Wireframe::page( int|string|Page $source, array|string $args =  ) : string|Page|NullPage
Added in Wirerame 0.8.0.
This method takes a source parameter – the type of which may be integer (Page ID), string (selector), or ProcessWire Page object – and an array of optional arguments, and attempts to get a Page that can then be rendered using Wireframe. Instead of argument array it's also possible to provide a string, in which case it's assumed to be the name of a view file.
The benefit of this method is that this way you can easily render pages that haven't been routed via the Wireframe bootstrap file using the alternative filename method, as well as pages that don't have a template file and thus couldn't normally be rendered with the Page::render() method.
Note: if a string was provided instead of argument array or the argument array contains index "render" with value
true, this method returns pre-rendered markup. For a list of all possible arguments see the PHPDoc comments for Wireframe::page().
<ul> <?php foreach ($pages->get('template=contacts-bucket')->children('template=contact') as $contact): ?> <li><?= Wireframe::page($contact, 'list-item') ?></li> <?php endforeach; ?> </ul>
Above example would render each "contact" Page using view file "list-item" (/site/templates/views/contact/list-item.php).
Static getter (factory) method for Partials
Wireframe::partial( string $partial_name, array $args = null ) : \Wireframe\Partial|string
Added in Wirerame 0.10.0.
This method takes a partial name and an optional array of arguments as its params, and returns either a Partial object (if arguments were not provided) or a pre-rendered Partial content as a string (if arguments were provided).
If an object is returned, you can render it by specifically calling its render() method. Render method takes an optional array of arguments as a param, and the contents of this array can be accessed as locally scoped variables in the partial file itself.
<?= Wireframe::partial('breadcrumbs', [ 'aria_label' => 'Breadcrumbs', ]); ?>
This example would output a partial called breadcrumbs (typically /site/templates/partials/breadcrumbs.php), passing it variable $aria_label with value "Breadcrumbs".