PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class TComponent

TComponent class

TComponent is the base class for all PRADO components. TComponent implements the protocol of defining, using properties, behaviors, and events.

A property is defined by a getter method, and/or a setter method. Properties can be accessed in the way like accessing normal object members. Reading or writing a property will cause the invocation of the corresponding getter or setter method, e.g.,

$a=$this->Text;     // equivalent to $a=$this->getText();
$this->Text='abc';  // equivalent to $this->setText('abc');

The signatures of getter and setter methods are as follows,

// getter, defines a readable property 'Text'
function getText() { ... }
// setter, defines a writable property 'Text', with $value being the value to be set to the property
function setText($value) { ... }

Property names are case-insensitive. It is recommended that they are written in the format of concatenated words, with the first letter of each word capitalized (e.g. DisplayMode, ItemStyle).

Javascript Get and Set

Since Prado 3.2 a new class of javascript-friendly properties have been introduced to better deal with potential security problems like cross-site scripting issues. All the data that gets sent clientside inside a javascript block is now encoded by default. Sometimes there's the need to bypass this encoding and be able to send raw javascript code. This new class of javascript-friendly properties are identified by their name starting with 'js' (case insensitive):

// getter, defines a readable property 'Text'
function getJsText() { ... }
// setter, defines a writable property 'Text', with $value being the value to be set to the property
function setJsText(TJavaScriptLiteral $value) { ... }

Js-friendly properties can be accessed using both their Js-less name and their Js-enabled name:

// set some simple text as property value
$component->Text = 'text';
// set some javascript code as property value
$component->JsText = 'raw javascript';

In the first case, the property value will automatically gets encoded when sent clientside inside a javascript block. In the second case, the property will be 'marked' as being a safe javascript statement and will not be encoded when rendered inside a javascript block. This special handling makes use of the TJavaScriptLiteral class.

Events

An event is defined by the presence of a method whose name starts with 'on'. The event name is the method name and is thus case-insensitive. An event can be attached with one or several methods (called event handlers). An event can be raised by calling TComponent::raiseEvent() method, upon which the attached event handlers will be invoked automatically in the order they are attached to the event. Event handlers must have the following signature,

function eventHandlerFuncName($sender,$param) { ... }

where $sender refers to the object who is responsible for the raising of the event, and $param refers to a structure that may contain event-specific information. To raise an event (assuming named as 'Click') of a component, use

$component->raiseEvent('OnClick');
$component->raiseEvent('OnClick', $this, $param);

To attach an event handler to an event, use one of the following ways,

$component->OnClick=$callback;  // or $component->OnClick->add($callback);
$component->attachEventHandler('OnClick',$callback);

The first two ways make use of the fact that $component->OnClick refers to the event handler list TPriorityList for the 'OnClick' event. The variable $callback contains the definition of the event handler that can be either a string referring to a global function name, or an array whose first element refers to an object and second element a method name/path that is reachable by the object, e.g.

  • 'buttonClicked' : buttonClicked($sender,$param);
  • array($object,'buttonClicked') : $object->buttonClicked($sender,$param);
  • array($object,'MainContent.SubmitButton.buttonClicked') : $object->MainContent->SubmitButton->buttonClicked($sender,$param);

With the addition of behaviors, a more expansive event model is needed. There are two new event types (global and dynamic events) as well as a more comprehensive behavior model that includes class wide behaviors.

A global event is defined by all events whose name starts with 'fx'. The event name is potentially a method name and is thus case-insensitive. All 'fx' events are valid as the whole 'fx' event/method space is global in nature. Any object may patch into any global event by defining that event as a method. Global events have priorities just like 'on' events; so as to be able to order the event execution. Due to the nature of all events which start with 'fx' being valid, in effect, every object has every 'fx' global event. It is simply an issue of tapping into the desired global event.

A global event that starts with 'fx' can be called even if the object does not implement the method of the global event. A call to a non-existing 'fx' method will, at minimal, function and return null. If a method argument list has a first parameter, it will be returned instead of null. This allows filtering and chaining. 'fx' methods do not automatically install and uninstall. To install and uninstall an object's global event listeners, call the object's TComponent::listen() and TComponent::unlisten() methods, respectively. An object may auto-install its global event during TComponent::__construct() by overriding TComponent::getAutoGlobalListen() and returning true.

As of PHP version 5.3, nulled objects without code references will still continue to persist in the global event queue because TComponent::__destruct() is not automatically called. In the common __destruct method, if an object is listening to global events, then TComponent::unlisten() is called. TComponent::unlisten() is required to be manually called before an object is left without references if it is currently listening to any global events. This includes class wide behaviors.

An object that contains a method that starts with 'fx' will have those functions automatically receive those events of the same name after TComponent::listen() is called on the object.

An object may listen to a global event without defining an 'fx' method of the same name by adding an object method to the global event list. For example

$component->fxGlobalCheck=$callback;  // or $component->OnClick->add($callback);
$component->attachEventHandler('fxGlobalCheck',array($object, 'someMethod'));

Events between Objects and their behaviors, Dynamic Events

An intra-object/behavior event is defined by methods that start with 'dy'. Just as with 'fx' global events, every object has every dynamic event. Any call to a method that starts with 'dy' will be handled, regardless of whether it is implemented. These events are for communicating with attached behaviors.

Dynamic events can be used in a variety of ways. They can be used to tell behaviors when a non-behavior method is called. Dynamic events could be used as data filters. They could also be used to specify when a piece of code is to be run, eg. should the loop process be performed on a particular piece of data. In this way, some control is handed to the behaviors over the process and/or data.

If there are no handlers for an 'fx' or 'dy' event, it will return the first parameter of the argument list. If there are no arguments, these events will return null. If there are handlers an 'fx' method will be called directly within the object. Global 'fx' events are triggered by calling TComponent::raiseEvent(). For dynamic events where there are behaviors that respond to the dynamic events, a TCallChain is developed. A call chain allows the behavior dynamic event implementations to call further implementing behaviors within a chain.

If an object implements IDynamicMethods, all global and object dynamic events will be sent to __dycall. In the case of global events, all global events will trigger this method. In the case of behaviors, all undefined dynamic events which are called will be passed through to this method.

Behaviors

There are two types of behaviors. There are individual object behaviors and there are class wide behaviors. Class behaviors depend upon object behaviors.

When a new class implements IBehavior or IClassBehavior or extends TBehavior or TClassBehavior, it may be added to an object by calling the object's TComponent::attachBehavior(). The behaviors associated name can then be used to TComponent::enableBehavior() or TComponent::disableBehavior() the specific behavior.

