/**
  * Save the fields container.
  *
  * @return void
  */
 public function save()
 {
     global $post_id;
     thb_duplicable_fields_save($this->_field, $post_id);
 }
Пример #2
0
 function thb_save_tab()
 {
     thb_system_verify_nonce('THB_tab');
     $theme = thb_theme();
     $page = $theme->getAdmin()->getPage($_POST['page']);
     $tab = $page->getTab($_POST['tab']);
     $containers = $tab->getContainers();
     $uniqids = array();
     foreach ($containers as $container) {
         if (!$container->isDuplicable()) {
             $newoptions = array();
             foreach ($container->getFields() as $field) {
                 if ($field->isComplex()) {
                     $value = array();
                     foreach ($field->getSubkeys() as $subKey) {
                         $value[$subKey] = thb_text_toDB($_POST[$field->getName()][$subKey]);
                     }
                 } else {
                     $value = thb_text_toDB($_POST[$field->getName()]);
                 }
                 $newoptions[$field->getName()] = $value;
             }
             $theme->saveOptions($newoptions);
         } else {
             $uniqids[$container->getSlug()] = thb_duplicable_fields_save($container->getField());
         }
     }
     thb_system_raise_success(__('All saved!', 'thb_text_domain'), $uniqids);
 }