blocks->get_campaign_options( true ); $campaigns = ! empty( $campaigns['other'] ) ? array_merge( array( '' => esc_html__( 'Select Campaign...', 'optin-monster-api' ) ), $campaigns['other'] ) : array( '' => 'N/A' ); $this->add_control( 'om_button_campaign_id', array( 'label' => esc_html__( 'Click to Load Popup', 'optin-monster-api' ), 'type' => Controls_Manager::SELECT, 'frontend_available' => true, 'label_block' => true, 'options' => $campaigns, 'default' => '', ), array( 'position' => array( 'type' => 'control', 'of' => 'link', ), ) ); $link_control = $this->get_controls( 'link' ); $link_control['condition'] = array( 'om_button_campaign_id' => '', ); $this->add_control( 'link', $link_control, array( 'overwrite' => true, ) ); } /** * Render button widget output in the editor. * * Written as a Backbone JavaScript template and used to generate the live preview. * * @since 2.9.0 * @access protected */ protected function content_template() { ?> <# if ( settings.om_button_campaign_id ) { settings.link = settings.link || {} settings.link.url = '/c/' + settings.om_button_campaign_id + '/'; settings.link.is_external = 'on'; settings.link.nofollow = false; settings.link.custom_attributes = 'rel|noopener noreferrer'; } #> OPTINMONSTER_SHAREABLE_LINK . '/c/' . sanitize_text_field( $settings['om_button_campaign_id'] ) . '/', 'is_external' => 'on', 'nofollow' => false, 'custom_attributes' => 'rel|noopener noreferrer', ), $settings['link'] ); } return $settings; } }