Which core modules use the fake block?

Which core modules use the fake block?

by Hartmut Scherer -
Number of replies: 14

So far I only know that the table of content in Book and the navigation block in Quiz use the fake block. In the theme checklist I read that the Lesson activity and the calendar UI also use the fake block. Beside these modules are there other modules in Moodle core which use the fake block? I am using the theme Shoehorn in Moodle 3.0.1.

With kind regards,

Hartmut

Average of ratings: -
In reply to Hartmut Scherer

Re: Which core modules use the fake block?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

yes I think there are others, but not so much Mods as the center block in  the 'mydashboard' is a fake block And only mimics a block region.

I fixed the Book TOC so that it used the default block region defined in the theme. There was talk at the time to fix Calendar, Lesson and Quiz. I can't remember now but I think I also fixed Lesson too, but it was a good two or more years ago.

What prompted you to ask?

Gareth should remember the changes I made to the Book module as we discussed it at the time. Tim Hunt gave us quite a bit of help too as I have a feeling he wrote the fake block code originally.

In reply to Mary Evans

Re: Which core modules use the fake block?

by Hartmut Scherer -

Hi Mary,

Thank you for your reply. It was more or less by accident that I found out about the fake block. I am talking about Shoehorn version 3.0.0.3, not the latest release. First I saw the table of content in Book on the right side instead of the left. One day or two days later I saw the navigation of Quiz on the right side. When I inspected the CSS, I saw the term fake block. As I stay away from the theme config, I only want to figure out what CSS is needed to change the location of the fake block in some modules or features of Moodle that we use. In the meantime I also changed the location of the menu in Lesson. 

With kind regards,

Hartmut


Added to Custom CSS

.path-mod-book .col-lg-10 {

    float: right;

    z-index: 10000;

}

#page-mod-quiz-attempt .col-lg-10 {

    float: right;

    z-index: 10000;

}

#page-mod-lesson-view .col-lg-10 {

    float: right;

    z-index: 10000;

}

In reply to Hartmut Scherer

Re: Which core modules use the fake block?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

It's not something you can fix with CSS as it is a 'block', and as such finds the default 'block-regon. So the place you need to look is moodle/theme/shoehorn/config.php where the default-region will be set to the side it is now. Which from what you are telling me it must be 'side-post'. So if you want it on the left you will need to change post to pre in the 'incourse' defaut-region in $THEME->layouts in the config.php.

That said however, the fact it is set to 'side'-post' by Gareth, suggest to me that it was done intentionally.

Does the page it is viewed in have blocks on the left? If not then is it a 2 column page? Inwhich case the right side is the correct location for it and so you will need to live with it.

In the mean time I will take a look at the  master branch on Gareth's GITHUB just to see what's what!

Cheers

Mary

In reply to Hartmut Scherer

Re: Which core modules use the fake block?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Hartmut,

I have just looked at the Shoehorn theme and have no idea what it happening there. You will have to wait until Gareth has found time to answer you, as he is very busy.

Sorry I cannot help.

Mary

In reply to Mary Evans

Re: Which core modules use the fake block?

by Hartmut Scherer -

Hi Mary,

Thanks for your replies. I like to dock blocks and have docked both, the navigation and administration block. In M2.9.1 it worked with Shoehorn. With the CSS mentioned above the fake block displays properly on the left side in Book, Quiz and Lesson in M3.0.1 and Shoehorn 3.0.0.4. As I may have overlooked other instances of the fake block, I wonder how many times the fake block is used in Moodle and how to find this out.

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Which core modules use the fake block?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

I need to find the tracker where the Book TOC fake block was fixed. Like I said the only other fake block I know of is the 'Course Overview' in My Dashboard. So not sure if there are any other fakes about other than the four you already mentioned.

In reply to Hartmut Scherer

Re: Which core modules use the fake block?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Hartmut,

Shoehorn uses a content, side-pre, side-post layout, if you want a side-pre, content, side-post layout then replace default.php with the attached.

Cheers,

Gareth

P.S. One day I may add in a layout setting for this.

In reply to Gareth J Barnard

Re: Which core modules use the fake block?

by Hartmut Scherer -

Hi Gareth,

Thank you for providing the default.php for a side-pre, content, side-post layout. It works and the fake block is on the left side.

Assuming that the default layout for Shoehorn has not been changed, something else may have caused the different location of the fake block in Moodle 3. 

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Which core modules use the fake block?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Try using Clean. Theme to see how that displays the fake block?

In reply to Hartmut Scherer

Re: Which core modules use the fake block?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Hartmut,

No as the default layout has changed in the supplied default.php file where it is side-pre, content, side-post instead of content, side-pre, side, post.

I'm not sure, but it still might be the case that some fake blocks position themselves via the first entry in the regions array for the layout and some use the default region value.

Cheers,

Gareth

In reply to Hartmut Scherer

Re: Which core modules use the fake block?

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Here is a list of blocks which appear to be pre-set to land in 'side-post' regardless.

Course Overview (default-region: = region-content)
Private Files (default-region = side-post)
Online Users (default-region = side-post)
Latest Badges (default-region = side-post)
Calendar Monthly View (3 months) (default-region = side-post)
Calendar Events Key (default-region = side-post)
Upcoming Events (default-region = side-post)
Recent Activity (default-region = side-post)
Search Forums (default-region = side-post)

I found all this out in a new install, when visiting different pages you find the blocks in odd places. So with Editing on you start to re-configure these block settings, the options in the drop-down list shows 'side-post' yet all the Lang files use 'Left' or 'Right'. So this suggests to me there is some CORE coding going on that will (as you have found) contradict with some themes.

For example set a new block region in a theme and make it span12, which only works well with HTML blocks that you can add HTML to which can transform into Marketing areas as described in the LOOK & LEARN tutorial.

So if you set that new block region to 'default-region' all these blocks get added to it. Which can be frustrating as I am finding in my new GoLogo theme which I am currently working on. Although I have managed to create quite a nice layout for the Events Key and the Monthly View.

gologo

Hope this helps?

Cheers

Mary

In reply to Mary Evans

Re: Which core modules use the fake block?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
In reply to Gareth J Barnard

Re: Which core modules use the fake block?

by Hartmut Scherer -

Hi Gareth,

Thank you for the clarification regarding the display of the fake block. If I understand you correctly, the change in lib/blocklib.php in Moodle 3.0 affected the display of the fake block in some themes. It's good to know what caused the changed display of the fake block. For those who upgrade from Moodle 2.9 to 3.0 using the same theme with the same layout, they would probably benefit to know about the changed display of the fake block in advance. 

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Which core modules use the fake block?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Hartmut,

Oh no, the code has not changed: https://github.com/moodle/moodle/blob/MOODLE_28_STABLE/lib/blocklib.php#L644-L663.  It just proves that Shoehorn is correct in its default region values in the config.php file.

That Shoehorn has a content-block-block layout which means that fake blocks are shown after the content rather than before it.  This has always been true until I added the 'landflayout' setting.  This allows either a content-block-block or block-content-block layout.

Kind regards,

Gareth