text: define([
      'dojo/_base/declare',
      'dojo/_base/lang',
      'dojo/_base/array',
      'dojo/on',
      'dojo/dom-class',
      'dojo/dom-style',
      'dojo/dom-attr',
      'dojo/html',
      'dijit/_WidgetBase',
      'dijit/_TemplatedMixin',
      'dojo/text!./templates/Sublayer.html'
  ], function (
      declare,
      lang,
      array,
      on,
      domClass,
      domStyle,
      domAttr,
      html,
      WidgetBase,
      TemplatedMixin,
      sublayerTemplate
  ) {
      return declare([WidgetBase, TemplatedMixin], {
          control: null,
          sublayerInfo: null,
          // ^args
          templateString: sublayerTemplate,
          _expandClickHandler: null,
          postCreate: function () {
              this.inherited(arguments);
              if (array.indexOf(this.control.layer.visibleLayers, this.sublayerInfo.id) !== -1) {
                  domClass.remove(this.checkNode, 'fa-square-o');
                  domClass.add(this.checkNode, 'fa fa-check-square-o');
                  domAttr.set(this.checkNode, 'data-checked', 'checked');
              } else {
                  domAttr.set(this.checkNode, 'data-checked', 'unchecked');
              }
              domAttr.set(this.checkNode, 'data-sublayer-id', this.sublayerInfo.id);
              domClass.add(this.checkNode, this.control.layer.id + '-layerControlSublayerCheck');
              on(this.checkNode, 'click', lang.hitch(this, function () {
                  if (domAttr.get(this.checkNode, 'data-checked') === 'checked') {
                      domAttr.set(this.checkNode, 'data-checked', 'unchecked');
                      domClass.remove(this.checkNode, 'fa-check-square-o');
                      domClass.add(this.checkNode, 'fa-square-o');
                  } else {
                      domAttr.set(this.checkNode, 'data-checked', 'checked');
                      domClass.remove(this.checkNode, 'fa-square-o');
                      domClass.add(this.checkNode, 'fa-check-square-o');
                  }
                  this.control._setVisibleLayers();
                  this._checkboxScaleRange();
              }));
              html.set(this.labelNode, this.sublayerInfo.name);
              this._expandClick();
              if (this.sublayerInfo.minScale !== 0 || this.sublayerInfo.maxScale !== 0) {
                  this._checkboxScaleRange();
                  this.control.layer.getMap().on('zoom-end', lang.hitch(this, '_checkboxScaleRange'));
              }
          },
          // add on event to expandClickNode
          _expandClick: function () {
              this._expandClickHandler = on(this.expandClickNode, 'click', lang.hitch(this, function () {
                  var expandNode = this.expandNode,
                      iconNode = this.expandIconNode;
                  if (domStyle.get(expandNode, 'display') === 'none') {
                      domStyle.set(expandNode, 'display', 'block');
                      domClass.replace(iconNode, 'fa-minus-square-o', 'fa-plus-square-o');
                  } else {
                      domStyle.set(expandNode, 'display', 'none');
                      domClass.replace(iconNode, 'fa-plus-square-o', 'fa-minus-square-o');
                  }
              }));
          },
          // check scales and add/remove disabled classes from checkbox
          _checkboxScaleRange: function () {
              var node = this.checkNode,
                  scale = this.control.layer.getMap().getScale(),
                  min = this.sublayerInfo.minScale,
                  max = this.sublayerInfo.maxScale;
              domClass.remove(node, 'layerControlCheckIconOutScale');
              if ((min !== 0 && scale > min) || (max !== 0 && scale < max)) {
                  domClass.add(node, 'layerControlCheckIconOutScale');
              }
          }
      });
  });