All behaviors may be turned on and off via TComponent::enableBehaviors() and TComponent::disableBehaviors(), respectively. To check if behaviors are on or off a call to TComponent::getBehaviorsEnabled() will provide the variable.

Attaching and detaching whole sets of behaviors is done using TComponent::attachBehaviors() and TComponent::detachBehaviors(). TComponent::clearBehaviors() removes all of an object's behaviors.

TComponent::asa() returns a behavior of a specific name. TComponent::isa() is the behavior inclusive function that acts as the PHP operator instanceof. A behavior could provide the functionality of a specific class thus causing the host object to act similarly to a completely different class. A behavior would then implement IInstanceCheck to provide the identity of the different class.

Class behaviors are similar to object behaviors except that the class behavior is the implementation for all instances of the class. A class behavior will have the object upon which is being called be prepended to the parameter list. This way the object is known across the class behavior implementation.

Class behaviors are attached using TComponent::attachClassBehavior() and detached using TComponent::detachClassBehavior(). Class behaviors are important in that they will be applied to all new instances of a particular class. In this way class behaviors become default behaviors to a new instances of a class in TComponent::__construct(). Detaching a class behavior will remove the behavior from the default set of behaviors created for an object when the object is instanced.

Class behaviors are also added to all existing instances via the global 'fx' event mechanism. When a new class behavior is added, the event TComponent::fxAttachClassBehavior() is raised and all existing instances that are listening to this global event (primarily after TComponent::listen() is called) will have this new behavior attached. A similar process is used when detaching class behaviors. Any objects listening to the global 'fx' event TComponent::fxDetachClassBehavior() will have a class behavior removed.

Dynamic Intra-Object Events

Dynamic events start with 'dy'. This mechanism is used to allow objects to communicate with their behaviors directly. The entire 'dy' event space is valid. All attached, enabled behaviors that implement a dynamic event are called when the host object calls the dynamic event. If there is no implementation or behaviors, this returns null when no parameters are supplied and will return the first parameter when there is at least one parameter in the dynamic event.

null == $this->dyBehaviorEvent();
5 == $this->dyBehaviorEvent(5); //when no behaviors implement this dynamic event

Dynamic events can be chained together within behaviors to allow for data filtering. Dynamic events are implemented within behaviors by defining the event as a method.

class TObjectBehavior extends TBehavior {
    public function dyBehaviorEvent($param1, $callchain) {
                //Do something, eg:  $param1 += 13;
                return $callchain->dyBehaviorEvent($param1);
    }
}

This implementation of a behavior and dynamic event will flow through to the next behavior implementing the dynamic event. The first parameter is always return when it is supplied. Otherwise a dynamic event returns null.

In the case of a class behavior, the object is also prepended to the dynamic event.

class TObjectClassBehavior extends TClassBehavior {
    public function dyBehaviorEvent($hostobject, $param1, $callchain) {
                //Do something, eg:  $param1 += $hostobject->getNumber();
                return $callchain->dyBehaviorEvent($param1);
    }
}

When calling a dynamic event, only the parameters are passed. The host object and the call chain are built into the framework.

Global Event and Dynamic event catching

Given that all global 'fx' events and dynamic 'dy' events are valid and operational, there is a mechanism for catching events called that are not implemented (similar to the built-in PHP method TComponent::__call()). When a dynamic or global event is called but a behavior does not implement it, yet desires to know when an undefined dynamic event is run, the behavior implements the interface IDynamicMethods and method __dycall.

In the case of dynamic events, __dycall is supplied with the method name and its parameters. When a global event is raised, via TComponent::raiseEvent(), the method is the event name and the parameters are supplied.

When implemented, this catch-all mechanism is called for event global event event when implemented outside of a behavior. Within a behavior, it will also be called when the object to which the behavior is attached calls any unimplemented dynamic event. This is the fall-back mechanism for informing a class and/or behavior of when an global and/or undefined dynamic event is executed.

Direct known subclasses

TActiveRecord, TActiveRecordGateway, TCacheDependency, TCachePageStatePersister, TCachingStatement, TClassBehavior, TClientSideOptions, TComponentReflection, TCompositeLiteral, TDataGatewayCommand, TDataSourceSelectParameters, TDataSourceView, TActiveRecordManager, TDbCommand, TDbCommandBuilder, TDbConnection, TDbDataReader, TDbMetaData, TDbTableColumn, TDbTableInfo, TDbTransaction, TDiscriminator, TDummyDataSource, TApplication, TEventParameter, TFont, THotSpot, THttpCookie, TList, TListItem, TLogger, TMap, TMappedStatement, TMetaTag, TApplicationComponent, TOracleTableInfo, TPageConfiguration, TPagedDataSource, TPageStatePersister, TParameterMap, TParameterProperty, TPreparedStatement, TQueue, Translation, TRepeatInfo, TApplicationConfiguration, TResultMap, TResultProperty, TResultSetListItemParameter, TResultSetMapItemParameter, TSessionPageStatePersister, TSqlCriteria, TSqlMapCacheModel, TSqlMapGateway, TSqlMapManager, TSqlMapObjectCollectionTree, TAuthorizationRule, TSqlMapStatement, TSqlMapTypeHandler, TStack, TStaticSql, TStyle, TSubMap, TTableGateway, TTextWriter, TUri, TUrlMappingPattern, TAutoCompleteTemplate, TUser, TWebControlDecorator, TWizardNavigationTemplate, TWizardSideBarListItemTemplate, TWizardSideBarTemplate, TXmlElement, TBaseActiveControl, TBehavior

Indirect known subclasses

