Contents
What is extensions in VF page?
Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user. A controller extension is an Apex class that extends the functionality of a standard or custom controller.
What is the use of ApexPages StandardController?
StandardController objects reference the pre-built Visualforce controllers provided by Salesforce. The only time it is necessary to refer to a StandardController object is when defining an extension for a standard controller. StandardController is the data type of the single argument in the extension class constructor.
Which is an example of a controller extension?
A controller extension is any Apex class containing a constructor that takes a single argument of type ApexPages.StandardController or CustomControllerName, where CustomControllerName is the name of a custom controller you want to extend. The following class is a simple example of a controller extension:
What happens when you extend a standard controller?
If the Controller Extension extends a Standard Controller it will execute in user mode in which permissions, field-level security, and sharing rules of the current user apply, even though a controller extension class executes in system mode. Standard controllers: It is used for performing operations on a single record.
How is a standardcontroller used in a constructor?
The following example shows how a StandardController object can be used in the constructor for a standard controller extension: // controller. The following Visualforce markup shows how the controller extension from above can be used in a page:
When to use a controller extension in apex?
Controller Extension is an Apex Code that extends the functionality of a Standard or Custom Controller. When we want to use the built-in functionality of a Standard Controller but override one or more actions, like edit, view, save, or delete.