UPGRADING FROM VERSION 2.xx to 3.xx
--------------------------------------------------------------------------------
There have been several code changes since v2.xx that require updates.  Errors
will generally be logged in the "Developer Log" menu in the Admin section of the
CMS.

- For plugin errors, check with the plugin vendor for an updated version.
- For custom code errors, see the instructions and tips below.
- For additional questions, please contact support.



Developer Log: E_WARNING: constant(): Couldn't find constant START_TIME
----------------------------------------------------------------------------------
For support with older version of PHP we used to define a constant named
START_TIME with the unixtime that the script started.  Since PHP 5.4+ the PHP
variable $_SERVER['REQUEST_TIME_FLOAT'] provides the same information.
To fix replace START_TIME with $_SERVER['REQUEST_TIME_FLOAT']




Plugin Menus: This plugin is using a deprecated function (showHeader) and may not display or work correctly
Developer Log: E_USER_NOTICE: showHeader() is deprecated by new adminUI architecture
----------------------------------------------------------------------------------
Older plugins were hardcoded with the HTML to display for each page.  For version
3+ CMS admin pages are generated with the function adminUI().  The adminUI()
function takes a list of arguments and generates a complete page.

If you get this error, first check for an updated version of the plugin.

For reference code and examples of converting existing blocks of code see the
sample plugin in: plugins/samplePlugin.php



Developer Log: Plugin attempted to register the deprecated hook 'edit_buttonsRight'
Developer Log: Plugin attempted to register the deprecated hook 'list_buttonsRight'
Developer Log: Plugin attempted to register the deprecated hook 'view_buttonsRight'
----------------------------------------------------------------------------------
The old hook '*_buttonsRight' allowed developers to modify the HTML that was
displayed on the edit, list, or view menus.  This replaced with a new universal
hook 'adminUI_args' that is called all pages.  Because of this it requires you to
check the action to determine the type of page (edit, list, view, etc).  It also
takes arguments instead of HTML.

To update this issue, replace code such as this:
  addFilter('edit_buttonsRight', 'saveAsCopy_addButton', null, 3);
  // ... and the accompanying function

With this:

  addFilter('adminUI_args', 'saveAsCopy_addButton', null, 3);

  function saveAsCopy_addButton($adminUI_args, $tableName, $action) {
    // Available globals: $GLOBALS['RECORD'],
    if ($tableName != 'yourTable) { return $adminUI_args; } // only run for specified table
    if ($action == 'edit') { // eg: edit, list, view
      array_unshift($adminUI_args['BUTTONS'], [ // add button on left
        'label'   => t('Left Button'),
        'name'    => '_action=leftButton',
      ]);
    }
    return $adminUI_args;
  }


Or the same code as an inline function:

  addFilter('adminUI_args', function($adminUI_args, $tableName, $action) {
    // Available globals: $GLOBALS['RECORD'],
    if ($tableName != 'yourTable) { return $adminUI_args; } // only run for specified table
    if ($action == 'edit') { // eg: edit, list, view
      array_unshift($adminUI_args['BUTTONS'], [ // add button on left
        'label'   => t('Left Button'),
        'name'    => '_action=leftButton',
      ]);
    }
    return $adminUI_args;
  }, null, 3);



Adding buttons to "Related Records" fields.
----------------------------------------------------------------------------------
Related records fields now their own plugin hook that you can call as follows:

  addFilter('relatedRecords_buttons', 'customUltimate_relatedAddButtons');

  //
  function customUltimate_relatedAddButtons($buttonsArray, $tableName) {
    if ($tableName != 'orders2apps') { return $buttonsArray; } // only run for specified table

    // Button: Add Product
    $buttonsArray = []; // erase existing buttons, since we'll create our own
    $buttonsArray[] = relatedRecordsButton('Add Product', "?menu=orders2apps&action=add&accountNum=###&notes=" . urlencode("[Enter Reason] By [NAME]"));

    return $buttonsArray;
  }



Developer Log: Plugin attempted to register the deprecated hook 'header_links'
----------------------------------------------------------------------------------
The old hook 'header_links' allowed developers to modify the HTML of the My Account
links displayed on the menu.  To update replace this code:

  addFilter('header_links', 'modifyHeaderLinks');
  // ... and the accompanying function

With this (multiple examples):

  addFilter('menulinks_myAccount', 'modifyHeaderLinks');

  //
  function modifyHeaderLinks($menuArray) {

    // Example of custom menu:
    /*
    $newMenu[] = [
      'menuName'          => t('My Custom Menu'),
      'menuType'          => 'custom',
      'link'              => "?my_custom=link",
      'isSelected'        => ($menu === 'my_custom_menu'), // set to true to display this menu as selected on menu
      //'class'           => "",                           // optional: add this class to menu <li> tag
      //'linkTarget'      => 'target="_blank"',            // optional: set this to open link in a new tab
      //'br_after'        => true,                         // optional: add line break after menu item instead of separator ("|")
    ];
    */

    // remove license link
    foreach ($menuArray as $index => $menuAttr) {
      if (preg_match("/\b(menu=license)\b/", @$menuAttr['link'])) { unset($menuArray[$index]); }
    }

    // add links to the beginning
    $newMenu = [
      'menuName'          => t('New Menu'),
      'menuType'          => 'custom',
      'link'              => "?menu=new_menu",
      'isSelected'        => (@$_REQUEST['menu'] == 'new_menu'), // set to true to show this menu as selected
      'br_after'          => true,                         // optional: add line break after menu item instead of separator ("|")
    ];
    array_unshift($menuArray, $newMenu);

    // add links to the end
    $newMenu = [
      'menuName'          => 'Google',
      'menuType'          => 'custom',
      'link'              => "https://www.google.com/",
      'isSelected'        => false, // set to true to show this menu as selected
      'linkTarget'        => 'target="_blank"',            // optional: set this to open link in a new tab
    ];
    array_push($menuArray, $newMenu);

    return $menuArray;
  }


----------------------------------------------------------------------------------
end of file