Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Settings_Notifications::get_notification_settings( LLMS_Abstract_Notification_Controller $controller )

Get settings specific to the current notification type


Parameters Parameters

$controller

(LLMS_Abstract_Notification_Controller) (Required) Instance of an LLMS_Abstract_Notification_Controller extending class.


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/admin/settings/class.llms.settings.notifications.php

	private function get_notification_settings( $controller ) {

		$settings = array();

		// Setup vars.
		$type  = llms_filter_input_sanitize_string( INPUT_GET, 'type' );
		$types = $controller->get_supported_types();
		$title = $controller->get_title() . ' (' . $types[ $type ] . ')';
		$view  = $controller->get_mock_view( $type );

		// So the merge code button can use it.
		$this->view = $view;

		// Output the merge code button for the WYSIWYG editor.
		add_action( 'media_buttons', array( $this, 'merge_code_button' ) );

		// Add a breadcrumb on the top of the page.
		$settings[] = $this->get_breadcrumbs( $title );

		// Add field options for the view.
		$settings = array_merge( $settings, $view->get_field_options( $type ) );

		$subscribers = $controller->get_subscriber_options( $type );

		foreach ( $subscribers as $i => $data ) {

			$sub_settings = array(
				'default' => $data['enabled'],
				'desc'    => $data['title'],
				'id'      => sprintf( '%1$s[%2$s]', $controller->get_option_name( $type . '_subscribers' ), $data['id'] ),
				'type'    => 'checkbox',
			);

			if ( 0 === $i ) {
				$sub_settings['title']         = __( 'Subscribers', 'lifterlms' );
				$sub_settings['checkboxgroup'] = 'start';
			} elseif ( count( $subscribers ) - 1 === $i ) {
				$sub_settings['checkboxgroup'] = 'end';
			} else {
				$sub_settings['checkboxgroup'] = 'middle';
			}

			$settings[] = $sub_settings;

			if ( 'custom' === $data['id'] ) {
				$settings[] = array(
					'desc' => $data['description'],
					'id'   => $controller->get_option_name( $type . '_custom_subscribers' ),
					'type' => 'text',
				);
			}
		}

		// Add additional controller options.
		$settings = array_merge( $settings, $controller->get_additional_options( $type ) );

		if ( $controller->is_testable( $type ) ) {
			foreach ( $controller->get_test_settings( $type ) as $setting ) {
				$setting['id'] = 'llms_notification_test_data[' . $setting['id'] . ']';
				$settings[]    = $setting;
			}
		}

		return apply_filters( 'llms_notification_settings_' . $controller->id . '_' . $type, $settings, $controller, $view );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.9.0 Stop using deprecated FILTER_SANITIZE_STRING.
5.2.0 Merge controller additional options.
3.8.0
3.24.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.