Moodle

moved column width settings from the index.php/format.php files to theme/config.php - more flexible

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8
  • Fix Version/s: 1.8.2
  • Component/s: Blocks
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE

Description

Struggeling with overlapping text in some sideblocks and with different side column width.

One solution is to change the width range of the side columns in the theme config.

Changes in index.php and /topics/format.php:
// Bounds for block widths
// more flexible for theme designers taken from theme config.php
$lmin = (empty($THEME->block_l_min_width)) ? 160 : $THEME->block_l_min_width;
$lmax = (empty($THEME->block_l_max_width)) ? 210 : $THEME->block_l_max_width;
$rmin = (empty($THEME->block_r_min_width)) ? 160 : $THEME->block_r_min_width;
$rmax = (empty($THEME->block_r_max_width)) ? 210 : $THEME->block_r_max_width;

define('BLOCK_L_MIN_WIDTH', $lmin);
define('BLOCK_L_MAX_WIDTH', $lmax);
define('BLOCK_R_MIN_WIDTH', $rmin);
define('BLOCK_R_MAX_WIDTH', $rmax);

changes in theme/config.php:
$THEME->block_l_min_width = 100;
$THEME->block_l_max_width = 210;
$THEME->block_r_min_width = 100;
$THEME->block_r_max_width = 210;;

/// These values define the min and max width of the left and right
/// sieblocks in the course pages. If not set or false the standard
/// values are taken.

Martin, are there any reasons agains defining the sidecolumn width in the theme config.php?

Activity

Hide
Martin Dougiamas added a comment -

The main issue here is that blocks can all have different widths, and the column needs to adjust to fit the largest one (on the fly) because we don't know in advance which blocks teachers will use.

I faintly remember problems with blocks getting squished down when they shouldn't be.

Jon's solution was to allow all blocks to specify a minimum/maximum width, and the page class calculates the column widths from these.

That said, I can't see any problem with doing what you did to place a bit more control over the defaults in the theme config files.

Show
Martin Dougiamas added a comment - The main issue here is that blocks can all have different widths, and the column needs to adjust to fit the largest one (on the fly) because we don't know in advance which blocks teachers will use. I faintly remember problems with blocks getting squished down when they shouldn't be. Jon's solution was to allow all blocks to specify a minimum/maximum width, and the page class calculates the column widths from these. That said, I can't see any problem with doing what you did to place a bit more control over the defaults in the theme config files.
Hide
Urs Hunkler added a comment -

I added the neccessary code to all course formats, the index.php and admin/pagelib.php.

Show
Urs Hunkler added a comment - I added the neccessary code to all course formats, the index.php and admin/pagelib.php.
Hide
Urs Hunkler added a comment -

The code is in Moodle since version 1.8 and is working.

Show
Urs Hunkler added a comment - The code is in Moodle since version 1.8 and is working.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: