BP_Admin_Setting_Search

Main Search Settings class.

Description

Source

File: bp-core/admin/settings/bp-admin-setting-search.php

class BP_Admin_Setting_Search extends BP_Admin_Setting_tab {

	public function initialize() {

		$this->tab_label = __( 'Search', 'buddyboss' );
		$this->tab_name  = 'bp-search';
		$this->tab_order = 80;
	}

	public function is_active() {
		return bp_is_active( 'search' );
	}

	public function register_fields() {
		$sections = bp_search_get_settings_sections();

		foreach ( (array) $sections as $section_id => $section ) {

			// Only add section and fields if section has fields
			$fields = bp_search_get_settings_fields_for_section( $section_id );

			if ( empty( $fields ) ) {
				continue;
			}

			// Add the section
			$this->add_section( $section_id, $section['title'], $section['callback'] );

			// Loop through fields for this section
			foreach ( (array) $fields as $field_id => $field ) {
				if ( ! empty( $field['callback'] ) && ! empty( $field['title'] ) ) {
					$sanitize_callback = isset( $field['sanitize_callback'] ) ? $field['sanitize_callback'] : [];
					$args = isset( $field['args'] ) ? $field['args'] : array();
					$this->add_field( $field_id, $field['title'], $field['callback'], $sanitize_callback, $args );
				}
			}
		}
	}

}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Methods

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.