Skip to content

Custom page (plugin) integration

johnclause edited this page Oct 20, 2015 · 6 revisions

Integration Guide is published and maintained at qTranslate-X explained website.

User contributed notes:

Use i18n_admin_config hook and return array with your custom form data.

Example (form id my_form field id my_field):

add_filter('i18n_admin_config', 'any_name');
// it has to be declared as normal function
// class method declaration will cause strange bug in file uploader
function any_name($admin_config) {
  $admin_config[] = array(
    'forms' => array(
      'my_form' => array(
        'fields' => array(
          'my_field' => array()
        ),
      ),
    ),
  );
  return $admin_config;
}

There are also other possible keys in $admin_config array:

  $admin_config[] = array(
    'preg_delimiter' => '#', // i have no idea
    'pages' => array(
       // this is regex and page name has to match your custom page
      'page-name.php' => '^(?!.*page=[^=&]+).*$'
    ),
    'forms' => array(
      'my_form' => array(
        'fields' => array(
          'my_field' => array()
        ),
      ),
    ),
  );