Documentation

landing.demos.register

landing.demos.register(
   data
)

The method registers template in the site and page wizard. Returns array of IDs for created templates. Method execution is interrupted when an error occurs in the elements array and error description is returned.

To distribute the created site, it is sufficient to export into the file on the source account and to distribute its app by calling this method during installation.

Parameters

Parameter Description Available from version
data Result of the method landing.site.fullExport as is.
params Can contain the following keys (for On-Premise versions only):
  • site_template_id - binding of block to specific site template (main module).

Localization

For clarifications on template localizations, please go here. When a localization is required, uncomment the keys lang and lang_original. The principle used here is the same as with blocks localization.

Please be advised, localization apply only to the main phrases: page names, descriptions. Do not overload this array by unnecessary information.

Example

Please notice, that the example uses the result if the method landing.site.fullExport.

BX24.callMethod(
   'landing.site.fullExport',
   {
      id: 326,
      params: {
         edit_mode: 'Y',
         code: 'myfirstsite',//symbolic code of site
         name: 'Car repair shop site',// site (page) name
         description: 'Site for your car service company. All you need is under the hood.',//site description
         preview_url: 'http://sample.landing.mycompany.com/',//preview url
         preview: 'http://site.com/preview.jpg',//main preview image for template list (280x115 is recommended)
         preview2x: 'http://site.com/preview.jpg',//enlarged preview image (560x230 is recommended)
         preview3x: 'http://site.com/preview.jpg',//retina-size of preview image (845x345 is recommended)
      }
   },
   function(result)
   {
      if(result.error())
      {
         console.error(result.error());
      }
      else
      {
         var data = result.data();
         console.info(data);
         BX24.callMethod(
            'landing.demos.register',
            {
               data: data,
               params: {
                  site_template_id: '',//pass template value, if you register it for your template (only for On Premise versions!)
                  //localization array and the original language
                  /*lang: {
                     en: {
                        'Phrase 1': 'Translate en 1',
                        'Phrase 2': 'Translate en 2'
                     },
                     de: {
                        'Phrase 1': 'Translate de 1',
                        'Phrase 2': 'Translate de 2'
                     }
                  },
                  lang_original: 'ru'*/
               }
            },
            function(result)
            {
               if(result.error())
               {
                  console.error(result.error());
               }
               else
               {
                  console.info(result.data());
               }
            }
         );
      }
   }
);


© «Bitrix24», 2001-2024
Up