Email_Notifications::register_assets( awsmug\Torro_Forms\Modules\Actions\Assets $assets )

Registers all assets the submodule provides.

Description

Parameters

$assets

(awsmug\Torro_Forms\Modules\Actions\Assets) (Required) The plugin assets instance.

Source

File: src/modules/actions/email-notifications.php

	public function register_assets( $assets ) {
		$template_tag_template = '<li class="template-tag template-tag-%slug%">';
		$template_tag_template .= '<button type="button" class="template-tag-button" data-tag="%slug%">%label%</button>';
		$template_tag_template .= '</li>';

		$template_tag_group_template = '<li class="template-tag-list-group template-tag-list-group-%slug%">';
		$template_tag_group_template .= '<span>%label%</span>';
		$template_tag_group_template .= '<ul></ul>';
		$template_tag_group_template .= '</li>';

		$assets->register_script( 'admin-email-notifications', 'assets/dist/js/admin-email-notifications.js', array(
			'deps'          => array( 'jquery', 'torro-template-tag-fields', 'torro-admin-form-builder' ),
			'in_footer'     => true,
			'localize_name' => 'torroEmailNotifications',
			'localize_data' => array(
				'templateTagGroupTemplate' => $template_tag_group_template,
				'templateTagTemplate'      => $template_tag_template,
				'templateTagSlug'          => 'value_element_%element_id%',
				'templateTagGroup'         => 'submission',
				'templateTagGroupLabel'    => _x( 'Submission', 'template tag group', 'torro-forms' ),
				/* translators: %s: element label */
				'templateTagLabel'         => sprintf( __( 'Value for &#8220;%s&#8221;', 'torro-forms' ), '%element_label%' ),
				/* translators: %s: element label */
				'templateTagDescription'   => sprintf( __( 'Inserts the submission value for the element &#8220;%s&#8221;.', 'torro-forms' ), '%element_label%' ),
			),
		) );
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.