TAccordion, TAccordionView, TActiveControlAdapter, TConditional, TContent, TContentPlaceHolder, TControl, TControlAdapter, TControlCollection, TCustomValidator, TDataBoundControl, TDataGatewayEventParameter, TDataGatewayResultEventParameter, TActiveCustomValidator, TDataGrid, TDataGridColumn, TDataGridColumnCollection, TDataGridCommandEventParameter, TDataGridItem, TDataGridItemCollection, TDataGridItemEventParameter, TDataGridItemRenderer, TDataGridPageChangedEventParameter, TDataGridPager, TActiveCustomValidatorClientSide, TDataGridPagerEventParameter, TDataGridPagerStyle, TDataGridSortCommandEventParameter, TDataList, TDataListCommandEventParameter, TDataListItem, TDataListItemCollection, TDataListItemEventParameter, TDataListItemRenderer, TDataRenderer, TActiveDataGrid, TDataSourceConfig, TDataSourceControl, TDataTypeValidator, TDateFormat, TDatePicker, TDatePickerClientScript, TDbCache, TDbLogRoute, TDbUser, TDbUserManager, TActiveDataGridPager, TDeleteMappedStatement, TDirectoryCacheDependency, TDraggable, TDropContainer, TDropContainerEventParameter, TDropDownList, TDropDownListColumn, TEACache, TEditCommandColumn, TEmailAddressValidator, TActiveDataGridPagerEventParameter, TEmailLogRoute, TEmptyControlCollection, TErrorHandler, TEventTriggeredCallback, TExpression, TFeedService, TFileCacheDependency, TFileLogRoute, TFileUpload, TFirebugLogRoute, TActiveDataList, TFirePhpLogRoute, TFlushOutput, TForm, TGlobalization, TGlobalizationAutoDetect, TGlobalStateCacheDependency, THead, THeader1, THeader2, THeader3, TActiveDatePicker, THeader4, THeader5, THeader6, THiddenField, THotSpotCollection, THtmlArea, THtmlArea4, THtmlElement, THtmlWriter, THttpCookieCollection, TActiveDatePickerClientScript, THttpRequest, THttpResponse, THttpResponseAdapter, THttpSession, THyperLink, THyperLinkColumn, TI18NControl, TImage, TImageButton, TImageClickEventParameter, TActiveDropDownList, TImageMap, TImageMapEventParameter, TInlineFrame, TInPlaceTextBox, TInsertMappedStatement, TItemDataRenderer, TJavascriptLogger, TJsonResponse, TJsonRpcClient, TJsonService, TAccordionViewCollection, TActiveDropDownListColumn, TKeyboard, TLabel, TLinkButton, TListBox, TListControl, TListControlValidator, TListItemCollection, TLiteral, TLiteralColumn, TLogRoute, TActiveEditCommandColumn, TLogRouter, TMarkdown, TMemCache, TMetaTagCollection, TModule, TMssqlCommandBuilder, TMssqlMetaData, TMssqlTableColumn, TMssqlTableInfo, TMultiView, TActiveFileUpload, TMysqlCommandBuilder, TMysqlMetaData, TMysqlTableColumn, TMysqlTableInfo, TNumberFormat, TOracleCommandBuilder, TOracleMetaData, TOracleTableColumn, TOutputCache, TOutputCacheCalculateKeyEventParameter, TActiveHiddenField, TOutputCacheCheckDependencyEventParameter, TOutputCacheTextWriterMulti, TPage, TPagedList, TPagedListFetchDataEventParameter, TPagedListPageChangedEventParameter, TPager, TPagerPageChangedEventParameter, TPageService, TPanel, TActiveHyperLink, TPanelStyle, TParameterModule, TPgsqlCommandBuilder, TPgsqlMetaData, TPgsqlTableColumn, TPgsqlTableInfo, TPlaceHolder, TPolygonHotSpot, TPriorityList, TPriorityMap, TActiveHyperLinkColumn, TRadioButton, TRadioButtonList, TRangeValidator, TRatingList, TReadOnlyDataSource, TReadOnlyDataSourceView, TReCaptcha, TReCaptchaValidator, TRectangleHotSpot, TRegularExpressionValidator, TActiveImage, TRepeater, TRepeaterCommandEventParameter, TRepeaterItem, TRepeaterItemCollection, TRepeaterItemEventParameter, TRepeaterItemRenderer, TRequiredFieldValidator, TRpcApiProvider, TRpcClient, TRpcServer, TActiveImageButton, TRpcService, TSafeHtml, TScaffoldBase, TScaffoldEditView, TScaffoldListView, TScaffoldSearch, TScaffoldView, TSecurityManager, TSelectMappedStatement, TServerValidateEventParameter, TActiveLabel, TService, TShellApplication, TSimpleDynamicSql, TSlider, TSliderClientScript, TSoapServer, TSoapService, TSqliteCache, TSqliteCommandBuilder, TSqliteMetaData, TActiveLinkButton, TSqliteTableColumn, TSqliteTableInfo, TSqlMapConfig, TSqlMapDelete, TSqlMapInsert, TSqlMapPagedList, TSqlMapSelect, TSqlMapSelectKey, TSqlMapUpdate, TStatements, TActiveBoundColumn, TActiveListBox, TStyleSheet, TTable, TTableCell, TTableCellCollection, TTableFooterRow, TTableHeaderCell, TTableHeaderRow, TTableItemStyle, TTableRow, TTableRowCollection, TActiveListControlAdapter, TTableStyle, TTabPanel, TTabView, TTabViewCollection, TTemplate, TTemplateColumn, TTemplateControl, TTemplateControlInheritable, TTemplatedWizardStep, TTemplateManager, TActiveListItemCollection, TTextBox, TTextHighlighter, TTextProcessor, TTheme, TThemeManager, TTimeTriggeredCallback, TTranslate, TTranslateParameter, TTriggeredCallback, TUpdateMappedStatement, TActiveLiteralColumn, TUrlManager, TUrlMapping, TUserManager, TValidationSummary, TValidatorClientSide, TValueTriggeredCallback, TView, TViewCollection, TWebControl, TWebControlAdapter, TActiveMultiView, TWizard, TWizardFinishNavigationTemplate, TWizardNavigationButtonStyle, TWizardNavigationContainer, TWizardNavigationEventParameter, TWizardStartNavigationTemplate, TWizardStep, TWizardStepCollection, TWizardStepNavigationTemplate, TWsatGenerateAR, TActivePageAdapter, TWsatHome, TWsatLayout, TWsatLogin, TWsatScaffolding, TWsatService, TXCache, TXmlDocument, TXmlElementList, TXmlRpcClient, TXmlTransform, TActivePager, TActivePanel, TActiveRadioButton, TActiveRadioButtonList, TActiveButton, TActiveRatingList, TActiveRecordChangeEventParameter, TActiveRecordConfig, TActiveRecordCriteria, TActiveRepeater, TActiveTableCell, TActiveTableCellEventParameter, TActiveTableRow, TActiveTableRowEventParameter, TActiveTemplateColumn, TActiveButtonColumn, TActiveTextBox, TAPCCache, TApplicationStateCacheDependency, TApplicationStatePersister, TAssetManager, TAttributeCollection, TAuthManager, TAuthorizationRuleCollection, TAutoComplete, TAutoCompleteEventParameter, TActiveCheckBox, TBaseActiveCallbackControl, TBaseDataList, TBaseValidator, TBoundColumn, TBroadcastEventParameter, TBrowserLogRoute, TBulletedList, TBulletedListEventParameter, TButton, TButtonColumn, TActiveCheckBoxColumn, TCache, TCacheDependencyList, TCacheHttpSession, TCallback, TCallbackClientScript, TCallbackClientSide, TCallbackErrorHandler, TCallbackEventParameter, TCallbackOptions, TCallbackResponseAdapter, TActiveCheckBoxList, TCallbackResponseWriter, TCallChain, TCaptcha, TCaptchaValidator, TChainedCacheDependency, TCheckBox, TCheckBoxColumn, TCheckBoxList, TChoiceFormat, TCircleHotSpot, TActiveClientScript, TClassBehaviorEventParameter, TClientScript, TClientScriptManager, TClientSideValidationSummaryOptions, TColorPicker, TColorPickerClientSide, TCommandEventParameter, TCompareValidator, TCompleteWizardStep, TCompositeControl
Package: System
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Author: Brad Anderson <javalizard@mac.com>
Since: 3.0
Located at TComponent.php
Methods summary
public
# __construct( )

