Element_Setting_Query::parse_where()

Parses the SQL where clause.

Description

Return

(array) Array with the first element being the array of SQL where clauses and the second being the array of arguments for those where clauses.

Source

File: src/db-objects/element-settings/element-setting-query.php

	protected function parse_where() {
		list( $where, $args ) = parent::parse_where();

		list( $where, $args ) = $this->parse_default_where_field( $where, $args, 'element_id', 'element_id', '%d', 'absint', true );

		if ( ! empty( $this->query_vars['container_id'] ) ) {
			$table_name = $this->manager->get_table_name();
			$element_table_name = $this->manager->get_parent_manager( 'elements' )->get_table_name();

			list( $where, $args ) = $this->parse_default_where_field( $where, $args, 'container_id', 'container_id', '%d', 'absint', true );
			$where['container_id'] = str_replace( "%{$table_name}%", "%{$element_table_name}%", $where['container_id'] );
		}

		if ( ! empty( $this->query_vars['form_id'] ) ) {
			$table_name = $this->manager->get_table_name();
			$container_table_name = $this->manager->get_parent_manager( 'elements' )->get_parent_manager( 'containers' )->get_table_name();

			list( $where, $args ) = $this->parse_default_where_field( $where, $args, 'form_id', 'form_id', '%d', 'absint', true );
			$where['form_id'] = str_replace( "%{$table_name}%", "%{$container_table_name}%", $where['form_id'] );
		}

		return array( $where, $args );
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.