コード例 #1
0
                 // Set the tv properties and then add it to the sync
                 if ($element->set_properties($properties)) {
                     $element_sync->add_element('modTemplateVar', $tv->name, $tv_file_mod_time);
                 }
             }
         }
     }
 }
 // Remove any flagged tvs
 if (count($flagged_tvs) > 0) {
     $updated_tvs = $tvs;
     foreach ($flagged_tvs as $i) {
         unset($updated_tvs[$i]);
     }
     // Update the template variable file and remove the tvs from the sync if successfull
     if ($element_helper->update_tv_file($updated_tvs)) {
         foreach ($flagged_tvs as $i) {
             $element_sync->remove_element('modTemplateVar', $tvs[$i]->name);
         }
     }
 }
 // Process the template variable elements
 foreach ($modx->getCollection('modTemplateVar') as $element_object) {
     // Check if the tv exists in the template variables file
     $element = Element::insert($element_object);
     $name = $element->get_property('name');
     $category_id = $element->get_property('category');
     $tv_file_has_tv = false;
     // Check if the element has a category and is whitelisted
     if ($category_id !== 0) {
         $category = Element::get($modx, 'modCategory', $category_id);