The common __construct If desired by the new object, this will auto install and listen to global event functions as defined by the object via 'fx' methods. This also attaches any predefined behaviors. This function installs all class behaviors in a class hierarchy from the deepest subclass through each parent to the top most class, TComponent.

The common __construct If desired by the new object, this will auto install and listen to global event functions as defined by the object via 'fx' methods. This also attaches any predefined behaviors. This function installs all class behaviors in a class hierarchy from the deepest subclass through each parent to the top most class, TComponent.

public boolean
# getAutoGlobalListen( )

Tells TComponent whether or not to automatically listen to global events. Defaults to false because PHP variable cleanup is affected if this is true. When unsetting a variable that is listening to global events, TComponent::unlisten() must explicitly be called when cleaning variables allocation or else the global event registry will contain references to the old object. This is true for PHP 5.4

Tells TComponent whether or not to automatically listen to global events. Defaults to false because PHP variable cleanup is affected if this is true. When unsetting a variable that is listening to global events, TComponent::unlisten() must explicitly be called when cleaning variables allocation or else the global event registry will contain references to the old object. This is true for PHP 5.4

Override this method by a subclass to change the setting. When set to true, this will enable TComponent::__construct() to call TComponent::listen().

Returns

boolean
whether or not to auto listen to global events during TComponent::__construct(), default false
public
# __destruct( )

The common __destruct This unlistens from the global event routines if listening

The common __destruct This unlistens from the global event routines if listening

PHP 5.3 does not __destruct objects when they are nulled and thus unlisten must be called must be explicitly called.

public array
# getClassHierarchy( boolean $lowercase = false )

This returns an array of the class name and the names of all its parents. The base object first, TComponent, and the deepest subclass is last.

This returns an array of the class name and the names of all its parents. The base object first, TComponent, and the deepest subclass is last.

Parameters

$lowercase
boolean
optional should the names be all lowercase true/false

Returns

array
array of strings being the class hierarchy of $this.
public numeric
# listen( )

This adds an object's fx event handlers into the global broadcaster to listen into any broadcast global events called through TComponent::raiseEvent()

This adds an object's fx event handlers into the global broadcaster to listen into any broadcast global events called through TComponent::raiseEvent()

Behaviors may implement the function:

public function dyListen($globalEvents[, $chain]) {
                $this->listen(); //eg
}

to be executed when listen is called. All attached behaviors are notified through dyListen.

Returns

numeric
the number of global events that were registered to the global event registry
public numeric
# unlisten( )

this removes an object's fx events from the global broadcaster

this removes an object's fx events from the global broadcaster

Behaviors may implement the function:

public function dyUnlisten($globalEvents[, $chain]) {
                $this->behaviorUnlisten(); //eg
}

to be executed when listen is called. All attached behaviors are notified through dyUnlisten.

Returns

numeric
the number of global events that were unregistered from the global event registry
public boolean
# getListeningToGlobalEvents( )

Gets the state of listening to global events

Gets the state of listening to global events

Returns

boolean
is Listening to global broadcast enabled
public mixed
# __call( string $method, mixed $args )

Calls a method. Do not call this method directly. This is a PHP magic method that we override to allow behaviors, dynamic events (intra-object/behavior events), undefined dynamic and global events, and to allow using the following syntax to call a property setter or getter.

$this->getPropertyName($value); // if there's a $this->getjsPropertyName() method
$this->setPropertyName($value); // if there's a $this->setjsPropertyName() method

Calls a method. Do not call this method directly. This is a PHP magic method that we override to allow behaviors, dynamic events (intra-object/behavior events), undefined dynamic and global events, and to allow using the following syntax to call a property setter or getter.

$this->getPropertyName($value); // if there's a $this->getjsPropertyName() method
$this->setPropertyName($value); // if there's a $this->setjsPropertyName() method

Additional object behaviors override class behaviors. dynamic and global events do not fail even if they aren't implemented. Any intra-object/behavior dynamic events that are not implemented by the behavior return the first function paramater or null when no parameters are specified.

Parameters

$method
string
method name that doesn't exist and is being called on the object
$args
mixed
method parameters

Returns

mixed
result of the method call, or false if 'fx' or 'dy' function but is not found in the class, otherwise it runs

Throws

TInvalidOperationException
If the property is not defined or read-only or method is undefined
public mixed
# __get( string $name )

Returns a property value or an event handler list by property or event name. Do not call this method. This is a PHP magic method that we override to allow using the following syntax to read a property:

$value=$component->PropertyName;
$value=$component->jsPropertyName; // return JavaScript literal

and to obtain the event handler list for an event,

$eventHandlerList=$component->EventName;

This will also return the global event handler list when specifing an 'fx' event,

$globalEventHandlerList=$component->fxEventName;

When behaviors are enabled, this will return the behavior of a specific name, a property of a behavior, or an object 'on' event defined by the behavior.

Returns a property value or an event handler list by property or event name. Do not call this method. This is a PHP magic method that we override to allow using the following syntax to read a property:

$value=$component->PropertyName;
$value=$component->jsPropertyName; // return JavaScript literal

and to obtain the event handler list for an event,

$eventHandlerList=$component->EventName;

This will also return the global event handler list when specifing an 'fx' event,

