/** * Get fields. * * @global type $wpcf * @param mixed $args Various args * @param string $toolset Useful in hooks * @return All filtered fields */ function types_get_fields($args = array(), $toolset = 'types') { static $cache = array(); $cache_key = md5(serialize(func_get_args())); if (isset($cache[$cache_key])) { return $cache[$cache_key]; } $fields = WPCF_Fields::getFields($args, $toolset); $cache[$cache_key] = $fields; return $cache[$cache_key]; }
/** * Collect all fields and conditions. */ function collect() { if (is_null($this->triggers)) { $this->collected = array(); $this->triggers = array(); $fields = WPCF_Fields::getFields(); if (is_array($fields) && !empty($fields)) { foreach ($fields as $f_id => $f) { if (!empty($f['data']['conditional_display']['conditions'])) { foreach ($f['data']['conditional_display']['conditions'] as $condition) { $this->collected[$f_id] = $condition; if (!empty($condition['field'])) { $this->triggers[$condition['field']][$f_id][] = $condition; } } } } } } }