Form_List_Page_Handler::render_custom_list_table_column( string $column_name, awsmug\Torro_Forms\DB_Objects\Forms\Form $form )

Renders a custom list table column.

Description

Parameters

$column_name

(string) (Required) Name of the column to render.

$form

(awsmug\Torro_Forms\DB_Objects\Forms\Form) (Required) Current form object.

Source

File: src/db-objects/forms/form-list-page-handler.php

	protected function render_custom_list_table_column( $column_name, $form ) {
		switch ( $column_name ) {
			case 'form_shortcode':
				$this->form_manager->assets()->enqueue_script( 'clipboard' );
				$this->form_manager->assets()->enqueue_style( 'clipboard' );

				$id_attr = 'form-shortcode-' . $form->id;

				?>
				<input id="<?php echo esc_attr( $id_attr ); ?>" class="clipboard-field" value="<?php echo esc_attr( sprintf( "[{$this->form_manager->get_prefix()}form id=&quot;%d&quot;]", $form->id ) ); ?>" readonly="readonly" />
				<button type="button" class="clipboard-button button" data-clipboard-target="#<?php echo esc_attr( $id_attr ); ?>">
					<?php $this->form_manager->assets()->render_icon( 'torro-icon-clippy', __( 'Copy to clipboard', 'torro-forms' ) ); ?>
				</button>
				<?php
				break;
			case 'submission_count':
				$count = $this->get_submission_count( $form->id );

				$output = esc_html( $count );
				if ( $count > 0 ) {
					$output = '<a href="' . esc_url( add_query_arg( 'form_id', $form->id, torro()->admin_pages()->get( 'list_submissions' )->url ) ) . '">' . $output . '</a>';
				}

				echo $output;
				break;
		}
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.