Views: 3985
Last Modified: 18.01.2022

Terminology

  • Action, or AJAX action is a responder method that implements final logic, executes operations and returns data.
  • Controller - is a combination of AJAx-actions.
  • configureActions() method regulates configuration of actions inside the controller, defining rules of access to actions.
  • Pre-, post-filters are configuration items, that are action start and end event handers. Prefilter can block the start, postfilter can affect the result.

Agreements

Note: Main (main) module version 20.600.87 supports PSR-4 in ajax-controllers.
  • Upon calling all parameter names are caseSEnsitive
  • Upon calling all parameter names are caseSEnsitive
  • Upon calling all action names are case-INsensitive
  • Full action name is generated by the template vendor:module.partOfNamespace0.partOfNamespace1.Controller.action.
        \Bitrix\Disk\Controller\Folder::getAction() 
        bitrix:disk.Controller.Folder.get
    
        \Bitrix\Disk\Controller\Intergation\Dropbox::connectAction() 
        bitrix:disk.Controller.Intergation.Dropbox.connect
    
        \Qsoft\Somedisk\Controller\SuperFolder::getAction() 
        qsoft:somedisk.Controller.SuperFolder.get
  • When not indicating the vendor:, it means it is bitrix:
        \Bitrix\Disk\Controller\Folder::getAction() 
        disk.Controller.Folder.get
  • When indicating defaultNamespace in module settings, it can be omitted and not indicated in the action.
    	defaultNamespace = \Bitrix\Disk\Controller
    	
        \Bitrix\Disk\Controller\Folder::getAction() 
        disk.Folder.get
  • When indicating alias in module settings, use it instead of abbreviated namespace.
    	\Bitrix\Disk\CloudIntegration\Controller => cloud
    	
        \Bitrix\Disk\CloudIntegration\Controller\File::getAction() 
        disk.cloud.File.get
  • Upon calling the action from component, indicate full component name and action name (without Action suffix).
        bitrix:list.example
        showFormAction
    
        BX.ajax.runComponentAction('bitrix:list.example', 'showForm', {
            ...
        }).then(function (response) {});
  • Time, date, links must be returned not in string format, but as objects.
            \Bitrix\Main\Type\DateTime
            \Bitrix\Main\Type\Date
            \Bitrix\Main\Web\Uri




Courses developed by Bitrix24