# ninja_forms_calc_filter_list_options_span

Function that filters the list options span and adds the appropriate listener class if there is a calc needed for the field.

## Description

`ninja_forms_calc_filter_list_options_span( \$class, \$field_id ); `

0. \$class
The class.
1. \$field_id
The field id.

## Usage

`if ( !function_exists( 'ninja_forms_calc_filter_list_options_span' ) ) {     require_once ABSPATH . PLUGINDIR . 'ninja-forms/deprecated/includes/fields/calc.php'; }   // The class. \$class = null;   // The field id. \$field_id = null;   // NOTICE! Understand what this does before running. \$result = ninja_forms_calc_filter_list_options_span(\$class, \$field_id);     `

## Defined (1)

The function is defined in the following location(s).

/deprecated/includes/fields/calc.php
`function ninja_forms_calc_filter_list_options_span( \$class, \$field_id ) {     global \$ninja_forms_loading, \$ninja_forms_processing;      if ( isset ( \$ninja_forms_loading ) ) {         \$field_row = \$ninja_forms_loading->get_field_settings( \$field_id );     } else {         \$field_row = \$ninja_forms_processing->get_field_settings( \$field_id );     }      \$add_class = false;     // Check to see if this field has cal_auto_include set to 1. If it does, we want to output a class name.     if ( isset ( \$field_row['data']['calc_auto_include'] ) AND !empty ( \$field_row['data']['calc_auto_include'] ) ) {         \$add_class = true;     }      if ( isset ( \$ninja_forms_loading ) ) {         \$all_fields = \$ninja_forms_loading->get_all_fields();     } else {         \$all_fields = \$ninja_forms_processing->get_all_fields();     }      foreach ( \$all_fields as \$f_id => \$user_value ) {          if ( isset ( \$ninja_forms_loading ) ) {             \$field = \$ninja_forms_loading->get_field_settings( \$f_id );         } else {             \$field = \$ninja_forms_processing->get_field_settings( \$f_id );         }          if ( isset ( \$field['type'] ) && \$field['type'] == '_calc' ) {             if ( isset ( \$field['data']['calc_method'] ) ) {                 \$calc_method = \$field['data']['calc_method'];             } else {                 \$calc_method = 'auto';             }              switch ( \$calc_method ) {                 case 'fields':                     if ( isset ( \$field['data']['calc'] ) ) {                         foreach ( \$field['data']['calc'] as \$calc ) {                             if ( \$calc['field'] == \$field_id ) {                                 \$add_class = true;                                 break;                             }                         }                     }                     break;                 case 'eq':                     \$eq = \$field['data']['calc_eq'];                     if (preg_match("/\bfield_".\$field_id."\b/i", \$eq ) ) {                         \$add_class = true;                         break;                     }                     break;             }         }     }     if ( \$add_class ) {         \$class .= ' ninja-forms-field-list-options-span-calc-listen';     }      return \$class; } `