You are here

function fullcalendar_plugin_style_fullcalendar::fullcalendar_cast_nested_value in FullCalendar 7.2

If #data_type is defined, use that as the type for casting the value.

Parameters

array $values: An array of View option form values.

array $form: The Views option form definition.

string $current_key: The current key being processed.

array $parents: An array of parent keys when recursing through the nested array.

1 call to fullcalendar_plugin_style_fullcalendar::fullcalendar_cast_nested_value()
fullcalendar_plugin_style_fullcalendar::options_validate in includes/views/plugins/fullcalendar_plugin_style_fullcalendar.inc
Validate the options form.

File

includes/views/plugins/fullcalendar_plugin_style_fullcalendar.inc, line 199
Contains the FullCalendar style plugin.

Class

fullcalendar_plugin_style_fullcalendar
@file Contains the FullCalendar style plugin.

Code

function fullcalendar_cast_nested_value(&$values, $form, $current_key = NULL, $parents = array()) {
  foreach ($values as $key => &$value) {

    // We are leaving a recursive loop, remove the last parent key.
    if (empty($current_key)) {
      array_pop($parents);
    }

    // In case we recurse into an array, or need to specify the key for
    // drupal_array_get_nested_value(), add the current key to $parents.
    $parents[] = $key;
    if (is_array($value)) {

      // Enter another recursive loop.
      $this
        ->fullcalendar_cast_nested_value($value, $form, $key, $parents);
    }
    else {

      // Get the form definition for this key.
      $form_value = drupal_array_get_nested_value($form, $parents);

      // Check to see if #data_type is specified, if so, cast the value.
      if (isset($form_value['#data_type'])) {
        settype($value, $form_value['#data_type']);
      }

      // Remove the current key from $parents to move on to the next key.
      array_pop($parents);
    }
  }
}