API Docs for: 1.0.0
Show:

File: Resources/public/js/views/services/plugins/ez-sectionloadplugin.js

  1. /*
  2. * Copyright (C) eZ Systems AS. All rights reserved.
  3. * For full copyright and license information view LICENSE file distributed with this source code.
  4. */
  5. YUI.add('ez-sectionloadplugin', function (Y) {
  6. "use strict";
  7. /**
  8. * Provides the section load plugin
  9. *
  10. * @module ez-sectionloadplugin
  11. */
  12. Y.namespace('eZ.Plugin');
  13.  
  14. /**
  15. * Object section load plugin.
  16. *
  17. * In order to use it you need to fire the `loadSection` event with two parameters:
  18. * - `content` the content containing the section to be loaded
  19. * - `callback` the callback
  20. *
  21. * @namespace eZ.Plugin
  22. * @class SectionLoad
  23. * @constructor
  24. * @extends eZ.Plugin.ViewServiceBase
  25. */
  26. Y.eZ.Plugin.SectionLoad = Y.Base.create('sectionloadplugin', Y.eZ.Plugin.ViewServiceBase, [], {
  27.  
  28. initializer: function () {
  29. this.onHostEvent('*:loadSection', this._loadSection);
  30. },
  31.  
  32. /**
  33. * Loads a Section. Once this is done, it sets the section in
  34. * the attribute defined in the event parameter of the event target.
  35. * @protected
  36. * @method _loadSection
  37. * @param {Object} e loadSection event facade
  38. */
  39. _loadSection: function (e) {
  40. var loadOptions = {api: this.get('host').get('capi')};
  41. e.content.loadSection(loadOptions, e.callback);
  42. },
  43. }, {
  44. NS: 'sectionLoad',
  45. });
  46.  
  47. Y.eZ.PluginRegistry.registerPlugin(
  48. Y.eZ.Plugin.SectionLoad, ['locationViewViewService']
  49. );
  50. });
  51.