* Attaches the Classic 'Subscribe With Google' button. * @param {!Element} button * @param {../api/subscriptions.ButtonOptions|function()} optionsOrCallback * @param {function()=} callback * @return {!Element}
(button, optionsOrCallback, callback)
| 8784 | * @return {!Element} |
| 8785 | */ |
| 8786 | attach(button, optionsOrCallback, callback) { |
| 8787 | const options = this.setupButtonAndGetParams_( |
| 8788 | button, |
| 8789 | AnalyticsEvent.ACTION_SWG_BUTTON_CLICK, |
| 8790 | optionsOrCallback, |
| 8791 | callback |
| 8792 | ).options; |
| 8793 | |
| 8794 | const theme = options['theme']; |
| 8795 | button.classList.add(`swg-button-${theme}`); |
| 8796 | button.setAttribute('role', 'button'); |
| 8797 | if (options['lang']) { |
| 8798 | button.setAttribute('lang', options['lang']); |
| 8799 | } |
| 8800 | button.setAttribute( |
| 8801 | 'title', |
| 8802 | msg(SWG_I18N_STRINGS.SUBSCRIPTION_TITLE_LANG_MAP, button) || '' |
| 8803 | ); |
| 8804 | this.logSwgEvent_(AnalyticsEvent.IMPRESSION_SWG_BUTTON); |
| 8805 | |
| 8806 | return button; |
| 8807 | } |
| 8808 | |
| 8809 | /** |
| 8810 | * Attaches the new subscribe button, for subscription product types. |
no test coverage detected