$globalEventHandlerList=$component->fxEventName;

When behaviors are enabled, this will return the behavior of a specific name, a property of a behavior, or an object 'on' event defined by the behavior.

Parameters

$name
string
the property name or the event name

Returns

mixed
the property value or the event handler list as TPriorityList

Throws

TInvalidOperationException
if the property/event is not defined.
public
# __set( string $name, mixed $value )

Sets value of a component property. Do not call this method. This is a PHP magic method that we override to allow using the following syntax to set a property or attach an event handler.

$this->PropertyName=$value;
$this->jsPropertyName=$value; // $value will be treated as a JavaScript literal
$this->EventName=$handler;
$this->fxEventName=$handler; //global event listener

When behaviors are enabled, this will also set a behaviors properties and events.

Sets value of a component property. Do not call this method. This is a PHP magic method that we override to allow using the following syntax to set a property or attach an event handler.

$this->PropertyName=$value;
$this->jsPropertyName=$value; // $value will be treated as a JavaScript literal
$this->EventName=$handler;
$this->fxEventName=$handler; //global event listener

When behaviors are enabled, this will also set a behaviors properties and events.

Parameters

$name
string
the property name or event name
$value
mixed
the property value or event handler

Throws

TInvalidOperationException
If the property is not defined or read-only.
public
# __isset( string $name )

Checks if a property value is null, there are no events in the object event list or global event list registered under the name, and, if behaviors are enabled, Do not call this method. This is a PHP magic method that we override to allow using isset() to detect if a component property is set or not. This also works for global events. When behaviors are enabled, it will check for a behavior of the specified name, and also check the behavior for events and properties.

Checks if a property value is null, there are no events in the object event list or global event list registered under the name, and, if behaviors are enabled, Do not call this method. This is a PHP magic method that we override to allow using isset() to detect if a component property is set or not. This also works for global events. When behaviors are enabled, it will check for a behavior of the specified name, and also check the behavior for events and properties.

Parameters

$name
string
the property name or the event name

Since

3.2.3
public
# __unset( string $name )

Sets a component property to be null. Clears the object or global events. When enabled, loops through all behaviors and unsets the property or event. Do not call this method. This is a PHP magic method that we override to allow using unset() to set a component property to be null.

Sets a component property to be null. Clears the object or global events. When enabled, loops through all behaviors and unsets the property or event. Do not call this method. This is a PHP magic method that we override to allow using unset() to set a component property to be null.

Parameters

$name
string
the property name or the event name

Throws

TInvalidOperationException
if the property is read only.

Since

3.2.3
public boolean
# hasProperty( string $name )

Determines whether a property is defined. A property is defined if there is a getter or setter method defined in the class. Note, property names are case-insensitive.

Determines whether a property is defined. A property is defined if there is a getter or setter method defined in the class. Note, property names are case-insensitive.

Parameters

$name
string
the property name

Returns

boolean
whether the property is defined
public boolean
# canGetProperty( string $name )

Determines whether a property can be read. A property can be read if the class has a getter method for the property name. Note, property name is case-insensitive. This also checks for getjs. When enabled, it loops through all active behaviors for the get property when undefined by the object.

Determines whether a property can be read. A property can be read if the class has a getter method for the property name. Note, property name is case-insensitive. This also checks for getjs. When enabled, it loops through all active behaviors for the get property when undefined by the object.

Parameters

$name
string
the property name

Returns

boolean
whether the property can be read
public boolean
# canSetProperty( string $name )

Determines whether a property can be set. A property can be written if the class has a setter method for the property name. Note, property name is case-insensitive. This also checks for setjs. When enabled, it loops through all active behaviors for the set property when undefined by the object.

Determines whether a property can be set. A property can be written if the class has a setter method for the property name. Note, property name is case-insensitive. This also checks for setjs. When enabled, it loops through all active behaviors for the set property when undefined by the object.

Parameters

$name
string
the property name

Returns

boolean
whether the property can be written
public mixed
# getSubProperty( string $path )

Evaluates a property path. A property path is a sequence of property names concatenated by '.' character. For example, 'Parent.Page' refers to the 'Page' property of the component's 'Parent' property value (which should be a component also). When a property is not defined by an object, this also loops through all active behaviors of the object.

Evaluates a property path. A property path is a sequence of property names concatenated by '.' character. For example, 'Parent.Page' refers to the 'Page' property of the component's 'Parent' property value (which should be a component also). When a property is not defined by an object, this also loops through all active behaviors of the object.

Parameters

$path
string
property path

Returns

mixed
the property path value
public
# setSubProperty( string $path, mixed $value )

Sets a value to a property path. A property path is a sequence of property names concatenated by '.' character. For example, 'Parent.Page' refers to the 'Page' property of the component's 'Parent' property value (which should be a component also). When a property is not defined by an object, this also loops through all active behaviors of the object.

Sets a value to a property path. A property path is a sequence of property names concatenated by '.' character. For example, 'Parent.Page' refers to the 'Page' property of the component's 'Parent' property value (which should be a component also). When a property is not defined by an object, this also loops through all active behaviors of the object.

Parameters

$path
string
property path
$value
mixed
the property path value
public boolean
# hasEvent( string $name )

Determines whether an event is defined. An event is defined if the class has a method whose name is the event name prefixed with 'on', 'fx', or 'dy'. Every object responds to every 'fx' and 'dy' event as they are in a universally accepted event space. 'on' event must be declared by the object. When enabled, this will loop through all active behaviors for 'on' events defined by the behavior. Note, event name is case-insensitive.

Determines whether an event is defined. An event is defined if the class has a method whose name is the event name prefixed with 'on', 'fx', or 'dy'. Every object responds to every 'fx' and 'dy' event as they are in a universally accepted event space. 'on' event must be declared by the object. When enabled, this will loop through all active behaviors for 'on' events defined by the behavior. Note, event name is case-insensitive.

Parameters

$name
string
the event name

Returns

boolean
public boolean
# hasEventHandler( string $name )

Checks if an event has any handlers. This function also checks through all the behaviors for 'on' events when behaviors are enabled. 'dy' dynamic events are not handled by this function.

Checks if an event has any handlers. This function also checks through all the behaviors for 'on' events when behaviors are enabled. 'dy' dynamic events are not handled by this function.

Parameters

$name
string
the event name

Returns

boolean
whether an event has been attached one or several handlers
public TPriorityList
# getEventHandlers( mixed $name )

Returns the list of attached event handlers for an 'on' or 'fx' event. This function also checks through all the behaviors for 'on' event lists when behaviors are enabled.

