You are here

function widgets_set_features_revert in Widgets 7

Implements hook_features_revert().

1 call to widgets_set_features_revert()
widgets_set_features_rebuild in ./widgets.features.inc
Implements hook_features_rebuild().

File

./widgets.features.inc, line 137

Code

function widgets_set_features_revert($module) {
  if ($data = features_get_default('widgets_set', $module)) {
    foreach ($data as $set_name => $set) {

      // Use name as uuid, strip numeric wsid.
      if (isset($set['wsid'])) {
        unset($set['wsid']);
      }

      // Set will contained localized wsid.
      $set = widgets_set_save($set);

      // Iterate through elements and save custom elements.
      if (isset($set['elements']) && is_array($set['elements'])) {
        foreach ($set['elements'] as $elem_name => $elem) {

          // Set wsid to localized wsid.
          $elem['wsid'] = $set['wsid'];
          if (isset($set['weid'])) {
            unset($set['weid']);
          }

          // Set will contained localized weid.
          $elem = widgets_element_save($elem);
        }
      }
    }
  }
}