Guest User

settings.php

a guest
Oct 7th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. <?php
  2.     if ( $hassiteconfig ){
  3.  
  4.     // Create the new settings page
  5.     // - in a local plugin this is not defined as standard, so normal $settings->methods will throw an error as
  6.     // $settings will be NULL
  7.     $settings = new admin_settingpage( 'local_yourplugin', 'Your Settings Page Title' );
  8.  
  9.     // Create
  10.     $ADMIN->add( 'localplugins', $settings );
  11.  
  12.     // Add a setting field to the settings for this page
  13.     $settings->add( new admin_setting_configtext(
  14.  
  15.         // This is the reference you will use to your configuration
  16.         'local_yourplugin/apikey',
  17.  
  18.         // This is the friendly title for the config, which will be displayed
  19.         'External API: Key',
  20.  
  21.         // This is helper text for this config field
  22.         'This is the key used to access the External API',
  23.  
  24.         // This is the default value
  25.         'No Key Defined',
  26.  
  27.         // This is the type of Parameter this config is
  28.         PARAM_TEXT
  29.  
  30.     ) );
  31.  
  32. }
  33. ?>
Add Comment
Please, Sign In to add comment