/**
  * Handle the plugin configuration form.
  */
 public static function hookConfig()
 {
     $page = intval(@$_POST["configPage"]);
     switch ($page) {
         case 2:
             // $itemReferencesShowMaps = !!$_POST["item_references_show_maps"];
             // set_option('item_references_show_maps', intval($itemReferencesShowMaps) );
             // $itemReferencesShowLines = !!$_POST["item_references_show_lines"];
             // set_option('item_references_show_lines', intval($itemReferencesShowLines) );
             $itemReferencesMapHeight = 0;
             if (isset($_POST["item_references_map_height"])) {
                 $itemReferencesMapHeight = intval($_POST["item_references_map_height"]);
             }
             set_option('item_references_map_height', $itemReferencesMapHeight);
             $itemReferencesElements = SELF::_retrieveReferenceElements();
             $elementConfigurations = array();
             foreach ($itemReferencesElements as $itemReferencesElement) {
                 $elementConfigurationType = intval(@$_POST["item_reference_type_{$itemReferencesElement}"]);
                 $elementConfigurationType = SELF::minMax($elementConfigurationType, 0, 2);
                 $elementConfigurationColor = intval(@$_POST["item_reference_color_{$itemReferencesElement}"]);
                 $elementConfigurationColor = SELF::minMax($elementConfigurationColor, 0, 7);
                 $elementConfigurations[$itemReferencesElement] = array($elementConfigurationType, $elementConfigurationColor);
             }
             $itemReferencesConfiguration = json_encode($elementConfigurations);
             set_option('item_references_configuration', $itemReferencesConfiguration);
             break;
         default:
             $itemReferencesSelect = array();
             $postIds = false;
             if (isset($_POST["item_references_select"])) {
                 $postIds = $_POST["item_references_select"];
             }
             if (is_array($postIds)) {
                 foreach ($postIds as $postId) {
                     $postId = intval($postId);
                     if ($postId) {
                         $itemReferencesSelect[] = $postId;
                     }
                 }
             }
             $itemReferencesSelect = array_unique($itemReferencesSelect);
             $itemReferencesSelect = json_encode($itemReferencesSelect);
             set_option('item_references_select', $itemReferencesSelect);
             $itemReferencesSecondLevel = !!intval(@$_POST["item_references_second_level"]);
             set_option('item_references_second_level', $itemReferencesSecondLevel);
             break;
     }
 }