From 95d5ffbdca46ab6f46c344edf64cf9885811eb9f Mon Sep 17 00:00:00 2001 From: Jakob Perry Date: Thu, 24 Sep 2015 00:13:03 +0200 Subject: [PATCH] Issue #2573661 --- drupalorg_project/drupalorg_project.module | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drupalorg_project/drupalorg_project.module b/drupalorg_project/drupalorg_project.module index 2f4a983..ff231c0 100644 --- a/drupalorg_project/drupalorg_project.module +++ b/drupalorg_project/drupalorg_project.module @@ -1046,6 +1046,10 @@ function drupalorg_project_block_info() { 'info' => t('Project links: Development'), 'cache' => DRUPAL_CACHE_PER_PAGE, ), + 'contrib-tracker' => array( + 'info' => t('Contrib Tracker: Project top message'), + 'cache' => DRUPAL_CACHE_PER_PAGE, + ), ); } @@ -1226,9 +1230,44 @@ function drupalorg_project_block_view($delta = '') { ); } break; + + case 'contrib-tracker': + if ($project = project_get_project_from_menu()) { + if ($message = variable_get('block_contrib_tracker', '')) { + if (isset($project->field_project_type[LANGUAGE_NONE][0]['value']) && $project->field_project_type[LANGUAGE_NONE][0]['value'] == 'full') { + return array( + 'content' => '
' . $message . '
', + ); + } + } + } + break; } } +function drupalorg_project_block_configure($delta = '') { + // This example comes from node.module. + $form = array(); + if ($delta == 'contrib-tracker') { + $form['contrib_text'] = array( + '#type' => 'textfield', + '#title' => t('Header text for project message'), + '#default_value' => variable_get('block_contrib_tracker', ''), + ); + } + return $form; +} + +function drupalorg_project_block_save($delta = '', $edit = array()) { + // We need to save settings from the configuration form. + // We need to check $delta to make sure we are saving the right block. + if ($delta == 'contrib-tracker') { + // Have Drupal save the string to the database. + variable_set('block_contrib_tracker', $edit['contrib_text']); + } +} + + /** * Output links with issue counts for different types of issues. */ -- 1.9.5 (Apple Git-50.3)