Returns the list of attached event handlers for an 'on' or 'fx' event. This function also checks through all the behaviors for 'on' event lists when behaviors are enabled.

Returns

TPriorityList
list of attached event handlers for an event

Throws

TInvalidOperationException
if the event is not defined
public
# attachEventHandler( string $name, callable $handler, numeric|null $priority = null )

Attaches an event handler to an event.

Attaches an event handler to an event.

The handler must be a valid PHP callback, i.e., a string referring to a global function name, or an array containing two elements with the first element being an object and the second element a method name of the object. In Prado, you can also use method path to refer to an event handler. For example, array($object,'Parent.buttonClicked') uses a method path that refers to the method $object->Parent->buttonClicked(...).

The event handler must be of the following signature,

function handlerName($sender, $param) {}
function handlerName($sender, $param, $name) {}

where $sender represents the object that raises the event, and $param is the event parameter. $name refers to the event name being handled.

This is a convenient method to add an event handler. It is equivalent to TComponent::getEventHandlers()($name)->add($handler). For complete management of event handlers, use TComponent::getEventHandlers() to get the event handler list first, and then do various TPriorityList operations to append, insert or remove event handlers. You may also do these operations like getting and setting properties, e.g.,

$component->OnClick[]=array($object,'buttonClicked');
$component->OnClick->insertAt(0,array($object,'buttonClicked'));

which are equivalent to the following

$component->getEventHandlers('OnClick')->add(array($object,'buttonClicked'));
$component->getEventHandlers('OnClick')->insertAt(0,array($object,'buttonClicked'));

Due to the nature of TComponent::getEventHandlers(), any active behaviors defining new 'on' events, this method will pass through to the behavior transparently.

Parameters

$name
string
the event name
$handler
callable
the event handler
$priority
numeric|null
the priority of the handler, defaults to null which translates into the default priority of 10.0 within TPriorityList

Throws

TInvalidOperationException
if the event does not exist
public boolean
# detachEventHandler( string $name, callable $handler, numeric|false|null $priority = false )

Detaches an existing event handler. This method is the opposite of TComponent::attachEventHandler(). It will detach any 'on' events definedb by an objects active behaviors as well.

Detaches an existing event handler. This method is the opposite of TComponent::attachEventHandler(). It will detach any 'on' events definedb by an objects active behaviors as well.

Parameters

$name
string
event name
$handler
callable
the event handler to be removed
$priority
numeric|false|null
the priority of the handler, defaults to false which translates to an item of any priority within TPriorityList; null means the default priority

Returns

boolean
if the removal is successful
public mixed
# raiseEvent( string $name, mixed $sender, TEventParameter $param, numeric $responsetype = null, function $postfunction = null )

Raises an event. This raises both inter-object 'on' events and global 'fx' events. This method represents the happening of an event and will invoke all attached event handlers for the event in TPriorityList order. This method does not handle intra-object/behavior dynamic 'dy' events.

Raises an event. This raises both inter-object 'on' events and global 'fx' events. This method represents the happening of an event and will invoke all attached event handlers for the event in TPriorityList order. This method does not handle intra-object/behavior dynamic 'dy' events.

There are ways to handle event responses. By defailt EVENT_RESULT_FILTER, all event responses are stored in an array, filtered for null responses, and returned. If EVENT_RESULT_ALL is specified, all returned results will be stored along with the sender and param in an array

$result[] = array('sender'=>$sender,'param'=>$param,'response'=>$response);

If EVENT_RESULT_FEED_FORWARD is specified, then each handler result is then fed forward as the parameters for the next event. This allows for events to filter data directly by affecting the event parameters

If a callable function is set in the response type or the post function filter is specified then the result of each called event handler is post processed by the callable function. Used in combination with EVENT_RESULT_FEED_FORWARD, any event (and its result) can be chained.

When raising a global 'fx' event, registered handlers in the global event list for TComponent::GLOBAL_RAISE_EVENT_LISTENER are always added into the set of event handlers. In this way, these global events are always raised for every global 'fx' event. The registered handlers for global raiseEvent events have priorities. Any registered global raiseEvent event handlers with a priority less than zero are added before the main event handlers being raised and any registered global raiseEvent event handlers with a priority equal or greater than zero are added after the main event handlers being raised. In this way all TComponent::GLOBAL_RAISE_EVENT_LISTENER handlers are always called for every raised 'fx' event.

Behaviors may implement the following functions:

public function dyPreRaiseEvent($name,$sender,$param,$responsetype,$postfunction[, $chain]) {
        return $name; //eg, the event name may be filtered/changed
 }
public function dyIntraRaiseEventTestHandler($handler,$sender,$param,$name[, $chain]) {
        return true; //should this particular handler be executed?  true/false
 }
 public function dyIntraRaiseEventPostHandler($name,$sender,$param,$handler,$response[, $chain]) {
        //contains the per handler response
 }
 public function dyPostRaiseEvent($responses,$name,$sender,$param,$responsetype,$postfunction[, $chain]) {
        return $responses;
 }

to be executed when raiseEvent is called. The 'intra' dynamic events are called per handler in the handler loop.

dyPreRaiseEvent has the effect of being able to change the event being raised. This intra object/behavior event returns the name of the desired event to be raised. It will pass through if no dynamic event is specified, or if the original event name is returned. dyIntraRaiseEventTestHandler returns true or false as to whether a specific handler should be called for a specific raised event (and associated event arguments) dyIntraRaiseEventPostHandler does not return anything. This allows behaviors to access the results of an event handler in the per handler loop. dyPostRaiseEvent returns the responses. This allows for any post processing of the event results from the sum of all event handlers

When handling a catch-all __dycall, the method name is the name of the event and the parameters are the sender, the param, and then the name of the event.

Parameters

$name
string
the event name
$sender
mixed
the event sender object
$param
TEventParameter
the event parameter
$responsetype
numeric
how the results of the event are tabulated. default: EVENT_RESULT_FILTER The default filters out null responses. optional
$postfunction
function
any per handler filtering of the response result needed is passed through this if not null. default: null. optional

Returns

mixed
the results of the event

Throws

TInvalidOperationException
if the event is undefined
TInvalidDataValueException
If an event handler is invalid
public mixed
# evaluateExpression( string $expression )

Evaluates a PHP expression in the context of this control.

Evaluates a PHP expression in the context of this control.

Behaviors may implement the function:

