Factory
class Factory implements Factory (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
protected array | $componentStack | The components being rendered. |
from ManagesComponents |
protected array | $componentData | The original data passed to the component. |
from ManagesComponents |
protected array | $currentComponentData | The component data for the component that is currently being rendered. |
from ManagesComponents |
protected array | $slots | The slot contents for the component. |
from ManagesComponents |
protected array | $slotStack | The names of the slots being rendered. |
from ManagesComponents |
protected array | $fragments | All of the captured, rendered fragments. |
from ManagesFragments |
protected array | $fragmentStack | The stack of in-progress fragment renders. |
from ManagesFragments |
protected array | $sections | All of the finished, captured sections. |
from ManagesLayouts |
protected array | $sectionStack | The stack of in-progress sections. |
from ManagesLayouts |
static protected mixed | $parentPlaceholder | The parent placeholder for the request. |
from ManagesLayouts |
static protected string | $parentPlaceholderSalt | The parent placeholder salt for the request. |
from ManagesLayouts |
protected array | $loopsStack | The stack of in-progress loops. |
from ManagesLoops |
protected array | $pushes | All of the finished, captured push sections. |
from ManagesStacks |
protected array | $prepends | All of the finished, captured prepend sections. |
from ManagesStacks |
protected array | $pushStack | The stack of in-progress push sections. |
from ManagesStacks |
protected array | $translationReplacements | The translation replacements for the translation being rendered. |
from ManagesTranslations |
protected EngineResolver | $engines | The engine implementation. |
|
protected ViewFinderInterface | $finder | The view finder implementation. |
|
protected Dispatcher | $events | The event dispatcher instance. |
|
protected Container | $container | The IoC container instance. |
|
protected array | $shared | Data that should be available to all templates. |
|
protected array | $extensions | The extension to engine bindings. |
|
protected array | $composers | The view composer events. |
|
protected int | $renderCount | The number of active rendering operations. |
|
protected array | $renderedOnce | The "once" block IDs that have been rendered. |
|
protected array | $pathEngineCache | The cached array of engines for paths. |
|
protected array | $normalizedNameCache | The cache of normalized names for views. |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Start a component rendering process.
Get the first view that actually exists from the given list, and start a component.
Get an item from the component data that exists above the current component.
Start the slot rendering process.
Add an event for a given view.
Register a class based view composer.
Build a class based container callback Closure.
Parse a class based composer name.
Determine the class event method based on the given prefix.
Get the contents of a fragment.
Start injecting content into a section.
Inject inline content into a section.
Stop injecting content into a section and return its contents.
Stop injecting content into a section.
Append content to a given section.
Get the string contents of a section.
Get the parent placeholder for the current request.
Get the contents of a section.
Start injecting content into a push section.
Append content to a given push section.
Start prepending content into a push section.
Prepend content to a given stack.
Get the string contents of a push section.
Create a new view factory instance.
Get the rendered content of the view based on a given condition.
Get the rendered content of the view based on the negation of a given condition.
Get the rendered contents of a partial from a loop.
Normalize a view name.
Parse the given data into a raw array.
Create a new view instance from the given arguments.
Determine if a given view exists.
Get the appropriate view engine for the given path.
Get the extension used by the view file.
Add a piece of shared data to the environment.
Increment the rendering counter.
Decrement the rendering counter.
Check if there are no active render operations.
Determine if the given once token has been rendered.
Mark the given once token as having been rendered.
Add a location to the array of view locations.
Prepend a location to the array of view locations.
Add a new namespace to the loader.
Prepend a new namespace to the loader.
Replace the namespace hints for the given namespace.
Register a valid view extension and its engine.
Flush all of the factory state like sections and stacks.
Flush all of the section contents if done rendering.
Get the extension to engine bindings.
Get the engine resolver instance.
Get the view finder instance.
Flush the cache of views located by the finder.
Get the event dispatcher instance.
Get the IoC container instance.
Get an item from the shared data.
Get all of the shared data for the environment.
Details
void
startComponent(View|Htmlable|Closure|string $view, array $data = [])
Start a component rendering process.
void
startComponentFirst(array $names, array $data = [])
Get the first view that actually exists from the given list, and start a component.
mixed|null
getConsumableComponentData(string $key, mixed $default = null)
Get an item from the component data that exists above the current component.
void
slot(string $name, string|null $content = null, array $attributes = [])
Start the slot rendering process.
protected Closure|null
addViewEvent(string $view, Closure|string $callback, string $prefix = 'composing: ')
Add an event for a given view.
protected Closure
addClassEvent(string $view, string $class, string $prefix)
Register a class based view composer.
protected Closure
buildClassEventCallback(string $class, string $prefix)
Build a class based container callback Closure.
protected string
classEventMethodForPrefix(string $prefix)
Determine the class event method based on the given prefix.
protected void
addEventListener(string $name, Closure $callback)
Add a listener to the event dispatcher.
void
startSection(string $section, string|null $content = null)
Start injecting content into a section.
static string
parentPlaceholder(string $section = '')
Get the parent placeholder for the current request.
void
startPrepend(string $section, string $content = '')
Start prepending content into a push section.
string
yieldPushContent(string $section, string $default = '')
Get the string contents of a push section.
__construct(EngineResolver $engines, ViewFinderInterface $finder, Dispatcher $events)
Create a new view factory instance.
View
file(string $path, Arrayable|array $data = [], array $mergeData = [])
Get the evaluated view contents for the given view.
View
make(string $view, Arrayable|array $data = [], array $mergeData = [])
Get the evaluated view contents for the given view.
View
first(array $views, Arrayable|array $data = [], array $mergeData = [])
Get the first view that actually exists from the given list.
string
renderWhen(bool $condition, string $view, Arrayable|array $data = [], array $mergeData = [])
Get the rendered content of the view based on a given condition.
string
renderUnless(bool $condition, string $view, Arrayable|array $data = [], array $mergeData = [])
Get the rendered content of the view based on the negation of a given condition.
string
renderEach(string $view, array $data, string $iterator, string $empty = 'raw|')
Get the rendered contents of a partial from a loop.
protected View
viewInstance(string $view, string $path, Arrayable|array $data)
Create a new view instance from the given arguments.
$this
prependNamespace(string $namespace, string|array $hints)
Prepend a new namespace to the loader.
$this
replaceNamespace(string $namespace, string|array $hints)
Replace the namespace hints for the given namespace.
void
addExtension(string $extension, string $engine, Closure|null $resolver = null)
Register a valid view extension and its engine.