Noptin_Automation_Rules_Table::column_rule( Noptin_Automation_Rule $item )

Displays the automation rule


Parameters Parameters

$item

(Noptin_Automation_Rule) (Required) item.


Top ↑

Return Return

(HTML)


Top ↑

Source Source

File: includes/automation-rules/class-noptin-automation-rules-table.php

	public function column_rule( $item ) {

		// Row actions.
		$row_actions = array();
		$edit_url    = esc_url( add_query_arg( 'edit', $item->id, $this->base_url ) );

		$row_actions['edit'] = '<a href="' . $edit_url . '">' . __( 'Edit', 'newsletter-optin-box' ) . '</a>';

		$delete_url  = esc_url( 
			add_query_arg(
				array(
					'noptin_admin_action' => 'noptin_delete_automation_rule',
					'delete'			  => $item->id,
					'_wpnonce'            => wp_create_nonce( 'noptin-automation-rule' )
				),
				$this->base_url
			)
		);
		$delete_text = __( 'Delete', 'newsletter-optin-box' );

		$row_actions['delete'] = "<a class='noptin-delete-single-automation-rule' href='$delete_url'>$delete_text</a>";

		$row_actions = $this->row_actions( $row_actions );

		// Row text.
		$action_id  = noptin_clean( $item->action_id );
		$action     = noptin()->automation_rules->get_action( $action_id );
		$trigger_id = noptin_clean( $item->trigger_id );
		$trigger    = noptin()->automation_rules->get_trigger( $trigger_id );

		if ( empty( $action ) ) {
			$action_text = sprintf(
				"%s: $action_id",
				__( 'Action:', 'newsletter-optin-box' )
			);
		} else {
			$action_text = $action->get_rule_description( $item );
		}

		if ( empty( $trigger ) ) {
			$trigger_text = sprintf(
				"%s: $trigger_id",
				__( 'Trigger:', 'newsletter-optin-box' )
			);
		} else {
			$trigger_text = $trigger->get_rule_description( $item );
		}

		$text = ucfirst( "$trigger_text, $action_text" );
		$text = "<div class='row-title' style='font-weight: 500;'><a href='$edit_url'>$text</a></div>";

		return "<div>$text $row_actions</div>";

	}


Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation