Component
abstract class Component extends Container implements SignalReceiver, StatePersistent, ArrayAccess
Component is the base class for all Presenter components.
Components are persistent objects located on a presenter. They have ability to own other child components, and interact with user. Components have properties for storing their status, and responds to user command.
Properties
| $onAnchor | |||
| protected array<string,mixed> | $params | ||
| Presenter read-only | $presenter | ||
| bool read-only | $linkCurrent |
Methods
Returns the presenter where this component belongs to. Throws if not attached.
Returns the presenter where this component belongs to, or null if not attached.
Returns a fully-qualified name that uniquely identifies the component within the presenter hierarchy.
No description
No description
Calls public method if exists.
Descendant can override this method to check for permissions.
Access to reflection.
Loads state information.
Saves state information for next request.
Returns component param.
Returns component parameters.
Returns a fully-qualified name that uniquely identifies the parameter.
Calls signal handler method.
Formats signal handler method name -> case sensitivity doesn't matter.
Generates URL to presenter, action or signal.
Determines whether it links to the current page.
Redirect to another presenter, action or signal.
Permanently redirects to presenter, action or signal.
Throws HTTP error.
Details
at line 40
Presenter|null
getPresenter(bool $throw = true)
Returns the presenter where this component belongs to. Throws if not attached.
at line 50
Presenter|null
getPresenterIfExists()
deprecated
deprecated
Returns the presenter where this component belongs to, or null if not attached.
at line 57
bool
hasPresenter()
deprecated
deprecated
No description
at line 67
string
getUniqueId()
Returns a fully-qualified name that uniquely identifies the component within the presenter hierarchy.
at line 73
protected IComponent|null
createComponent(string $name)
No description
at line 88
protected void
validateParent(IContainer $parent)
No description
at line 102
protected bool
tryCall(string $method, array $params)
Calls public method if exists.
at line 130
void
checkRequirements(ReflectionClass|ReflectionMethod $element)
Descendant can override this method to check for permissions.
It is called with the presenter class and the render(), action(), and handle*() methods.
at line 138
static ComponentReflection
getReflection()
Access to reflection.
at line 151
void
loadState(array $params)
Loads state information.
at line 180
void
saveState(array $params)
Saves state information for next request.
at line 190
void
saveStatePartial(array $params, ComponentReflection $reflection)
| internal | used by presenter |
No description
at line 229
final mixed
getParameter(string $name)
Returns component param.
at line 242
final array
getParameters()
Returns component parameters.
at line 251
final string
getParameterId(string $name)
Returns a fully-qualified name that uniquely identifies the parameter.
at line 265
void
signalReceived(string $signal)
Calls signal handler method.
at line 277
static string
formatSignalMethod(string $signal)
Formats signal handler method name -> case sensitivity doesn't matter.
at line 292
string
link(string $destination, array|mixed $args = [])
Generates URL to presenter, action or signal.
at line 311
Link
lazyLink(string $destination, array|mixed $args = [])
Returns destination as Link object.
at line 326
bool
isLinkCurrent(string|null $destination = null, array|mixed $args = [])
Determines whether it links to the current page.
at line 346
void
redirect(string $destination, array|mixed $args = [])
Redirect to another presenter, action or signal.
at line 364
void
redirectPermanent(string $destination, array|mixed $args = [])
Permanently redirects to presenter, action or signal.
at line 382
void
error(string $message = '', int $httpCode = Nette\Http\IResponse::S404_NotFound)
Throws HTTP error.