abstract class Component extends Container implements ISignalReceiver, IStatePersistent, 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.

Traits

Implementation of \ArrayAccess for IContainer.

Properties

callable[] $onAnchor
protected array $params

Methods

Presenter|null
getPresenter()

Returns the presenter where this component belongs to.

bool
hasPresenter()

Returns whether there is a presenter.

string
getUniqueId()

Returns a fully-qualified name that uniquely identifies the component within the presenter hierarchy.

void
validateParent(IContainer $parent)

Is called by a component when it is about to be set new parent. Descendant can override this method to disallow a parent change by throwing an Nette\InvalidStateException

bool
tryCall(string $method, array $params)

Calls public method if exists.

void
checkRequirements($element)

Checks for requirements such as authorization.

getReflection()

Access to reflection.

void
loadState(array $params)

Loads state informations.

void
saveState(array $params)

Saves state informations for next request.

mixed
getParameter(string $name, $default = null)

Returns component param.

array
getParameters()

Returns component parameters.

string
getParameterId(string $name)

Returns a fully-qualified name that uniquely identifies the parameter.

getParam($name = null, $default = null) deprecated

No description

void
signalReceived(string $signal)

No description

static string
formatSignalMethod(string $signal)

Formats signal handler method name -> case sensitivity doesn't matter.

string
link(string $destination, array|mixed $args = [])

Generates URL to presenter, action or signal.

lazyLink(string $destination, array|mixed $args = [])

Returns destination as Link object.

bool
isLinkCurrent(string $destination = null, array|mixed $args = [])

Determines whether it links to the current page.

void
redirect($code, $destination = null, $args = [])

Redirect to another presenter, action or signal.

void
redirectPermanent(string $destination, array|mixed $args = [])

Permanently redirects to presenter, action or signal.

void
error(string $message = '', int $httpCode = Nette\Http\IResponse::S404_NOT_FOUND)

Throws HTTP error.

Details

at line 39
Presenter|null getPresenter()

Returns the presenter where this component belongs to.

Return Value

Presenter|null

at line 52
bool hasPresenter()

Returns whether there is a presenter.

Return Value

bool

at line 62
string getUniqueId()

Returns a fully-qualified name that uniquely identifies the component within the presenter hierarchy.

Return Value

string

at line 68
protected void validateParent(IContainer $parent)

Is called by a component when it is about to be set new parent. Descendant can override this method to disallow a parent change by throwing an Nette\InvalidStateException

Parameters

IContainer $parent

Return Value

void

Exceptions

InvalidStateException

at line 82
protected bool tryCall(string $method, array $params)

Calls public method if exists.

Parameters

string $method
array $params

Return Value

bool does method exist?

at line 105
void checkRequirements($element)

Checks for requirements such as authorization.

Parameters

$element

Return Value

void

at line 121
static ComponentReflection getReflection()

Access to reflection.

Return Value

ComponentReflection

at line 133
void loadState(array $params)

Loads state informations.

Parameters

array $params

Return Value

void

at line 160
void saveState(array $params)

Saves state informations for next request.

Parameters

array $params

Return Value

void

at line 170
final mixed getParameter(string $name, $default = null)

Returns component param.

Parameters

string $name
$default

Return Value

mixed

at line 179
final array getParameters()

Returns component parameters.

Return Value

array

at line 188
final string getParameterId(string $name)

Returns a fully-qualified name that uniquely identifies the parameter.

Parameters

string $name

Return Value

string

at line 196
final getParam($name = null, $default = null) deprecated

deprecated

Parameters

$name
$default

at line 210
void signalReceived(string $signal)

Parameters

string $signal

Return Value

void

at line 222
static string formatSignalMethod(string $signal)

Formats signal handler method name -> case sensitivity doesn't matter.

Parameters

string $signal

Return Value

string

Generates URL to presenter, action or signal.

Parameters

string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
array|mixed $args

Return Value

string

Exceptions

InvalidLinkException

Returns destination as Link object.

Parameters

string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
array|mixed $args

Return Value

Link

at line 267
bool isLinkCurrent(string $destination = null, array|mixed $args = [])

Determines whether it links to the current page.

Parameters

string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
array|mixed $args

Return Value

bool

Exceptions

InvalidLinkException

at line 283
void redirect($code, $destination = null, $args = [])

Redirect to another presenter, action or signal.

Parameters

$code
$destination
$args

Return Value

void

Exceptions

AbortException

at line 307
void redirectPermanent(string $destination, array|mixed $args = [])

Permanently redirects to presenter, action or signal.

Parameters

string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
array|mixed $args

Return Value

void

Exceptions

AbortException

at line 322
void error(string $message = '', int $httpCode = Nette\Http\IResponse::S404_NOT_FOUND)

Throws HTTP error.

Parameters

string $message
int $httpCode

Return Value

void

Exceptions

BadRequestException