You are here

function sweaver_rebuild_containers in Sweaver 7

Rebuild properties' containers

2 calls to sweaver_rebuild_containers()
sweaver_clear_cache in ./sweaver.module
Clear cache and page requisites.
sweaver_default_sweaver_selector in ./sweaver.module
Implements hook_default_sweaver_selector().

File

./sweaver.module, line 670
Sweaver functions.

Code

function sweaver_rebuild_containers() {
  $containers = variable_get('sweaver_editor_form_configuration', array());
  $initial_properties_count = 0;

  // We establish the different containers available.
  foreach ($containers as $key => $container) {
    $initial_properties_count += count($container['properties']);
    $containers[$key]['properties'] = array();
  }
  $properties = sweaver_object_load(NULL, 'property');

  // Check up to see if we should rebuild the registry.
  // Rebuilding process is engaged if a new property has been added
  if (count($properties) > $initial_properties_count) {
    foreach ($properties as $property_name => $property) {
      if (isset($property->container)) {
        if (!empty($property->container)) {
          $containers[$property->container]['properties'][] = $property_name;
        }
      }
    }
    variable_set('sweaver_editor_form_configuration', $containers);
  }
}