WPForms_Uncanny_Automator::builder_sidebar()


Source Source

File: src/core/admin/class-wpforms-provider.php

	public function builder_sidebar() {

		if ( ! automator_filter_has_var( 'form_id' ) ) {
			return;
		}
		$form_id    = (int) automator_filter_input( 'form_id' );
		$configured = '';
		global $wpdb;

		$forms = $wpdb->get_col( $wpdb->prepare( "SELECT p.post_parent
FROM $wpdb->postmeta pm
LEFT JOIN $wpdb->posts p
ON p.ID = pm.post_id AND p.post_type = %s
WHERE 1=1
AND ( pm.`meta_key` LIKE %s OR pm.`meta_key` LIKE %s OR pm.`meta_key` LIKE %s )
AND pm.`meta_value` LIKE %d
GROUP BY p.post_parent", 'uo-trigger', 'ANONWPFFORMS', 'WPFFORMS', 'ANONWPFSUBFORM', $form_id ) );
		if ( ! empty( $forms ) ) {
			$configured               = 'configured';
			$this->configured_recipes = $forms;
		}
		echo '<a href="#" class="wpforms-panel-sidebar-section icon ' . esc_attr( $configured ) . ' wpforms-panel-sidebar-section-' . esc_attr( $this->slug ) . '" data-section="' . esc_attr( $this->slug ) . '">';

		echo '<img src="' . esc_url( $this->icon ) . '">';

		echo esc_html( $this->name );

		echo '<i class="fa fa-angle-right wpforms-toggle-arrow"></i>';

		if ( ! empty( $configured ) ) {
			echo '<i class="fa fa-check-circle-o"></i>';
		}

		echo '</a>';
	}