From 3bbbf454996db649a9e0b185445fe0a280396772 Mon Sep 17 00:00:00 2001 From: Nick Vercammen Date: Wed, 12 Feb 2014 13:40:15 +0100 Subject: [PATCH] setup setting variables upon install --- includes/media_mediahaven.variables.inc | 8 +------- media_mediahaven.install | 11 ++++++++++- media_mediahaven.module | 12 ++++++------ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/includes/media_mediahaven.variables.inc b/includes/media_mediahaven.variables.inc index 6a32215..0e7b21b 100644 --- a/includes/media_mediahaven.variables.inc +++ b/includes/media_mediahaven.variables.inc @@ -12,12 +12,9 @@ /** * This is the variable namespace, automatically prepended to module variables. */ -define('MEDIA_MEDIAHAVEN_NAMESPACE', 'media_mediahaven__'); +define('MEDIA_MEDIAHAVEN_NAMESPACE', 'media_mediahaven_'); define('MEDIA_MEDIAHAVEN_PAGER','25'); define('MEDIA_MEDIAHAVEN_RESTPOINT', '/mediahaven-rest-api/resources/'); -define('MEDIA_MEDIAHAVEN_RIGHTS_OWNER', 'Zeticon'); -define('MEDIA_MEDIAHAVEN_RIGHTS', 'Full rights on reproduction'); -define('MEDIA_MEDIAHAVEN_COPYRIGHT_NOTICE', 'Not for commercial use'); #define('MEDIA_MEDIAHAVEN_API_APPLICATION_URL', 'http://www.mediahaven.com/services/api/keys'); #define('MEDIA_MEDIAHAVEN_MAIN_URL', 'http://www.mediahaven.com/'); @@ -109,9 +106,6 @@ function media_mediahaven_variable_default($name = NULL) { if (!isset($defaults)) { $defaults = array( - 'url' => 'https://demo.debeeldbank.be', - 'login' => 'restapi', - 'password' => 'r3st@p1', ); } diff --git a/media_mediahaven.install b/media_mediahaven.install index 55e0929..32bd461 100644 --- a/media_mediahaven.install +++ b/media_mediahaven.install @@ -9,7 +9,16 @@ * Implements hook_install(). */ function media_mediahaven_install() { - return array(); + + media_mediahaven_variable_set('thumb_width', 150); + media_mediahaven_variable_set('thumb_height', 150); + media_mediahaven_variable_set('url', 'https://demo.debeeldbank.be'); + media_mediahaven_variable_set('login', 'restapi'); + media_mediahaven_variable_set('password', 'r3st@p1'); + media_mediahaven_variable_set('rights_owner', 'Zeticon'); + media_mediahaven_variable_set('rights', 'Full rights on reproduction'); + media_mediahaven_variable_set('copyright', 'Not for commercial use'); + return array('#finished' => 1); } /** diff --git a/media_mediahaven.module b/media_mediahaven.module index be6f5ad..a2b5cbb 100644 --- a/media_mediahaven.module +++ b/media_mediahaven.module @@ -278,7 +278,7 @@ function media_mediahaven_form($form, &$form_state) { array( '#type' => 'textfield', '#title' => t('Rights owner'), - '#default_value' => media_mediahaven_variable_get('rights_owner',MEDIA_MEDIAHAVEN_RIGHTS_OWNER), + '#default_value' => media_mediahaven_variable_get('rights_owner'), '#size' => 50, '#description' => t('The rights owner for media uploaded to Mediahaven.'), '#required' => TRUE, @@ -287,7 +287,7 @@ function media_mediahaven_form($form, &$form_state) { array( '#type' => 'textfield', '#title' => t('Rights'), - '#default_value' => media_mediahaven_variable_get('rights',MEDIA_MEDIAHAVEN_RIGHTS), + '#default_value' => media_mediahaven_variable_get('rights'), '#size' => 50, '#description' => t('The rights for using and ditributing the uploaded media.'), '#required' => TRUE, @@ -296,7 +296,7 @@ function media_mediahaven_form($form, &$form_state) { array( '#type' => 'textfield', '#title' => t('Copyright Notice'), - '#default_value' => media_mediahaven_variable_get('copyright',MEDIA_MEDIAHAVEN_COPYRIGHT_NOTICE), + '#default_value' => media_mediahaven_variable_get('copyright'), '#size' => 50, '#description' => t('Copyright notice for media uploaded to Mediahaven.'), '#required' => TRUE, @@ -314,7 +314,7 @@ function media_mediahaven_form($form, &$form_state) { array( '#type' => 'textfield', '#title' => t('Thumb_width'), - '#default_value' => media_mediahaven_variable_get('thumb_width',150), + '#default_value' => media_mediahaven_variable_get('thumb_width'), '#size' => 5, '#description' => t('Width of the thumbnails (in px)'), '#required' => TRUE, @@ -323,7 +323,7 @@ function media_mediahaven_form($form, &$form_state) { array( '#type' => 'textfield', '#title' => t('Thumb_height'), - '#default_value' => media_mediahaven_variable_get('thumb_height',150), + '#default_value' => media_mediahaven_variable_get('thumb_height'), '#size' => 5, '#description' => t('Height of the thumbnails (in px)'), '#required' => TRUE, @@ -397,7 +397,7 @@ function media_mediahaven_media_browser_plugin_info() { 'title' => t('MediaHaven'), 'class' => 'MediaMediaHavenBrowser', ); - + return $info; }