private function _filter_controls()
{
$args = $this->get_args();
$controls = $this->_get_controls($args);
if (!is_array($args['fields'])) {
return $controls;
}
$filtered_controls = array_intersect_key($controls, array_flip($args['fields']));
// Include all condition depended controls
foreach ($filtered_controls as $control) {
if (empty($control['condition'])) {
continue;
}
$depended_controls = array_intersect_key($controls, $control['condition']);
$filtered_controls = array_merge($filtered_controls, $depended_controls);
$filtered_controls = array_intersect_key($controls, $filtered_controls);
}
return $filtered_controls;
}