Admin_Menu::plugins_loaded()


Source

File: src/core/admin/class-admin-menu.php

	public function plugins_loaded() {
		$tabs = array(
			'settings' => array(
				'name'        => esc_attr__( 'Settings', 'uncanny_automator' ),
				'title'       => esc_attr__( 'Auto-prune activity logs', 'uncanny-automator' ),
				'description' => esc_attr__( 'Enter a number of days below to have trigger and action log entries older than the specified number of days automatically deleted from your site daily. Trigger and action log entries will only be deleted for recipes with "Completed" status.', 'uncanny-automator' ),
				'is_pro'      => true,
				'fields'      => array( /* see implementation in pro*/ ),
			),
		);

		$tabs       = apply_filters( 'uap_settings_tabs', $tabs );
		self::$tabs = apply_filters( 'automator_settings_tabs', $tabs );
		if ( self::$tabs ) {
			$tabs = json_decode( wp_json_encode( self::$tabs ), false );
			foreach ( $tabs as $tab => $tab_settings ) {
				if ( $tab_settings->fields ) {
					foreach ( $tab_settings->fields as $field_id => $field_settings ) {
						$args = isset( $field_settings->field_args ) ? $field_settings->field_args : array();
						if ( empty( $args ) ) {
							register_setting( $tab_settings->settings_field, $field_id );
						} else {
							register_setting( $tab_settings->settings_field, $field_id, $args );
						}
					}
				}
			}
		}
	}