public function dyEvaluateExpressionFilter($expression, $chain) {
                return $chain->dyEvaluateExpressionFilter(str_replace('foo', 'bar', $expression)); //example
}

to be executed when evaluateExpression is called. All attached behaviors are notified through dyEvaluateExpressionFilter. The chaining is important in this function due to the filtering pass-through effect.

Parameters

$expression
string
PHP expression

Returns

mixed
the expression result

Throws

TInvalidOperationException
if the expression is invalid
public string
# evaluateStatements( string $statements )

Evaluates a list of PHP statements.

Evaluates a list of PHP statements.

Behaviors may implement the function:

public function dyEvaluateStatementsFilter($statements, $chain) {
                return $chain->dyEvaluateStatementsFilter(str_replace('foo', 'bar', $statements)); //example
}

to be executed when evaluateStatements is called. All attached behaviors are notified through dyEvaluateStatementsFilter. The chaining is important in this function due to the filtering pass-through effect.

Parameters

$statements
string
PHP statements

Returns

string
content echoed or printed by the PHP statements

Throws

TInvalidOperationException
if the statements are invalid
public
# createdOnTemplate( TComponent $parent )

This method is invoked after the component is instantiated by a template. When this method is invoked, the component's properties have been initialized. The default implementation of this method will invoke the potential parent component's TComponent::addParsedObject(). This method can be overridden.

This method is invoked after the component is instantiated by a template. When this method is invoked, the component's properties have been initialized. The default implementation of this method will invoke the potential parent component's TComponent::addParsedObject(). This method can be overridden.

Behaviors may implement the function:

public function dyCreatedOnTemplate($parent, $chain) {
                return $chain->dyCreatedOnTemplate($parent); //example
 }

to be executed when createdOnTemplate is called. All attached behaviors are notified through dyCreatedOnTemplate.

Parameters

$parent
TComponent
potential parent of this control

See

TComponent::addParsedObject()
public
# addParsedObject( string|TComponent $object )

Processes an object that is created during parsing template. The object can be either a component or a static text string. This method can be overridden to customize the handling of newly created objects in template. Only framework developers and control developers should use this method.

Processes an object that is created during parsing template. The object can be either a component or a static text string. This method can be overridden to customize the handling of newly created objects in template. Only framework developers and control developers should use this method.

Behaviors may implement the function:

public function dyAddParsedObject($object[, $chain]) {
 }

to be executed when addParsedObject is called. All attached behaviors are notified through dyAddParsedObject.

Parameters

$object
string|TComponent
text string or component parsed and instantiated in template

See

TComponent::createdOnTemplate()
public
# fxAttachClassBehavior( mixed $sender, mixed $param )

This is the method registered for all instanced objects should a class behavior be added after the class is instanced. Only when the class to which the behavior is being added is in this object's class hierarchy, via TComponent::getClassHierarchy(), is the behavior added to this instance.

This is the method registered for all instanced objects should a class behavior be added after the class is instanced. Only when the class to which the behavior is being added is in this object's class hierarchy, via TComponent::getClassHierarchy(), is the behavior added to this instance.

Parameters

$sender
mixed
$sender the application
$param
mixed
$param TClassBehaviorEventParameter

Since

3.2.3
public
# fxDetachClassBehavior( mixed $sender, mixed $param )

This is the method registered for all instanced objects should a class behavior be removed after the class is instanced. Only when the class to which the behavior is being added is in this object's class hierarchy, via TComponent::getClassHierarchy(), is the behavior removed from this instance.

This is the method registered for all instanced objects should a class behavior be removed after the class is instanced. Only when the class to which the behavior is being added is in this object's class hierarchy, via TComponent::getClassHierarchy(), is the behavior removed from this instance.

Parameters

$sender
mixed
$sender the application
$param
mixed
$param TClassBehaviorEventParameter

Since

3.2.3
public static
# attachClassBehavior( string $name, object|string $behavior, string|class $class = null, numeric|null $priority = null )

This will add a class behavior to all classes instanced (that are listening) and future newly instanced objects. This registers the behavior for future instances and pushes the changes to all the instances that are listening as well. The universal class behaviors are stored in an inverted stack with the latest class behavior being at the first position in the array. This is done so class behaviors are added last first.

This will add a class behavior to all classes instanced (that are listening) and future newly instanced objects. This registers the behavior for future instances and pushes the changes to all the instances that are listening as well. The universal class behaviors are stored in an inverted stack with the latest class behavior being at the first position in the array. This is done so class behaviors are added last first.

Parameters

$name
string
name the key of the class behavior
$behavior
object|string
class behavior or name of the object behavior per instance
$class
string|class
string of class or class on which to attach this behavior. Defaults to null which will error but more important, if this is on PHP 5.3 it will use Late Static Binding to derive the class it should extend. <code> TPanel::attachClassBehavior('javascripts', (new TJsPanelBehavior())->init($this)); </code>
$priority
numeric|null
priority of behavior, default: null the default priority of the TPriorityList Optional.

Throws

TInvalidOperationException
if the class behavior is being added to a TComponent; due to recursion.
TInvalidOperationException
if the class behavior is already defined

Since

3.2.3
public static
# detachClassBehavior( mixed $name, mixed $class = null, mixed $priority = false )

This will remove a behavior from a class. It unregisters it from future instances and pulls the changes from all the instances that are listening as well. PHP 5.3 uses Late Static Binding to derive the static class upon which this method is called.

This will remove a behavior from a class. It unregisters it from future instances and pulls the changes from all the instances that are listening as well. PHP 5.3 uses Late Static Binding to derive the static class upon which this method is called.

Parameters

$name
mixed
$name the key of the class behavior
$class
mixed
$class string class on which to attach this behavior. Defaults to null.
$priority
mixed
$priority numeric|null|false priority. false is any priority, null is default TPriorityList priority, and numeric is a specific priority.

Throws

Exception
if the the class cannot be derived from Late Static Binding and is not not supplied as a parameter.

Since

3.2.3
public IBehavior
# asa( string $behaviorname )

Returns the named behavior object. The name 'asa' stands for 'as a'.

Returns the named behavior object. The name 'asa' stands for 'as a'.

Parameters

$behaviorname
string
the behavior name

Returns

IBehavior
the behavior object, or null if the behavior does not exist

Since

3.2.3
public boolean
# isa( class $class )

Returns whether or not the object or any of the behaviors are of a particular class. The name 'isa' stands for 'is a'. This first checks if $this is an instanceof the class. It then checks each Behavior. If a behavior implements IInstanceCheck, then the behavior can determine what it is an instanceof. If this behavior function returns true, then this method returns true. If the behavior instance checking function returns false, then no further checking is performed as it is assumed to be correct.

