Skip to content
Snippets Groups Projects
Commit 06cdfccd authored by Sebastian Paul's avatar Sebastian Paul
Browse files

add config option to set title

parent 4392fb97
Branches
Tags
No related merge requests found
name = Unity Webapp
description = "Ubuntu Unity Api Integration"
package = Administration
configure = admin/config/user-interface/unity-webapp
core = 7.x
scripts[] = unity_webapp.js
......@@ -38,9 +38,15 @@ function unity_webapp_page_alter(&$page) {
if ($faviconurl == $base_root . "/misc/favicon.ico") {
$faviconurl = $base_root . "/" .drupal_get_path("module","unity_webapp") . "/img/druplicon.ico";
}
if (variable_get("unity_webapp_title") && (variable_get("unity_webapp_title") != "")) {
$unity_title = variable_get("unity_webapp_title");
}
else {
$unity_title = variable_get('site_name');
}
$my_settings = array(
'pagetitle' => drupal_get_title(),
'sitename' => variable_get('site_name'),
'sitename' => $unity_title,
'links' => unity_webapp_generate_links_array(),
'favicon' => $faviconurl,
'baseurl' => $uri,
......@@ -61,3 +67,95 @@ function unity_webapp_permission() {
),
);
}
/**
* Implements hook_menu().
*/
function unity_webapp_menu() {
$items = array();
$items['admin/config/user-interface/unity-webapp'] = array(
'title' => 'Unity Webapp',
'type' => MENU_NORMAL_ITEM,
'page callback' => 'drupal_get_form',
'page arguments' => array('unity_webapp_form'),
'access callback' => 'user_access',
'access arguments' => array('administer site configuration'),
);
return $items;
}
/**
* Page callback for unity_webapp.
*/
function unity_webapp_form($form, $form_state) {
$form = array();
$form['unity_webapp_title'] = array(
'#required' => '0',
'#description' => "<p>" . t('Title to use for unity launcher. Defaults to global sitename if empty.') . "</p>" . "<p><strong>" . t("Unity Api supports only Alphanumeric Characters and whitespace") . "</strong></p>",
'#default_value' => variable_get("unity_webapp_title", ''),
'#weight' => '0',
'#type' => 'textfield',
'#title' => t('Title'),
);
return system_settings_form($form);
}
/**
* Implements hook_block_info().
*/
function unity_webapp_block_info() {
$blocks = array();
$blocks['unity_webapp'] = array(
'info' => 'Unity Webapp',
);
return $blocks;
}
/**
* Implements hook_block_view().
*/
function unity_webapp_block_view($delta) {
if ('unity_webapp' == $delta && user_access('administer site configuration')) {
return array(
'subject' => 'Unity Webapp',
'content' => drupal_get_form('unity_webapp_form'),
);
}
}
/**
* Implements hook_variable_info().
*/
function config_builder_variable_info($options) {
$variables = array();
$variables['title'] = array(
'name' => 'title',
'title' => 'Title',
'type' => 'string',
'default' => NULL,
'group' => 'unity_webapp',
'module' => 'unity_webapp',
);
return $variables;
}
/**
* Implements hook_variable_group_info().
*/
function unity_webapp_variable_group_info() {
$groups = array();
$groups['unity_webapp'] = array(
'title' => 'Unity Webapp',
'description' => 'Settings for Unity Web Api integration',
'path' => 'admin/config/user-interface/unity-webapp',
'access' => 'administer site configuration',
);
return $groups;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment