Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / image_widget_crop / js / ImageWidgetCropType.js
index 5ca293b358fe822ae9822a5e55031920a3066d0b..3a65aa5dd411e813336a0c97b4dbde1e7a01f981 100644 (file)
      */
     this.showDefaultCrop = true;
 
+    /**
+     * Flag indicating whether to show the default crop.
+     *
+     * @type {Boolean}
+     */
+    this.isRequired = false;
+
     /**
      * The soft limit of the crop.
      *
    * The "cropmove" event handler for the Cropper plugin.
    */
   Drupal.ImageWidgetCropType.prototype.cropMove = function () {
-    this.updateSoftLimits();
+    this.built();
   };
 
   /**
 
     // Set the default options.
     this.options = $.extend({}, this.defaultOptions);
+    this.isRequired = this.$wrapper.data('drupalIwcRequired');
 
     // Extend this instance with data from the wrapper.
     var data = this.$wrapper.data();
       this.options.autoCrop = true;
     }
 
-    this.options.data.rotate = 0;
     this.options.data.scaleX = 1;
     this.options.data.scaleY = 1;
 
     return summary.join('<br>');
   };
 
+    /**
+     * Override Theme function for a vertical tabs.
+     *
+     * @param {object} settings
+     *   An object with the following keys:
+     * @param {string} settings.title
+     *   The name of the tab.
+     *
+     * @return {object}
+     *   This function has to return an object with at least these keys:
+     *   - item: The root tab jQuery element
+     *   - link: The anchor tag that acts as the clickable area of the tab
+     *       (jQuery version)
+     *   - summary: The jQuery element that contains the tab summary
+     */
+  Drupal.theme.verticalTab = function (settings) {
+      var tab = {};
+      this.isRequired = settings.details.data('drupalIwcRequired');
+      tab.item = $('<li class="vertical-tabs__menu-item" tabindex="-1"></li>').append(tab.link = $('<a href="#"></a>').append(tab.title = $('<strong class="vertical-tabs__menu-item-title"></strong>').text(settings.title)).append(tab.summary = $('<span class="vertical-tabs__menu-item-summary"></span>')));
+
+      // If those Crop type is required add attributes.
+      if (this.isRequired) {
+        tab.title.addClass('js-form-required form-required');
+      }
+
+      return tab;
+  };
+
 }(jQuery, Drupal));