Returns whether or not the object or any of the behaviors are of a particular class. The name 'isa' stands for 'is a'. This first checks if $this is an instanceof the class. It then checks each Behavior. If a behavior implements IInstanceCheck, then the behavior can determine what it is an instanceof. If this behavior function returns true, then this method returns true. If the behavior instance checking function returns false, then no further checking is performed as it is assumed to be correct.

If the behavior instance check function returns nothing or null or the behavior doesn't implement the IInstanceCheck interface, then the default instanceof occurs. The default isa behavior is to check if the behavior is an instanceof the class.

The behavior IInstanceCheck is to allow a behavior to have the host object act as a completely different object.

Parameters

$class
class
or string

Returns

boolean
whether or not the object or a behavior is an instance of a particular class

Since

3.2.3
public
# attachBehaviors( array $behaviors )

Attaches a list of behaviors to the component. Each behavior is indexed by its name and should be an instance of IBehavior, a string specifying the behavior class, or a TClassBehaviorEventParameter.

Attaches a list of behaviors to the component. Each behavior is indexed by its name and should be an instance of IBehavior, a string specifying the behavior class, or a TClassBehaviorEventParameter.

Parameters

$behaviors
array
list of behaviors to be attached to the component

Since

3.2.3
public
# detachBehaviors( array $behaviors )

Detaches select behaviors from the component. Each behavior is indexed by its name and should be an instance of IBehavior, a string specifying the behavior class, or a TClassBehaviorEventParameter.

Detaches select behaviors from the component. Each behavior is indexed by its name and should be an instance of IBehavior, a string specifying the behavior class, or a TClassBehaviorEventParameter.

Parameters

$behaviors
array
list of behaviors to be detached from the component

Since

3.2.3
public
# clearBehaviors( )

Detaches all behaviors from the component.

Detaches all behaviors from the component.

Since

3.2.3
public IBehavior
# attachBehavior( string $name, mixed $behavior, mixed $priority = null )

Attaches a behavior to this component. This method will create the behavior object based on the given configuration. After that, the behavior object will be initialized by calling its IBaseBehavior::attach() method.

Attaches a behavior to this component. This method will create the behavior object based on the given configuration. After that, the behavior object will be initialized by calling its IBaseBehavior::attach() method.

Already attached behaviors may implement the function:

public function dyAttachBehavior($name,$behavior[, $chain]) {
 }

to be executed when attachBehavior is called. All attached behaviors are notified through dyAttachBehavior.

Parameters

$name
string
the behavior's name. It should uniquely identify this behavior.
$behavior
mixed
the behavior configuration. This is passed as the first parameter to YiiBase::createComponent to create the behavior object.
$priority

Returns

IBehavior
the behavior object

Since

3.2.3
public IBehavior
# detachBehavior( string $name, numeric $priority = false )

Detaches a behavior from the component. The behavior's IBaseBehavior::detach() method will be invoked.

Detaches a behavior from the component. The behavior's IBaseBehavior::detach() method will be invoked.

Behaviors may implement the function:

public function dyDetachBehavior($name,$behavior[, $chain]) {
 }

to be executed when detachBehavior is called. All attached behaviors are notified through dyDetachBehavior.

Parameters

$name
string
the behavior's name. It uniquely identifies the behavior.
$priority
numeric
the behavior's priority. This defaults to false, aka any priority.

Returns

IBehavior
the detached behavior. Null if the behavior does not exist.

Since

3.2.3
public
# enableBehaviors( )

Enables all behaviors attached to this component independent of the behaviors

Enables all behaviors attached to this component independent of the behaviors

Behaviors may implement the function:

public function dyEnableBehaviors($name,$behavior[, $chain]) {
 }

to be executed when enableBehaviors is called. All attached behaviors are notified through dyEnableBehaviors.

Since

3.2.3
public
# disableBehaviors( )

Disables all behaviors attached to this component independent of the behaviors

Disables all behaviors attached to this component independent of the behaviors

Behaviors may implement the function:

public function dyDisableBehaviors($name,$behavior[, $chain]) {
 }

to be executed when disableBehaviors is called. All attached behaviors are notified through dyDisableBehaviors.

Since

3.2.3
public boolean
# getBehaviorsEnabled( )

Returns if all the behaviors are turned on or off for the object.

Returns if all the behaviors are turned on or off for the object.

Returns

boolean
whether or not all behaviors are enabled (true) or not (false)

Since

3.2.3
public
# enableBehavior( string $name )

Enables an attached object behavior. This cannot enable or disable whole class behaviors. A behavior is only effective when it is enabled. A behavior is enabled when first attached.

Enables an attached object behavior. This cannot enable or disable whole class behaviors. A behavior is only effective when it is enabled. A behavior is enabled when first attached.

Behaviors may implement the function:

public function dyEnableBehavior($name,$behavior[, $chain]) {
 }

to be executed when enableBehavior is called. All attached behaviors are notified through dyEnableBehavior.

Parameters

$name
string
the behavior's name. It uniquely identifies the behavior.

Since

3.2.3
public
# disableBehavior( string $name )

Disables an attached behavior. This cannot enable or disable whole class behaviors. A behavior is only effective when it is enabled.

Disables an attached behavior. This cannot enable or disable whole class behaviors. A behavior is only effective when it is enabled.

Behaviors may implement the function:

public function dyDisableBehavior($name,$behavior[, $chain]) {
 }

to be executed when disableBehavior is called. All attached behaviors are notified through dyDisableBehavior.

Parameters

$name
string
the behavior's name. It uniquely identifies the behavior.

Since

3.2.3
public
# __wakeup( )

Do not call this method. This is a PHP magic method that will be called automatically after any unserialization; it can perform reinitialization tasks on the object.

Do not call this method. This is a PHP magic method that will be called automatically after any unserialization; it can perform reinitialization tasks on the object.

public
# __sleep( )

Returns an array with the names of all variables of that object that should be serialized. Do not call this method. This is a PHP magic method that will be called automatically prior to any serialization.

Returns an array with the names of all variables of that object that should be serialized. Do not call this method. This is a PHP magic method that will be called automatically prior to any serialization.

Constants summary
string GLOBAL_RAISE_EVENT_LISTENER 'fxGlobalListener'
#

Const

string the name of the global TComponent::raiseEvent() listener
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO