<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Samhemelryk</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Samhemelryk"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/Special:Contributions/Samhemelryk"/>
	<updated>2026-04-25T14:12:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Render_library_specification&amp;diff=47203</id>
		<title>Render library specification</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Render_library_specification&amp;diff=47203"/>
		<updated>2015-01-16T02:37:16Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45770&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
== Project Goals ==&lt;br /&gt;
* Add an element library to Moodle (A page in Moodle listing all of the renderables and how they look in the current theme)&lt;br /&gt;
* Add a complete set of core renderables that should be capable of completely rendering every new user interface&lt;br /&gt;
* Update the Output API documentation&lt;br /&gt;
* Create a output guide documentation including best practices.&lt;br /&gt;
&lt;br /&gt;
== Benefits ==&lt;br /&gt;
* Make it easier to create user interfaces.&lt;br /&gt;
* Make it easier to style the user interface.&lt;br /&gt;
* Make it easier for themers to customise the user interface.&lt;br /&gt;
* Better facilitate frontend frameworks in Themes.&lt;br /&gt;
* Better facilitate usable and accessible design.&lt;br /&gt;
* Give Moodle a more consistent look and feel.&lt;br /&gt;
* Improve site performance by reducing the CSS footprint.&lt;br /&gt;
&lt;br /&gt;
==Understanding renderers in Moodle==&lt;br /&gt;
&lt;br /&gt;
Renderers have been around since Moodle 2.0 and are now the requirement when writing any code that produces output.&lt;br /&gt;
Renderers come in many shapes and forms depending upon the developers take on how output should be produced.&lt;br /&gt;
&lt;br /&gt;
When renderables were introduced - the API was designed to make it easy for existing code to be updated to make use of renderers and renderables. A renderable is an interface with no methods, so any existing class could be made to implement renderable. This means that the renderable class can be a mixture of data and methods that perform logic associated with the module. This also means that the renderer can call those methods on the renderable class - effectively using the API of the module. The problem with this - is that it complicates the renderer and makes it harder to override in a theme - the themer requires knowledge about the API for the module. Some renderables in core are built as separate classes - only used for the purpose of supplying data to the renderer - here there is a clear separation of the logic - and the properties of the renderable are made up of only simple types that can be checked for in the renderer - e.g. access checks are done in advance and the result is put into a boolean in the renderable. The current renderers / renderables in Moodle are a mixture of these styles.&lt;br /&gt;
&lt;br /&gt;
Because there is no mandated organisation, nor has there ever been, there is immense variation in what constitutes content to a renderer. &lt;br /&gt;
&lt;br /&gt;
One of the upsides to our current render system is that you are not limited to having a single renderer for a component, you can make use of language capabilities and the output framework and create layers of renderers to cut back code duplication and to aid in preparing a base for consistent structuring and output.&lt;br /&gt;
&lt;br /&gt;
Into the equation we add targets and subtypes. Targets allow us to create both standard renderers and renderers specific to the needs of the output method. Standard being HTML, without output methods including CLI, AJAX, HTML email and plain text email.&lt;br /&gt;
&lt;br /&gt;
People have never being constrained as to how they implement a renderer. We&#039;ve being happy enough to simply guide them towards using renderers because of the benefits they provide and while there are numerous benefits there are two fundamental benefits:&lt;br /&gt;
&lt;br /&gt;
; A change in thinking : It requires developers to think about their code organisation. Renderers were introduced in a time before Object Orientation was used in Moodle, and logic and output were tightly intermingled in most code. Renderers were about separating logic and design and while what was created was not always perfect it was always an improvement.&lt;br /&gt;
&lt;br /&gt;
; An extensible approach to output : The render system allows for the overriding of renderers to occur. Theme designers can overwrite any renderer in their theme. The more that renderers that get implement the more of Moodle you can customise.&lt;br /&gt;
&lt;br /&gt;
==Understanding themes==&lt;br /&gt;
&lt;br /&gt;
Themes are without a doubt the most widely customised plugin provided by Moodle. But we are currently struggling with several problems with renderers and themes as they are being implemented currently.&lt;br /&gt;
&lt;br /&gt;
1. There is no strict relationship between the HTML generated by a renderable, and the accompanying CSS that is required to make it display properly. The HTML is coded in the renderer - and then the CSS is added, either directly to the styles.css for the plugin in an unorganised way - or directly in the CSS in the theme - again in a loosely organised way. There is no systematic way to determine if any line of CSS is still in use - and there is no simple way to find the CSS that requires updating when the HTML is updated. &lt;br /&gt;
&lt;br /&gt;
2. The CSS framework (bootstrap 2, bootstrap 3, zurb, pureio) specific attributes for renderables are currently being hardcoded in the HTML generated by the renderables. This prevents themers from using a different framework without creating an impossible amount of work to overwrite every renderer in Moodle.&lt;br /&gt;
&lt;br /&gt;
==So what is the problem==&lt;br /&gt;
&lt;br /&gt;
There are several. Lets be blunt about this. This specification is not a single task. It is about improving the state of output in Moodle and there are going to be several steps in achieving this. On a positive note these steps can in many cases be broken down into granular tasks that can be worked on asynchronously.&lt;br /&gt;
First lets understand some of the major problems:&lt;br /&gt;
* We have no established best practices, nor even documentation on what constitutes a good renderer, or considerations that should be paid mind in planning and designing of code.&lt;br /&gt;
* We have no established style guide, nor pattern library, nor element library, nor anything that could be referenced when someone starts building a new user interface - or creating a new theme.&lt;br /&gt;
* Inconsistency - because of a lack of best practice documentation and examples, there is huge variation in the design of our different modules. Different modules exhibit different problems such as a mixing of logic and output and code duplication.&lt;br /&gt;
* Developers are encouraged to push functionality boundaries in order to take it places observed in other projects or to challenge oneself. While consistency is often talked about it is rarely observed when designing output. We end up with numerous &amp;quot;similar&amp;quot; looking widgets all functioning slightly differently and consequently there is a feeling that this is the way to achieve a new fresh look. (E.g. we have multiple implementations of a &amp;quot;toolbar&amp;quot; - one in Atto and one in EditPDF).&lt;br /&gt;
* Existing renderer implementations vary widely and in many cases contain logic they should not. Access checks, database queries, object manipulations. All of which should not be present as it introduces muddling of concepts and logic that must be duplicated and then maintained for anyone overriding renderers.&lt;br /&gt;
* Themers have a mammoth task at present in applying a consistent style to Moodle, or in choosing to implement a new frontend framework (bootstrap, foundation, pureio etc). Our lack of organisation in the output leaves a lot to be desired. Having the theme responsible for choosing a frontend framework is the right way to handle this, however backend Moodle doesn&#039;t support themeing as well as it should be/could be.&lt;br /&gt;
* On top of the above it introduces a need to override several renderers should you want to create a consistent style and because of inconsistent renderer implementations this can easily lead to a maintenance nightmare. E.g. the user_picture renderable is not used in mod_forum - so there is no way to override it there.&lt;br /&gt;
* JavaScript introduces problems of its own. We are doing more and more with JavaScript these days. However there is a heavy dependence on the output that gets produced and the JavaScript enhancing it. In a lot of cases the relationship is ill defined and due to the complexity and structure of the JavaScript overriding the output structure of the rendered component is completely impossible for all but the most experienced developers.&lt;br /&gt;
* Inline with the above we lack good examples and documentation on how to deliver output templates for JavaScript User Interfaces as well as the creation, and manipulation of HTML structures that are enhanced by JavaScript.&lt;br /&gt;
&lt;br /&gt;
== Identified issues==&lt;br /&gt;
There is a general trend in the problems noted, when looking at output we lack organisation, documentation, and consistency across the board. However the actual issues we are focusing on in this spec can be identified as below:&lt;br /&gt;
&lt;br /&gt;
* Lack of a style guide / element library / pattern library.&lt;br /&gt;
** Leading to inconsistent output and style.&lt;br /&gt;
** Increased workload due to usability and accessibility thinking and testing needing to occur repetitively.&lt;br /&gt;
** Increased workload due to multilang (rtl) support usually coming after the designs of new output.&lt;br /&gt;
* Inconsistent renderer implementations.&lt;br /&gt;
** Lack of best practices.&lt;br /&gt;
** Lacking plus outdated documentation.&lt;br /&gt;
** Logic-full renderers greatly hinder theming.&lt;br /&gt;
** An unnecessarily increased requirement to understand both PHP and Moodle code as each renderer differs and are usually poorly documented.&lt;br /&gt;
* No abstraction from CSS framework.&lt;br /&gt;
** Without organised structure classes are applied in a chaotic fashion leading to the requirement to duplicate core styles.&lt;br /&gt;
** As there is no core styles newly created output widgets need to be styled in all base themes leaving chance of design regressions occurring in predominantly major upgrades but occasionally minor releases as well.&lt;br /&gt;
** Inconsistent output structure ensures CSS quickly balloons as styles need to be both created and copied to several areas.&lt;br /&gt;
* Poor linking between UI components and the JavaScript.&lt;br /&gt;
** Ill-defined link between output and the JavaScript enhancing it.&lt;br /&gt;
** No common technique to template UIs generated by javascript&lt;br /&gt;
&lt;br /&gt;
==Manageable Tasks==&lt;br /&gt;
The following are the major tasks we have identified so far. These tasks can be though of as Epic&#039;s, or tasks for which we will create subtasks (if this output specification itself becomes an Epic).&lt;br /&gt;
Within this section will include notes and implementation ideas on the major tasks we&#039;ve identified.&lt;br /&gt;
&lt;br /&gt;
* [[#Define the elements that make up Moodle|Choose an output methodology and begin defining core elements]]&lt;br /&gt;
* [[#Element library and style guide|Create an element library and accompanying style guide]]&lt;br /&gt;
* [[#Style guide|Create a style guide document]]&lt;br /&gt;
* [[#Define and document renderer best practices|Define and document renderer best practices]]&lt;br /&gt;
* [[#Define and update the JS documentation|Update the JavaScript documentation]]&lt;br /&gt;
* [[#Update renderer documentation|Update renderer documentation]]&lt;br /&gt;
* [[#Update theme documentation and theme tutorials|Update theme documentation and theme tutorials]]&lt;br /&gt;
* [[#Progressively convert renderers|Progressively convert renderers]]&lt;br /&gt;
&lt;br /&gt;
===Define the elements that make up Moodle===&lt;br /&gt;
There are several tasks that will go into this, but the first and most important will be deciding upon an organisational methodology. Some way to compartmentalise the Moodle output.&lt;br /&gt;
At present a reducing granularity system is looking the most appealing. Go and read [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic Design] written by Brad Frost - it describes very well the type of compartmentalisation we are proposing.&lt;br /&gt;
&lt;br /&gt;
Once a system has being chosen the following tasks can be tackled:&lt;br /&gt;
* Identify the layers we require.&lt;br /&gt;
* Define the boundaries and responsibilities of those layers.&lt;br /&gt;
* Identify the initial set of elements, likely the finest granularity first as I imagine starting at the bottom and working up will be the best way to proceed.&lt;br /&gt;
&lt;br /&gt;
Further elements (those relating to Moodle will be defined as part of the element library work).&lt;br /&gt;
&lt;br /&gt;
===Element library and style guide===&lt;br /&gt;
Draft docs for element library tool: [[Element_Library]]&lt;br /&gt;
&lt;br /&gt;
Add an admin tool that can show a categorised list of renderable objects for each plugin/and core - filled with test data. The goal of this tool is to:&lt;br /&gt;
&lt;br /&gt;
* Provide a page for themers to check that their new theme correctly displays all the renderables&lt;br /&gt;
* Provide a page for developers to see all the reusable renderables (in a well defined structure) they can use when building their own pages&lt;br /&gt;
&lt;br /&gt;
The tasks here will be:&lt;br /&gt;
* Spec the element library tool with regard to our chosen element methodology.&lt;br /&gt;
* Create the element library tool.&lt;br /&gt;
* Establish a definition method of elements, and compositions of elements as renderables.&lt;br /&gt;
* Define the core elements from the task above in code somehow and verify the element library tool reveals them.&lt;br /&gt;
* Finally define a comprehensive list of low level widgets we can add to core as renderables. This is a library of components that should be used by other renderers (by compositing them). E.g. list, table, warning, grid. These renderables should be structured into layers, starting from renderables that cannot be broken into smaller parts, up to widgets made of smaller renderables, up to layouts (and possibly up to entire pages).  Sources for this list should come from:&lt;br /&gt;
** Existing CSS Frameworks (bootstrap, pureio) (but must be framework agnostic)&lt;br /&gt;
** Existing renderables in Moodle that we see as “perfect” already (maybe there are some)&lt;br /&gt;
** Existing patterns in Moodle that we do over and over but don’t have a renderable for yet&lt;br /&gt;
&lt;br /&gt;
On top of this there is functionality that would be great to add to it:&lt;br /&gt;
&lt;br /&gt;
* Validate that the renderer/renderable follows best practice (no DB queries, complex types, complex logic)&lt;br /&gt;
* Provide responsive testing immediately within the tool. Adjusting the viewing area on queue to allow both developers and designers to experience how the individual renderables respond in varying presentation medias.&lt;br /&gt;
* Provide language direction testing immediately within the tool. Like the above allow designers and developers to quickly experience a renderable in a different language directions.&lt;br /&gt;
* Renderable linear reporting. So that you can see which other renderables make use of this renderable and which renderables get used by this renderable. This will be hugely helpful in judging impact when themeing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Thoughts on naming===&lt;br /&gt;
&lt;br /&gt;
We will need to define useful names for the different categories of renderables so that we can effectively organise them and provide guidelines for writing each type - the names are a small part of this solution but will possibly be a point for contention. Different frameworks have different names for these things and people will prefer something that sounds like something they are already using.&lt;br /&gt;
&lt;br /&gt;
(draft!) Categories for renderables - taken straight from Atomic design&lt;br /&gt;
&lt;br /&gt;
http://bradfrostweb.com/blog/post/atomic-web-design/&lt;br /&gt;
&lt;br /&gt;
* Atoms == Tiny reusable elements that cannot be broken down into smaller elements&lt;br /&gt;
* Molecules == Relatively simple combinations of atoms built for reuse&lt;br /&gt;
* Organisms == Organisms are groups of molecules joined together to form a relatively complex, distinct section of an interface.&lt;br /&gt;
* Templates == Layout files in a theme&lt;br /&gt;
* Pages == The actual pages in Moodle&lt;br /&gt;
&lt;br /&gt;
Refs for categorizing patterns&lt;br /&gt;
* http://bradfrostweb.com/blog/post/atomic-web-design/&lt;br /&gt;
* http://oocss.org/&lt;br /&gt;
* http://alistapart.com/blog/post/getting-started-with-pattern-libraries&lt;br /&gt;
* http://style.codeforamerica.org/&lt;br /&gt;
&lt;br /&gt;
===Style guide===&lt;br /&gt;
This has two real advantages.&lt;br /&gt;
&lt;br /&gt;
# First assuming this will be developed initially while defining the elements that will make up Moodle output and will aid us in verifying what we are doing. If it can be easily documented then we are on the right track. If we start encountering to many conditions and or too much variation then we are drifting off track.&lt;br /&gt;
# When defining new elements we are able to use our style guide to do so and it&#039;ll provide us measure of how Moodle output evolves.&lt;br /&gt;
&lt;br /&gt;
===Define and document renderer best practices===&lt;br /&gt;
&lt;br /&gt;
This will be tricky and no doubt how we decide to define a best practice will have to have regard for the output methodology we choose.&lt;br /&gt;
&lt;br /&gt;
===Update the JavaScript documentation===&lt;br /&gt;
&lt;br /&gt;
Discuss and agree on a best practice for writing JS that depends on HTML structures in the DOM (e.g. progressive enhancement - or just ids for action listeners) (perhaps a specific renderable for a JS region)&lt;br /&gt;
&lt;br /&gt;
===Update renderer documentation===&lt;br /&gt;
This will of course need to be done after the element library and renderer best practices but should be pretty simple at that point.&lt;br /&gt;
* Read and rate each of the existing docs pages (see related links below)&lt;br /&gt;
* Write new complete docs for everyone (at [[Output API]])&lt;br /&gt;
* Cross link old docs to the new ones&lt;br /&gt;
&lt;br /&gt;
===Update theme documentation and theme tutorials===&lt;br /&gt;
There are likely the most well documented plugin type within Moodle. There are good specification docs, good 2.0 conversion docs and good tutorials on many aspects of theming.&lt;br /&gt;
Many of these pages will need to be updated to reflect best practices and such after we start ticking off some of the other tasks.&lt;br /&gt;
&lt;br /&gt;
===Progressively convert renderers===&lt;br /&gt;
This is the very last task really - but we will start work on it in parallel with creating the new set of core renderables (to prove the design is usable). There is no deadline for this to be complete - and it will take a long time to convert all the existing renderers (and code not using renderers).&lt;br /&gt;
&lt;br /&gt;
== Notes on renderers / renderables ==&lt;br /&gt;
Proposed improvements to the docs on renderers / renderables.&lt;br /&gt;
First - the docs need an overhaul to more clearly explain how renderers / renderables work for core devs, plugin devs and themers. There needs to be clearer guidelines for the things that can be done in a renderable, and in a renderer.&lt;br /&gt;
&lt;br /&gt;
Goals for renderers - should be devoid of logic for these reasons:&lt;br /&gt;
* Theme overridden renderers do not need to be updated when logic is changed&lt;br /&gt;
* Themers can override renderers without understanding all the logic&lt;br /&gt;
* Renderables can be filled with mock data for display in the element library&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;good renderer&amp;quot; is:&lt;br /&gt;
* Receives some “data” through a renderable&lt;br /&gt;
* Produces some “output”&lt;br /&gt;
* Where “output” is some HTML and any javascript init calls&lt;br /&gt;
* Can use basic PHP functions/loops, like for(), foreach(), count()&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;good renderer&amp;quot; is not:&lt;br /&gt;
* nasty php logic (or even non-nasty php logic)&lt;br /&gt;
* access checks&lt;br /&gt;
* non-trivial function calls&lt;br /&gt;
* using any Moodle functions not related to output&lt;br /&gt;
* calling the database&lt;br /&gt;
&lt;br /&gt;
A “renderable” is:&lt;br /&gt;
* All the data required to generate the output.&lt;br /&gt;
* Properties should be simple data types only, or renderables, or array of those&lt;br /&gt;
&lt;br /&gt;
== Evaluations of some existing renderers / renderables ==&lt;br /&gt;
Existing renderer styles - because there are few rules/guidelines for how renderers should be written - there are differing examples of renderers in core. Looking at the 3 of the better maintained modules to see how they are implemented will be useful in evaluating the benefits of any stricter rules for renderers.&lt;br /&gt;
=== Assign ===&lt;br /&gt;
Contains a list of renderables (in renderables.php) and a single renderer. The logic is mostly out of the renderer methods (pre-calculated and added as data to the renderer). There are some cases when renderables could be broken down further - e.g. the expand/collapse on the submission history (mod/assign/yui/src/history/js/history.js). Also the assignment sub-plugins do not use renderers (and they should).&lt;br /&gt;
&lt;br /&gt;
=== Quiz ===&lt;br /&gt;
Uses a lot of renderers - but not renderables. The renderer methods directly call methods of the business logic to determine what to display. e.g. &amp;quot;attemptobj-&amp;gt;get_access_manager(time())-&amp;gt;attempt_must_be_in_popup()&amp;quot;. This is not terrible for a themer trying to override a renderer method because the calls are mostly simple - but it is a grey area for when this becomes business logic in the renderer (and would e.g. need updating to fix bugs etc). If we want to add these renderer methods to the element library - it would require a way to pass mock business logic classes to the renderer methods (and a way for the generator to return a renderer and a method - instead of only a renderable).&lt;br /&gt;
&lt;br /&gt;
=== Workshop ===&lt;br /&gt;
Very nice renderers and renderables in workshop. Would only need updating to re-use core renderables instead of using html_writer directly - and adding the existing renderables to the element library.&lt;br /&gt;
&lt;br /&gt;
=== Badges ===&lt;br /&gt;
Mix of renderer methods and renderables. This is similar to quiz where the renderer is calling lots of methods of the business model in the renderer methods and has the same effect (harder to override, maintain etc). To add these renderer methods to the element library would require the same sort of changes as mentioned in quiz.&lt;br /&gt;
&lt;br /&gt;
== Example of forum post renderer using composition ==&lt;br /&gt;
This is not a real example (yet), it&#039;s just a demonstration of the type of renderers we should be aiming for (using composition etc). This structure would be created in the render_form_post method of the forum renderer. This method would receive a forum_post renderable containing only data - and build up this structure of smaller renderable components, then return the result of calling render(x) on each of the smaller renderables. &lt;br /&gt;
&lt;br /&gt;
[[Image:forumpost-renderer-breakdown.png|center|500px|Example forum renderer]]&lt;br /&gt;
&lt;br /&gt;
== Initial thoughts on renderables and what we should provide (Draft) ==&lt;br /&gt;
This list is not intended to be the final list - it is more of a scoping exercise. One of the tasks from this project is to decide on the full set of required renderables. &lt;br /&gt;
There are several renderables within Moodle that have being included in this table and we will need to look closely at how they fit within our chosen model and whether they are still required.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name&lt;br /&gt;
! Description&lt;br /&gt;
! Source (links)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu&lt;br /&gt;
| UI component for a drop down edit menu&lt;br /&gt;
| Existing renderable (should be renamed &amp;quot;menu&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link&lt;br /&gt;
| UI component for a menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_filler&lt;br /&gt;
| UI component for a filler menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_primary&lt;br /&gt;
| UI component for a primary menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_secondary&lt;br /&gt;
| UI component for a secondary menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_link&lt;br /&gt;
| Link with alt text, and an icon&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| single_button&lt;br /&gt;
| A form with a single button&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| confirm&lt;br /&gt;
| A form with a message and cancel/confirm buttons&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| single_select&lt;br /&gt;
| A form with a single drop down list that submits on change&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| url_select&lt;br /&gt;
| A navigation element consisting of a single drop down list of urls that navigates on change&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| doc_link&lt;br /&gt;
| A link to the Moodle docs&lt;br /&gt;
| Existing renderer method&lt;br /&gt;
|-&lt;br /&gt;
| pix_icon&lt;br /&gt;
| A small icon&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| emoticon_icon&lt;br /&gt;
| A small emoticon&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| heading_with_help&lt;br /&gt;
| A page heading with a link to help docs&lt;br /&gt;
| Existing renderer method&lt;br /&gt;
|-&lt;br /&gt;
| help_icon&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| help_icon_scale&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| user_picture&lt;br /&gt;
| A user profile picture which links to their profile&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| container&lt;br /&gt;
| A block level element used to surround something. Can have a class to allow specific targeting with CSS.&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| error_text&lt;br /&gt;
| An error to show to the user.&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| notification&lt;br /&gt;
| A message for the user&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| continue_button&lt;br /&gt;
| A message and a button to continue to the next page&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| paging_bar&lt;br /&gt;
| A list of next previous and specific page links&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| skip_link_to&lt;br /&gt;
| A link to a section on the page&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| skip_link_target&lt;br /&gt;
| A target for a matching skip_link_to call&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| heading&lt;br /&gt;
| A page heading&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| box&lt;br /&gt;
| A page section with a border&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| rarrow&lt;br /&gt;
| A right arrow&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| larrow&lt;br /&gt;
| A left arrow&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| tabtree&lt;br /&gt;
| A list of tabs&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| tabobject&lt;br /&gt;
| A single tab panel&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| toolbar *new&lt;br /&gt;
| A container for toolbar button groups&lt;br /&gt;
| Bootstrap equiv btn-toolbar (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| toolbar-group *new&lt;br /&gt;
| A group of toolbar buttons&lt;br /&gt;
| Bootstrap equiv btn-group (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| toolbar-button *new&lt;br /&gt;
| A toolbar button&lt;br /&gt;
| Bootstrap equiv btn (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| toolbar-menu *new&lt;br /&gt;
| A toolbar button that opens a drop down menu&lt;br /&gt;
| Bootstrap equiv nested btn-groups (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| navbar *new&lt;br /&gt;
| The navigation bar that shows at the top of the page&lt;br /&gt;
| Bootstrap equiv navbar - There is an existing renderer method that needs converting into renderables&lt;br /&gt;
|-&lt;br /&gt;
| navbar_item *new&lt;br /&gt;
| Items in the navigation bar that shows at the top of the page&lt;br /&gt;
| Bootstrap equiv list item in a navbar - There is an existing renderer method that needs converting into renderables&lt;br /&gt;
|-&lt;br /&gt;
| navbar_item *new&lt;br /&gt;
| Items in the navigation bar that shows at the top of the page&lt;br /&gt;
| Bootstrap equiv list item in a navbar - There is an existing renderer method that needs converting into renderables&lt;br /&gt;
|-&lt;br /&gt;
| progress_bar *new&lt;br /&gt;
| A bar showing progress of something&lt;br /&gt;
| Bootstrap equiv progress_bar - There is an existing moodle class that needs converting to use renderables&lt;br /&gt;
|-&lt;br /&gt;
| progress_bar *new&lt;br /&gt;
| A bar showing progress of something&lt;br /&gt;
| Bootstrap equiv progress_bar - There is an existing moodle class that needs converting to use renderables&lt;br /&gt;
|-&lt;br /&gt;
| panel *new&lt;br /&gt;
| A container with a heading and borders&lt;br /&gt;
| Bootstrap equiv panel, panel-heading, panel-body, panel-footer&lt;br /&gt;
|-&lt;br /&gt;
| vertical-list *new&lt;br /&gt;
| A vertical list of items&lt;br /&gt;
| Bootstrap equiv - list-group&lt;br /&gt;
|-&lt;br /&gt;
| horizontal-list *new&lt;br /&gt;
| A horizontal list of items&lt;br /&gt;
| Bootstrap equiv - list-inline&lt;br /&gt;
|-&lt;br /&gt;
| Two column list *new&lt;br /&gt;
| Short cut for a list of pairs with the left column fixed-width and right aligned&lt;br /&gt;
| Similar to our current moodle forms&lt;br /&gt;
|-&lt;br /&gt;
| table (and cells headings etc) * new&lt;br /&gt;
| We need to convert tablelib to use renderers to output all table elements&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| forms (and labels, inputs etc) * new&lt;br /&gt;
| We need to convert formslib to use renderers to output all form elements&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| grids *new&lt;br /&gt;
| We need to support renderables for a simple responsive grid system&lt;br /&gt;
| Everything has grids...&lt;br /&gt;
|-&lt;br /&gt;
| floats *new&lt;br /&gt;
| We need to support floating elements left and right&lt;br /&gt;
| Bootstrap - pull-left, pull-right&lt;br /&gt;
|-&lt;br /&gt;
| clearfix *new&lt;br /&gt;
| If we have this simple thing as a renderable we can avoid repeating the CSS&lt;br /&gt;
| Bootstrap - clearfix&lt;br /&gt;
|-&lt;br /&gt;
| expandable *new&lt;br /&gt;
| Initially shows only a summary with an expand button to show more details&lt;br /&gt;
| mod_assign&lt;br /&gt;
|-&lt;br /&gt;
| dialog *new&lt;br /&gt;
| Tie into M.core.dialogue so it can be adjusted in a renderer&lt;br /&gt;
| aria&lt;br /&gt;
|-&lt;br /&gt;
| timer *new&lt;br /&gt;
| There is an aria role for this - so we should make sure it is used correctly if required.&lt;br /&gt;
| aria&lt;br /&gt;
|-&lt;br /&gt;
| tree *new&lt;br /&gt;
| Reusable version of the nav tree&lt;br /&gt;
| aria tree, tree-item, tree-grid etc&lt;br /&gt;
|-&lt;br /&gt;
| indent *new&lt;br /&gt;
| (eg threaded forum post)&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| media block *new&lt;br /&gt;
| large media element side by side with some text&lt;br /&gt;
| http://demo.patternlab.io/&lt;br /&gt;
|-&lt;br /&gt;
| hero *new&lt;br /&gt;
| content section with borders/oversized text etc designed to be a landing point&lt;br /&gt;
| Bootstrap jumbotron&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Prototyping ==&lt;br /&gt;
We built a lot of prototypes here - trying to find the perfect solution - but even the most elegant PHP class design still means that the renderer is hard to build and understand. &lt;br /&gt;
&lt;br /&gt;
List of corpses :)&lt;br /&gt;
    https://github.com/samhemelryk/moodle/tree/output_prototype&lt;br /&gt;
    https://github.com/samhemelryk/moodle/tree/output_prototype2&lt;br /&gt;
    https://github.com/samhemelryk/moodle/tree/output_prototype3&lt;br /&gt;
    https://github.com/samhemelryk/moodle/tree/output_prototype5&lt;br /&gt;
    https://github.com/samhemelryk/moodle/tree/output_prototype2&lt;br /&gt;
    https://github.com/damyon/moodle/tree/MENU_RENDERABLE&lt;br /&gt;
&lt;br /&gt;
We also tried to explain the importance of separating logic from renderer methods - but there were gray areas when people asked about simple capability checks, calling helper methods etc. &lt;br /&gt;
&lt;br /&gt;
The new proposal is to add support for mustache templates to renderers and build support so they can be used from Javascript or PHP. &lt;br /&gt;
&lt;br /&gt;
== Mustache ==&lt;br /&gt;
&lt;br /&gt;
What is Mustache and why does this hipster want to climb in my renderables ?&lt;br /&gt;
&lt;br /&gt;
Mustache is a templating library designed to use &amp;quot;Logic-less templates&amp;quot;. It is very popular with Javascript developers. &lt;br /&gt;
&lt;br /&gt;
http://mustache.github.io/&lt;br /&gt;
&lt;br /&gt;
Side note: Handlebars is an alternative to mustache that builds on the mustache syntax with more features, but unfortunately the php implementation of handlebars is unreliable and does not conform to the specification (I tested). Handlebars also allows more logic to leak into the templates (function calls with params etc) and I found it led to more mess.&lt;br /&gt;
&lt;br /&gt;
Question: How does it work in Moodle?&lt;br /&gt;
&lt;br /&gt;
Answer: Really well! Say I have a renderable called &amp;quot;foobar&amp;quot;. Instead of defining a function in my renderer named render_foobar($foobar), I just create a file in the templates folder for my plugin named foobar.mustache. A mustache template contains real HTML and mustache tags and nothing else. My new template will be rendered using the renderable as the context.&lt;br /&gt;
&lt;br /&gt;
=== Mustache Examples ===&lt;br /&gt;
&lt;br /&gt;
Old renderer method:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
 public function render_assign_grading_summary(assign_grading_summary $summary) {&lt;br /&gt;
        // Create a table for the data.&lt;br /&gt;
        $o = &#039;&#039;;&lt;br /&gt;
        $o .= $this-&amp;gt;output-&amp;gt;container_start(&#039;gradingsummary&#039;);&lt;br /&gt;
        $o .= $this-&amp;gt;output-&amp;gt;heading(get_string(&#039;gradingsummary&#039;, &#039;assign&#039;), 3);&lt;br /&gt;
        $o .= $this-&amp;gt;output-&amp;gt;box_start(&#039;boxaligncenter gradingsummarytable&#039;);&lt;br /&gt;
        $t = new html_table();&lt;br /&gt;
&lt;br /&gt;
        // Status.&lt;br /&gt;
        if ($summary-&amp;gt;teamsubmission) {&lt;br /&gt;
            $this-&amp;gt;add_table_row_tuple($t, get_string(&#039;numberofteams&#039;, &#039;assign&#039;),&lt;br /&gt;
                                       $summary-&amp;gt;participantcount);&lt;br /&gt;
        } else {&lt;br /&gt;
            $this-&amp;gt;add_table_row_tuple($t, get_string(&#039;numberofparticipants&#039;, &#039;assign&#039;),&lt;br /&gt;
                                       $summary-&amp;gt;participantcount);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Drafts count and dont show drafts count when using offline assignment.&lt;br /&gt;
        if ($summary-&amp;gt;submissiondraftsenabled &amp;amp;&amp;amp; $summary-&amp;gt;submissionsenabled) {&lt;br /&gt;
            $this-&amp;gt;add_table_row_tuple($t, get_string(&#039;numberofdraftsubmissions&#039;, &#039;assign&#039;),&lt;br /&gt;
                                       $summary-&amp;gt;submissiondraftscount);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Submitted for grading.&lt;br /&gt;
        if ($summary-&amp;gt;submissionsenabled) {&lt;br /&gt;
            $this-&amp;gt;add_table_row_tuple($t, get_string(&#039;numberofsubmittedassignments&#039;, &#039;assign&#039;),                                    &lt;br /&gt;
                                       $summary-&amp;gt;submissionssubmittedcount);&lt;br /&gt;
            if (!$summary-&amp;gt;teamsubmission) {&lt;br /&gt;
                $this-&amp;gt;add_table_row_tuple($t, get_string(&#039;numberofsubmissionsneedgrading&#039;, &#039;assign&#039;),                              &lt;br /&gt;
                                           $summary-&amp;gt;submissionsneedgradingcount);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        $time = time();&lt;br /&gt;
&lt;br /&gt;
        if ($summary-&amp;gt;duedate) {&lt;br /&gt;
            // Due date.&lt;br /&gt;
            $duedate = $summary-&amp;gt;duedate;&lt;br /&gt;
            $this-&amp;gt;add_table_row_tuple($t, get_string(&#039;duedate&#039;, &#039;assign&#039;),&lt;br /&gt;
                                       userdate($duedate));&lt;br /&gt;
&lt;br /&gt;
            // Time remaining.&lt;br /&gt;
            $due = &#039;&#039;;&lt;br /&gt;
            if ($duedate - $time &amp;lt;= 0) {&lt;br /&gt;
                $due = get_string(&#039;assignmentisdue&#039;, &#039;assign&#039;);&lt;br /&gt;
            } else {&lt;br /&gt;
                $due = format_time($duedate - $time);&lt;br /&gt;
            }&lt;br /&gt;
            $this-&amp;gt;add_table_row_tuple($t, get_string(&#039;timeremaining&#039;, &#039;assign&#039;), $due);&lt;br /&gt;
&lt;br /&gt;
            if ($duedate &amp;lt; $time) {&lt;br /&gt;
                $cutoffdate = $summary-&amp;gt;cutoffdate;&lt;br /&gt;
                if ($cutoffdate) {&lt;br /&gt;
                    if ($cutoffdate &amp;gt; $time) {&lt;br /&gt;
                        $late = get_string(&#039;latesubmissionsaccepted&#039;, &#039;assign&#039;);&lt;br /&gt;
                    } else {&lt;br /&gt;
                        $late = get_string(&#039;nomoresubmissionsaccepted&#039;, &#039;assign&#039;);&lt;br /&gt;
                    }&lt;br /&gt;
                    $this-&amp;gt;add_table_row_tuple($t, get_string(&#039;latesubmissions&#039;, &#039;assign&#039;), $late);                                 &lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // All done - write the table.&lt;br /&gt;
        $o .= html_writer::table($t);&lt;br /&gt;
        $o .= $this-&amp;gt;output-&amp;gt;box_end();&lt;br /&gt;
&lt;br /&gt;
        // Link to the grading page.&lt;br /&gt;
        $o .= $this-&amp;gt;output-&amp;gt;container_start(&#039;submissionlinks&#039;);&lt;br /&gt;
        $urlparams = array(&#039;id&#039; =&amp;gt; $summary-&amp;gt;coursemoduleid, &#039;action&#039;=&amp;gt;&#039;grading&#039;);&lt;br /&gt;
        $url = new moodle_url(&#039;/mod/assign/view.php&#039;, $urlparams);&lt;br /&gt;
        $o .= $this-&amp;gt;output-&amp;gt;action_link($url, get_string(&#039;viewgrading&#039;, &#039;assign&#039;));&lt;br /&gt;
        $o .= $this-&amp;gt;output-&amp;gt;container_end();&lt;br /&gt;
&lt;br /&gt;
        // Close the container and insert a spacer.&lt;br /&gt;
        $o .= $this-&amp;gt;output-&amp;gt;container_end();&lt;br /&gt;
&lt;br /&gt;
        return $o;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
New template:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;gradingsummary&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;{{str.mod_assign.gradingsummary}}&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;boxaligncenter gradingsummarytable&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;table class=&amp;quot;generaltable&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;tbody&amp;gt;&lt;br /&gt;
                &amp;lt;tr&amp;gt;&lt;br /&gt;
                    &amp;lt;td class=&amp;quot;cell c0&amp;quot;&amp;gt;&lt;br /&gt;
                        {{#teamsubmission}}&lt;br /&gt;
                            {{str.mod_assign.numberofteams}}&lt;br /&gt;
                        {{/teamsubmission}}&lt;br /&gt;
                        {{^teamsubmission}}&lt;br /&gt;
                            {{str.mod_assign.numberofparticipants}}&lt;br /&gt;
                        {{/teamsubmission}}&lt;br /&gt;
                    &amp;lt;/td&amp;gt;&lt;br /&gt;
                    &amp;lt;td class=&amp;quot;cell c1 lastcol&amp;quot;&amp;gt;{{participantcount}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                {{#submissionsenabled}}&lt;br /&gt;
                    {{#submissiondraftsenabled}}&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                            &amp;lt;td class=&amp;quot;cell c0&amp;quot;&amp;gt;&lt;br /&gt;
                                {{str.mod_assign.numberofdraftsubmissions}}&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                            &amp;lt;td class=&amp;quot;cell c1 lastcol&amp;quot;&amp;gt;{{submissiondraftscount}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                        &amp;lt;/tr&amp;gt;&lt;br /&gt;
                    {{/submissiondraftsenabled}}&lt;br /&gt;
                    &amp;lt;tr&amp;gt;&lt;br /&gt;
                        &amp;lt;td class=&amp;quot;cell c0&amp;quot;&amp;gt;&lt;br /&gt;
                            {{str.mod_assign.numberofsubmittedassignments}}&lt;br /&gt;
                        &amp;lt;/td&amp;gt;&lt;br /&gt;
                        &amp;lt;td class=&amp;quot;cell c1 lastcol&amp;quot;&amp;gt;{{submissionssubmittedcount}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                    &amp;lt;/tr&amp;gt;&lt;br /&gt;
                    {{^teamsubmission}}&lt;br /&gt;
                        &amp;lt;tr&amp;gt;&lt;br /&gt;
                            &amp;lt;td class=&amp;quot;cell c0&amp;quot;&amp;gt;&lt;br /&gt;
                                {{str.mod_assign.numberofsubmissionsneedgrading}}&lt;br /&gt;
                            &amp;lt;/td&amp;gt;&lt;br /&gt;
                            &amp;lt;td class=&amp;quot;cell c1 lastcol&amp;quot;&amp;gt;{{submissionsneedgradingcount}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                        &amp;lt;/tr&amp;gt;&lt;br /&gt;
                    {{/teamsubmission}}&lt;br /&gt;
                {{/submissionsenabled}}&lt;br /&gt;
                {{#duedate}}&lt;br /&gt;
                &amp;lt;tr&amp;gt;&lt;br /&gt;
                    &amp;lt;td class=&amp;quot;cell c0&amp;quot;&amp;gt;&lt;br /&gt;
                        {{str.mod_assign.duedate}}&lt;br /&gt;
                    &amp;lt;/td&amp;gt;&lt;br /&gt;
                    &amp;lt;td class=&amp;quot;cell c1 lastcol&amp;quot;&amp;gt;{{duedate}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                &amp;lt;tr&amp;gt;&lt;br /&gt;
                  &amp;lt;td class=&amp;quot;cell c0&amp;quot;&amp;gt;&lt;br /&gt;
                        {{str.mod_assign.timeremaining}}&lt;br /&gt;
                    &amp;lt;/td&amp;gt;&lt;br /&gt;
                    {{#late}}&lt;br /&gt;
                        &amp;lt;td class=&amp;quot;cell c1 lastcol&amp;quot;&amp;gt;{{str.mod_assign.assignmentisdue}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                    {{/late}}&lt;br /&gt;
                    {{^late}}&lt;br /&gt;
                        &amp;lt;td class=&amp;quot;cell c1 lastcol&amp;quot;&amp;gt;{{timeremaining}}&amp;lt;/td&amp;gt;&lt;br /&gt;
                    {{/late}}&lt;br /&gt;
                &amp;lt;/tr&amp;gt;&lt;br /&gt;
                {{#late}}&lt;br /&gt;
                    &amp;lt;tr&amp;gt;&lt;br /&gt;
                        &amp;lt;td class=&amp;quot;cell c0&amp;quot;&amp;gt;&lt;br /&gt;
                            {{str.mod_assign.latesubmissions}}&lt;br /&gt;
                        &amp;lt;/td&amp;gt;&lt;br /&gt;
                        {{#latesubmissionaccepted}}&lt;br /&gt;
                            &amp;lt;td class=&amp;quot;cell c1 lastcol&amp;quot;&amp;gt;{{str.mod_assign.latesubmissionsaccepted}}&amp;lt;/td&amp;gt;                             &lt;br /&gt;
                        {{/latesubmissionaccepted}}&lt;br /&gt;
                        {{^latesubmissionaccepted}}&lt;br /&gt;
                            &amp;lt;td class=&amp;quot;cell c1 lastcol&amp;quot;&amp;gt;{{str.mod_assign.nomoresubmissionsaccepted}}&amp;lt;/td&amp;gt;                           &lt;br /&gt;
                        {{/latesubmissionaccepted}}&lt;br /&gt;
                    &amp;lt;/tr&amp;gt;&lt;br /&gt;
                {{/late}}&lt;br /&gt;
            {{/duedate}}&lt;br /&gt;
        &amp;lt;/tbody&amp;gt;&lt;br /&gt;
    &amp;lt;/table&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;submissionlinks&amp;quot;&amp;gt;&lt;br /&gt;
        {{#links}}&lt;br /&gt;
            {{.}}&lt;br /&gt;
        {{/links}}&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Documents created as part of this spec==&lt;br /&gt;
* [[Output element planning]] - Thoughts on initial elements that should be created.&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Output API]]&lt;br /&gt;
* [[Migrating your code to the 2.0 rendering API#Outputting HTML specific to your module]]&lt;br /&gt;
* [[Output_renderers]]&lt;br /&gt;
* [[Overriding_a_renderer]]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=177535 Forum discussion on renderers]&lt;br /&gt;
* [[Renderer]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Developer_meeting_July_2014&amp;diff=45938</id>
		<title>Developer meeting July 2014</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Developer_meeting_July_2014&amp;diff=45938"/>
		<updated>2014-07-22T13:53:08Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Developer meetings]] &amp;gt; July 2014 meeting notes&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Time&lt;br /&gt;
| [http://timeanddate.com/worldclock/fixedtime.html?year=2014&amp;amp;month=7&amp;amp;day=22&amp;amp;hour=13&amp;amp;min=0&amp;amp;sec=0 13:00 UTC on Tuesday, 22 July 2014]&lt;br /&gt;
|-&lt;br /&gt;
| Meeting video&lt;br /&gt;
| [http://youtu.be/Qw9xtl9pGac Youtube stream]&lt;br /&gt;
|-&lt;br /&gt;
| Chat&lt;br /&gt;
| [https://moodle.org/local/chatlogs/info.php Regular Dev chat]&lt;br /&gt;
|-&lt;br /&gt;
| Twitter&lt;br /&gt;
| [https://twitter.com/search?q=%23moodledev #moodledev]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This meeting will focus on development happening outside of Moodle HQ&lt;br /&gt;
&lt;br /&gt;
The meeting will be streamed live on YouTube with chat through the regular Dev chat room and comments on Twitter.&lt;br /&gt;
&lt;br /&gt;
== Agenda ==&lt;br /&gt;
* Invited speaker: Justin Hunt ([https://moodle.org/mod/forum/discuss.php?d=260165 Atto plugin development]).&lt;br /&gt;
* Development in progress at HQ&lt;br /&gt;
** [[Render_library_specification|Output plan]] (Sam Hemelryk, Damyon Wiese) [[User:Sam_Hemelryk/Output_2.8_GDM_reference#Relevant_links|talk notes]]&lt;br /&gt;
** [[Navigation_overhaul_specification|User menu]] (Jetha Chan, Frédéric Massart)&lt;br /&gt;
** [[Event_Monitor_specification|Event Monitor]] (Ankit Agarwal, Simey Lameze)&lt;br /&gt;
** [[reportbuilder/API|Report Builder Source API]] (Adrian Greeve, John Okely)&lt;br /&gt;
** [https://tracker.moodle.org/browse/MDL-44673 Gradebook changes] (Martin Dougiamas)&lt;br /&gt;
** [[VERP|VERP for email processing]] (Andrew Nicols)&lt;br /&gt;
* Featured plugins campaign in Moodle plugins directory (David Mudrák)&lt;br /&gt;
&lt;br /&gt;
== Meeting Video ==&lt;br /&gt;
&lt;br /&gt;
[http://youtu.be/Qw9xtl9pGac Link to meeting on YouTube]&lt;br /&gt;
&lt;br /&gt;
If you have something you&#039;d like to add to this page, please [https://docs.moodle.org/dev/index.php?title=Developer_meeting_July_2014&amp;amp;action=edit edit this page] or contact [http://moodle.org/user/profile.php?id=381842 Michael d].&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45936</id>
		<title>User:Sam Hemelryk/Output 2.8 GDM reference</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45936"/>
		<updated>2014-07-22T12:49:14Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Relevant links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General developer meeting output summary==&lt;br /&gt;
&lt;br /&gt;
Is the start of a large movement to organise and improve output in Moodle.&lt;br /&gt;
&lt;br /&gt;
What we&#039;re going to be doing:&lt;br /&gt;
* Adoption + creation of elements.&lt;br /&gt;
* Addition of element library.&lt;br /&gt;
* Output documentation.&lt;br /&gt;
&lt;br /&gt;
What we are trying to achieve:&lt;br /&gt;
* Standardise output in Moodle so that interfaces are more consistent, accessible, usable and every other buzz word to describe would could be summed up as a good quality.&lt;br /&gt;
* Make Moodle much easier to style, with the ultimate goal of making it possible to apply any frontend framework to Moodle with much greater ease.&lt;br /&gt;
* Speed up the development of interfaces in Moodle by providing developers with a selection of ready to use elements.&lt;br /&gt;
* Speed up the styling of interfaces by providing tools to aid designers in viewing the available elements in their available states without having to discover them.&lt;br /&gt;
&lt;br /&gt;
==The specification==&lt;br /&gt;
&lt;br /&gt;
* The [[Render library specification]] is the spec document for these output changes.&lt;br /&gt;
* Covers the goals for this project, what problems we currently face, how we hope to solve them and achieve our goals, and the general guff of any specification.&lt;br /&gt;
* Links to all of the other things coming out from this specification, just like this page in fact.&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Forum discussion on the spec] to see how things have evolved.&lt;br /&gt;
&lt;br /&gt;
==The proposal prototype==&lt;br /&gt;
&lt;br /&gt;
There have been several iterations of prototypes now, the development of the specification and the discussion on the forum has been leading its changes.&lt;br /&gt;
The current prototype code can be found here:&lt;br /&gt;
&lt;br /&gt;
    Repository: git://github.com/samhemelryk/moodle.git&lt;br /&gt;
    Branch: output_proposal_5&lt;br /&gt;
    Diff URL: https://github.com/samhemelryk/moodle/compare/output_prototype_5~8...output_prototype_5&lt;br /&gt;
&lt;br /&gt;
What&#039;s worth noting about this proposal:&lt;br /&gt;
* It has implement atomic design, elements consisting of atoms, molecules and organisms are represented by classes.&lt;br /&gt;
* element classes are namespaced under output, e.g. core_output_atom, mod_foo_output_atom.&lt;br /&gt;
* element classes have common functionality (properties, attributes, and a prerender method for example).&lt;br /&gt;
* existing renderer structure has been left unchanged so if you&#039;re already familiar with renderers you&#039;ll have no troubles with this.&lt;br /&gt;
* There are three themes that have been added to show how this looks when we introduce different frameworks and make use of them.&lt;br /&gt;
&lt;br /&gt;
==Elements and Atomic design==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to run with Atomic Design, for those not familiar with it Brad Frost&#039;s article on [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic web design] explains it all.&lt;br /&gt;
&lt;br /&gt;
It basically is a break down of interfaces in module components, compartmentalising as you go so that when you create interfaces you can build the components (aka elements) back up into larger purposeful structures.&lt;br /&gt;
&lt;br /&gt;
There are five levels he defines:&lt;br /&gt;
* Atoms (e.g. button, input, action)&lt;br /&gt;
* Molecules (&lt;br /&gt;
* Organisms&lt;br /&gt;
* Templates&lt;br /&gt;
* Pages&lt;br /&gt;
&lt;br /&gt;
We plan to make use of all of these as follows:&lt;br /&gt;
* Atoms - dedicated classes.&lt;br /&gt;
* Molecules - dedicated classes.&lt;br /&gt;
* Organisms - dedicated classes.&lt;br /&gt;
* Templates - render methods for constructing what is on a page so that it can be overridden.&lt;br /&gt;
* Pages - theme layout files essentially.&lt;br /&gt;
&lt;br /&gt;
Important notes:&lt;br /&gt;
* Worth noting is that we won&#039;t have atom classes for absolutely everything, only those that make sense to create atom classes for.&lt;br /&gt;
* We will have an action atom, the action could be rendered as a button, a link, a form, whatever, can have JS actions.&lt;br /&gt;
* We&#039;ll have a special text atom that can be used to pass plain text through the render system and apply the goodness available to atoms when required.&lt;br /&gt;
&lt;br /&gt;
==The element library==&lt;br /&gt;
Tracker issue: MDL-45828&lt;br /&gt;
&lt;br /&gt;
* Admin tool to demonstrate how an element is rendered&lt;br /&gt;
* Plugins can register elements (or any kind of renderable/renderer method) to display in the element library tool&lt;br /&gt;
* The element library admin tool shows&lt;br /&gt;
** Developer notes about the element&lt;br /&gt;
** Sample output generated by the thing (supplied with dummy data)&lt;br /&gt;
** The list of renderables called when rendering the sample output&lt;br /&gt;
** An easy way to switch the language from LTR/RTL&lt;br /&gt;
* All the new core elements will be listed in this tool&lt;br /&gt;
* The tool renders using the current theme, so themers can use it to test their new themes&lt;br /&gt;
&lt;br /&gt;
[[Image:prototype-screenshot-element-library.png]]&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
Documentation is one of the big things that will come from this work, one of the most important.&amp;lt;br /&amp;gt;&lt;br /&gt;
Even if we convert very little for 2.8 this will form the basis for all future output work.&lt;br /&gt;
&lt;br /&gt;
At present we have a significant lack of documentation, here we hope to properly document things.&lt;br /&gt;
We want to have:&lt;br /&gt;
* Style guides for CSS &amp;amp; HTML&lt;br /&gt;
* Renderer best practices and guides&lt;br /&gt;
* Writing element guides&lt;br /&gt;
&lt;br /&gt;
Many of these have already been started. See below for some bullet points.&lt;br /&gt;
&lt;br /&gt;
===Renderer best practices===&lt;br /&gt;
&lt;br /&gt;
A [[Renderer best practices]] document has been started to aid people in writing better renderers.&lt;br /&gt;
&lt;br /&gt;
To summarise some key ideas that have come through it:&lt;br /&gt;
* Where renderers live, especially now that we&#039;ve got autoloading and the output namespace available.&lt;br /&gt;
* What a good renderer is.&lt;br /&gt;
* What not to do in your renderer (and why perhaps?)&lt;br /&gt;
* The different styles of render methods (layout, translator, render, convenience)&lt;br /&gt;
&lt;br /&gt;
===Element HTML and CSS guidelines===&lt;br /&gt;
&lt;br /&gt;
An [[Element HTML and CSS guidelines]] document has been started outlining a style guide for writing HTML and CSS for elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Important to note that this document is not intended to be applied outside of elements at present. As we are hoping to move entirely towards elements one day this will be the HTML and CSS guide for Moodle. However it will not be enforced in current output, its use may be recommended.&lt;br /&gt;
&lt;br /&gt;
Key ideas in this document include:&lt;br /&gt;
* Where to put CSS&lt;br /&gt;
* Prefixing our id&#039;s a classes is being purposed.&lt;br /&gt;
* Introducing notation (based somewhat on BEM) for classes on elements.&lt;br /&gt;
* Structure and whitespace rules for writing CSS.&lt;br /&gt;
* Commenting for CSS.&lt;br /&gt;
* Grids in Moodle - thinking about choosing a specific grid format for core Moodle that can be theme independent but overridden by themes.&lt;br /&gt;
&lt;br /&gt;
===Guide to creating output elements===&lt;br /&gt;
&lt;br /&gt;
A document titled [[Guide to creating output elements]] has been written already on how to write an output element.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will aid us and others in writing consistent elements that conform to the ideals we have chosen.&lt;br /&gt;
&lt;br /&gt;
==How this work is going to get done==&lt;br /&gt;
&lt;br /&gt;
As always there is a limited timeframe on the release and limited man hours. We&#039;ve not converted everything to renderers yet so it&#039;d be false to think we could convert everything to elements.&lt;br /&gt;
We won&#039;t be able to do all of this in 2.8 so we will be focusing on establishing a solid base on which to progress this over future releases.&lt;br /&gt;
&lt;br /&gt;
* We will aim to create the useful elements in 2.8 and get some uses of each into Moodle to prove there use.&lt;br /&gt;
* The documentation will be finalised and completed before the release of 2.8.&lt;br /&gt;
* The element library will be integrated before the release of 2.8.&lt;br /&gt;
* Elements can be delegated, we&#039;ll get core to do a couple to ensure what we are planning is spot on and then we will happily accept any help offered.&lt;br /&gt;
* Conversion will be ongoing, it will likely be a couple of release before we truly see the benefits we hope to achieve.&lt;br /&gt;
* We intend to convert the assignment module early on in the picture.&lt;br /&gt;
* Complex conversions like forms will be tackled but we are not sure when yet.&lt;br /&gt;
&lt;br /&gt;
Its important to note the impact that this ongoing conversion will have on themers.&amp;lt;br /&amp;gt;&lt;br /&gt;
We will be endeavouring to keep everything as backwards compatible as possible and conversions will be treated as improvements and only integrated to master.&amp;lt;br /&amp;gt;&lt;br /&gt;
However themes that have overridden renderers when conversion then take place will need to be reviewed and likely amended/fixed.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will only happen on major releases, and as this brings many benefits we hope it will be well tolerated.&lt;br /&gt;
&lt;br /&gt;
==Relevant links==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Docs pages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Output element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
* [[Element Library]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tracker issues&#039;&#039;&#039;&lt;br /&gt;
* MDL-45770 Stage 1 epic (see [[Render library specification]])&lt;br /&gt;
* MDL-45827 Spec the element library (see [[Element Library]])&lt;br /&gt;
* MDL-45828 Create the element library&lt;br /&gt;
* MDL-45829 Initial elements (see [[Output element planning]])&lt;br /&gt;
* MDL-45853 Document renderer best practices (see [[Renderer best practices]])&lt;br /&gt;
* MDL-45830 Document CSS style guide for elements (see [[Element HTML and CSS guidelines]])&lt;br /&gt;
* MDL-45885 Design and document elements (see [[Guide to creating output elements]])&lt;br /&gt;
* MDL-45854 Document JS and how it works with elements.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Other links&#039;&#039;&#039;&lt;br /&gt;
* [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic web design by Brad Frost]&lt;br /&gt;
* [http://bem.info/tutorials/start-with-project-stub/ BEM introduction]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45934</id>
		<title>User:Sam Hemelryk/Output 2.8 GDM reference</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45934"/>
		<updated>2014-07-22T12:47:14Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* How this work is going to get done */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General developer meeting output summary==&lt;br /&gt;
&lt;br /&gt;
Is the start of a large movement to organise and improve output in Moodle.&lt;br /&gt;
&lt;br /&gt;
What we&#039;re going to be doing:&lt;br /&gt;
* Adoption + creation of elements.&lt;br /&gt;
* Addition of element library.&lt;br /&gt;
* Output documentation.&lt;br /&gt;
&lt;br /&gt;
What we are trying to achieve:&lt;br /&gt;
* Standardise output in Moodle so that interfaces are more consistent, accessible, usable and every other buzz word to describe would could be summed up as a good quality.&lt;br /&gt;
* Make Moodle much easier to style, with the ultimate goal of making it possible to apply any frontend framework to Moodle with much greater ease.&lt;br /&gt;
* Speed up the development of interfaces in Moodle by providing developers with a selection of ready to use elements.&lt;br /&gt;
* Speed up the styling of interfaces by providing tools to aid designers in viewing the available elements in their available states without having to discover them.&lt;br /&gt;
&lt;br /&gt;
==The specification==&lt;br /&gt;
&lt;br /&gt;
* The [[Render library specification]] is the spec document for these output changes.&lt;br /&gt;
* Covers the goals for this project, what problems we currently face, how we hope to solve them and achieve our goals, and the general guff of any specification.&lt;br /&gt;
* Links to all of the other things coming out from this specification, just like this page in fact.&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Forum discussion on the spec] to see how things have evolved.&lt;br /&gt;
&lt;br /&gt;
==The proposal prototype==&lt;br /&gt;
&lt;br /&gt;
There have been several iterations of prototypes now, the development of the specification and the discussion on the forum has been leading its changes.&lt;br /&gt;
The current prototype code can be found here:&lt;br /&gt;
&lt;br /&gt;
    Repository: git://github.com/samhemelryk/moodle.git&lt;br /&gt;
    Branch: output_proposal_5&lt;br /&gt;
    Diff URL: https://github.com/samhemelryk/moodle/compare/output_prototype_5~8...output_prototype_5&lt;br /&gt;
&lt;br /&gt;
What&#039;s worth noting about this proposal:&lt;br /&gt;
* It has implement atomic design, elements consisting of atoms, molecules and organisms are represented by classes.&lt;br /&gt;
* element classes are namespaced under output, e.g. core_output_atom, mod_foo_output_atom.&lt;br /&gt;
* element classes have common functionality (properties, attributes, and a prerender method for example).&lt;br /&gt;
* existing renderer structure has been left unchanged so if you&#039;re already familiar with renderers you&#039;ll have no troubles with this.&lt;br /&gt;
* There are three themes that have been added to show how this looks when we introduce different frameworks and make use of them.&lt;br /&gt;
&lt;br /&gt;
==Elements and Atomic design==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to run with Atomic Design, for those not familiar with it Brad Frost&#039;s article on [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic web design] explains it all.&lt;br /&gt;
&lt;br /&gt;
It basically is a break down of interfaces in module components, compartmentalising as you go so that when you create interfaces you can build the components (aka elements) back up into larger purposeful structures.&lt;br /&gt;
&lt;br /&gt;
There are five levels he defines:&lt;br /&gt;
* Atoms (e.g. button, input, action)&lt;br /&gt;
* Molecules (&lt;br /&gt;
* Organisms&lt;br /&gt;
* Templates&lt;br /&gt;
* Pages&lt;br /&gt;
&lt;br /&gt;
We plan to make use of all of these as follows:&lt;br /&gt;
* Atoms - dedicated classes.&lt;br /&gt;
* Molecules - dedicated classes.&lt;br /&gt;
* Organisms - dedicated classes.&lt;br /&gt;
* Templates - render methods for constructing what is on a page so that it can be overridden.&lt;br /&gt;
* Pages - theme layout files essentially.&lt;br /&gt;
&lt;br /&gt;
Important notes:&lt;br /&gt;
* Worth noting is that we won&#039;t have atom classes for absolutely everything, only those that make sense to create atom classes for.&lt;br /&gt;
* We will have an action atom, the action could be rendered as a button, a link, a form, whatever, can have JS actions.&lt;br /&gt;
* We&#039;ll have a special text atom that can be used to pass plain text through the render system and apply the goodness available to atoms when required.&lt;br /&gt;
&lt;br /&gt;
==The element library==&lt;br /&gt;
Tracker issue: MDL-45828&lt;br /&gt;
&lt;br /&gt;
* Admin tool to demonstrate how an element is rendered&lt;br /&gt;
* Plugins can register elements (or any kind of renderable/renderer method) to display in the element library tool&lt;br /&gt;
* The element library admin tool shows&lt;br /&gt;
** Developer notes about the element&lt;br /&gt;
** Sample output generated by the thing (supplied with dummy data)&lt;br /&gt;
** The list of renderables called when rendering the sample output&lt;br /&gt;
** An easy way to switch the language from LTR/RTL&lt;br /&gt;
* All the new core elements will be listed in this tool&lt;br /&gt;
* The tool renders using the current theme, so themers can use it to test their new themes&lt;br /&gt;
&lt;br /&gt;
[[Image:prototype-screenshot-element-library.png]]&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
Documentation is one of the big things that will come from this work, one of the most important.&amp;lt;br /&amp;gt;&lt;br /&gt;
Even if we convert very little for 2.8 this will form the basis for all future output work.&lt;br /&gt;
&lt;br /&gt;
At present we have a significant lack of documentation, here we hope to properly document things.&lt;br /&gt;
We want to have:&lt;br /&gt;
* Style guides for CSS &amp;amp; HTML&lt;br /&gt;
* Renderer best practices and guides&lt;br /&gt;
* Writing element guides&lt;br /&gt;
&lt;br /&gt;
Many of these have already been started. See below for some bullet points.&lt;br /&gt;
&lt;br /&gt;
===Renderer best practices===&lt;br /&gt;
&lt;br /&gt;
A [[Renderer best practices]] document has been started to aid people in writing better renderers.&lt;br /&gt;
&lt;br /&gt;
To summarise some key ideas that have come through it:&lt;br /&gt;
* Where renderers live, especially now that we&#039;ve got autoloading and the output namespace available.&lt;br /&gt;
* What a good renderer is.&lt;br /&gt;
* What not to do in your renderer (and why perhaps?)&lt;br /&gt;
* The different styles of render methods (layout, translator, render, convenience)&lt;br /&gt;
&lt;br /&gt;
===Element HTML and CSS guidelines===&lt;br /&gt;
&lt;br /&gt;
An [[Element HTML and CSS guidelines]] document has been started outlining a style guide for writing HTML and CSS for elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Important to note that this document is not intended to be applied outside of elements at present. As we are hoping to move entirely towards elements one day this will be the HTML and CSS guide for Moodle. However it will not be enforced in current output, its use may be recommended.&lt;br /&gt;
&lt;br /&gt;
Key ideas in this document include:&lt;br /&gt;
* Where to put CSS&lt;br /&gt;
* Prefixing our id&#039;s a classes is being purposed.&lt;br /&gt;
* Introducing notation (based somewhat on BEM) for classes on elements.&lt;br /&gt;
* Structure and whitespace rules for writing CSS.&lt;br /&gt;
* Commenting for CSS.&lt;br /&gt;
* Grids in Moodle - thinking about choosing a specific grid format for core Moodle that can be theme independent but overridden by themes.&lt;br /&gt;
&lt;br /&gt;
===Guide to creating output elements===&lt;br /&gt;
&lt;br /&gt;
A document titled [[Guide to creating output elements]] has been written already on how to write an output element.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will aid us and others in writing consistent elements that conform to the ideals we have chosen.&lt;br /&gt;
&lt;br /&gt;
==How this work is going to get done==&lt;br /&gt;
&lt;br /&gt;
As always there is a limited timeframe on the release and limited man hours. We&#039;ve not converted everything to renderers yet so it&#039;d be false to think we could convert everything to elements.&lt;br /&gt;
We won&#039;t be able to do all of this in 2.8 so we will be focusing on establishing a solid base on which to progress this over future releases.&lt;br /&gt;
&lt;br /&gt;
* We will aim to create the useful elements in 2.8 and get some uses of each into Moodle to prove there use.&lt;br /&gt;
* The documentation will be finalised and completed before the release of 2.8.&lt;br /&gt;
* The element library will be integrated before the release of 2.8.&lt;br /&gt;
* Elements can be delegated, we&#039;ll get core to do a couple to ensure what we are planning is spot on and then we will happily accept any help offered.&lt;br /&gt;
* Conversion will be ongoing, it will likely be a couple of release before we truly see the benefits we hope to achieve.&lt;br /&gt;
* We intend to convert the assignment module early on in the picture.&lt;br /&gt;
* Complex conversions like forms will be tackled but we are not sure when yet.&lt;br /&gt;
&lt;br /&gt;
Its important to note the impact that this ongoing conversion will have on themers.&amp;lt;br /&amp;gt;&lt;br /&gt;
We will be endeavouring to keep everything as backwards compatible as possible and conversions will be treated as improvements and only integrated to master.&amp;lt;br /&amp;gt;&lt;br /&gt;
However themes that have overridden renderers when conversion then take place will need to be reviewed and likely amended/fixed.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will only happen on major releases, and as this brings many benefits we hope it will be well tolerated.&lt;br /&gt;
&lt;br /&gt;
==Relevant links==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Docs pages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Output element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
* [[Element Library]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tracker issues&#039;&#039;&#039;&lt;br /&gt;
* MDL-45770 Stage 1 epic (see [[Render library specification]])&lt;br /&gt;
* MDL-45827 Spec the element library (see [[Element Library]])&lt;br /&gt;
* MDL-45828 Create the element library&lt;br /&gt;
* MDL-45829 Initial elements (see [[Output element planning]])&lt;br /&gt;
* MDL-45853 Document renderer best practices (see [[Renderer best practices]])&lt;br /&gt;
* MDL-45830 Document CSS style guide for elements (see [[Element HTML and CSS guidelines]])&lt;br /&gt;
* MDL-45885 Design and document elements (see [[Guide to creating output elements]])&lt;br /&gt;
* MDL-45854 Document JS and how it works with elements.&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45933</id>
		<title>User:Sam Hemelryk/Output 2.8 GDM reference</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45933"/>
		<updated>2014-07-22T12:41:59Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* The element library */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General developer meeting output summary==&lt;br /&gt;
&lt;br /&gt;
Is the start of a large movement to organise and improve output in Moodle.&lt;br /&gt;
&lt;br /&gt;
What we&#039;re going to be doing:&lt;br /&gt;
* Adoption + creation of elements.&lt;br /&gt;
* Addition of element library.&lt;br /&gt;
* Output documentation.&lt;br /&gt;
&lt;br /&gt;
What we are trying to achieve:&lt;br /&gt;
* Standardise output in Moodle so that interfaces are more consistent, accessible, usable and every other buzz word to describe would could be summed up as a good quality.&lt;br /&gt;
* Make Moodle much easier to style, with the ultimate goal of making it possible to apply any frontend framework to Moodle with much greater ease.&lt;br /&gt;
* Speed up the development of interfaces in Moodle by providing developers with a selection of ready to use elements.&lt;br /&gt;
* Speed up the styling of interfaces by providing tools to aid designers in viewing the available elements in their available states without having to discover them.&lt;br /&gt;
&lt;br /&gt;
==The specification==&lt;br /&gt;
&lt;br /&gt;
* The [[Render library specification]] is the spec document for these output changes.&lt;br /&gt;
* Covers the goals for this project, what problems we currently face, how we hope to solve them and achieve our goals, and the general guff of any specification.&lt;br /&gt;
* Links to all of the other things coming out from this specification, just like this page in fact.&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Forum discussion on the spec] to see how things have evolved.&lt;br /&gt;
&lt;br /&gt;
==The proposal prototype==&lt;br /&gt;
&lt;br /&gt;
There have been several iterations of prototypes now, the development of the specification and the discussion on the forum has been leading its changes.&lt;br /&gt;
The current prototype code can be found here:&lt;br /&gt;
&lt;br /&gt;
    Repository: git://github.com/samhemelryk/moodle.git&lt;br /&gt;
    Branch: output_proposal_5&lt;br /&gt;
    Diff URL: https://github.com/samhemelryk/moodle/compare/output_prototype_5~8...output_prototype_5&lt;br /&gt;
&lt;br /&gt;
What&#039;s worth noting about this proposal:&lt;br /&gt;
* It has implement atomic design, elements consisting of atoms, molecules and organisms are represented by classes.&lt;br /&gt;
* element classes are namespaced under output, e.g. core_output_atom, mod_foo_output_atom.&lt;br /&gt;
* element classes have common functionality (properties, attributes, and a prerender method for example).&lt;br /&gt;
* existing renderer structure has been left unchanged so if you&#039;re already familiar with renderers you&#039;ll have no troubles with this.&lt;br /&gt;
* There are three themes that have been added to show how this looks when we introduce different frameworks and make use of them.&lt;br /&gt;
&lt;br /&gt;
==Elements and Atomic design==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to run with Atomic Design, for those not familiar with it Brad Frost&#039;s article on [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic web design] explains it all.&lt;br /&gt;
&lt;br /&gt;
It basically is a break down of interfaces in module components, compartmentalising as you go so that when you create interfaces you can build the components (aka elements) back up into larger purposeful structures.&lt;br /&gt;
&lt;br /&gt;
There are five levels he defines:&lt;br /&gt;
* Atoms (e.g. button, input, action)&lt;br /&gt;
* Molecules (&lt;br /&gt;
* Organisms&lt;br /&gt;
* Templates&lt;br /&gt;
* Pages&lt;br /&gt;
&lt;br /&gt;
We plan to make use of all of these as follows:&lt;br /&gt;
* Atoms - dedicated classes.&lt;br /&gt;
* Molecules - dedicated classes.&lt;br /&gt;
* Organisms - dedicated classes.&lt;br /&gt;
* Templates - render methods for constructing what is on a page so that it can be overridden.&lt;br /&gt;
* Pages - theme layout files essentially.&lt;br /&gt;
&lt;br /&gt;
Important notes:&lt;br /&gt;
* Worth noting is that we won&#039;t have atom classes for absolutely everything, only those that make sense to create atom classes for.&lt;br /&gt;
* We will have an action atom, the action could be rendered as a button, a link, a form, whatever, can have JS actions.&lt;br /&gt;
* We&#039;ll have a special text atom that can be used to pass plain text through the render system and apply the goodness available to atoms when required.&lt;br /&gt;
&lt;br /&gt;
==The element library==&lt;br /&gt;
Tracker issue: MDL-45828&lt;br /&gt;
&lt;br /&gt;
* Admin tool to demonstrate how an element is rendered&lt;br /&gt;
* Plugins can register elements (or any kind of renderable/renderer method) to display in the element library tool&lt;br /&gt;
* The element library admin tool shows&lt;br /&gt;
** Developer notes about the element&lt;br /&gt;
** Sample output generated by the thing (supplied with dummy data)&lt;br /&gt;
** The list of renderables called when rendering the sample output&lt;br /&gt;
** An easy way to switch the language from LTR/RTL&lt;br /&gt;
* All the new core elements will be listed in this tool&lt;br /&gt;
* The tool renders using the current theme, so themers can use it to test their new themes&lt;br /&gt;
&lt;br /&gt;
[[Image:prototype-screenshot-element-library.png]]&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
Documentation is one of the big things that will come from this work, one of the most important.&amp;lt;br /&amp;gt;&lt;br /&gt;
Even if we convert very little for 2.8 this will form the basis for all future output work.&lt;br /&gt;
&lt;br /&gt;
At present we have a significant lack of documentation, here we hope to properly document things.&lt;br /&gt;
We want to have:&lt;br /&gt;
* Style guides for CSS &amp;amp; HTML&lt;br /&gt;
* Renderer best practices and guides&lt;br /&gt;
* Writing element guides&lt;br /&gt;
&lt;br /&gt;
Many of these have already been started. See below for some bullet points.&lt;br /&gt;
&lt;br /&gt;
===Renderer best practices===&lt;br /&gt;
&lt;br /&gt;
A [[Renderer best practices]] document has been started to aid people in writing better renderers.&lt;br /&gt;
&lt;br /&gt;
To summarise some key ideas that have come through it:&lt;br /&gt;
* Where renderers live, especially now that we&#039;ve got autoloading and the output namespace available.&lt;br /&gt;
* What a good renderer is.&lt;br /&gt;
* What not to do in your renderer (and why perhaps?)&lt;br /&gt;
* The different styles of render methods (layout, translator, render, convenience)&lt;br /&gt;
&lt;br /&gt;
===Element HTML and CSS guidelines===&lt;br /&gt;
&lt;br /&gt;
An [[Element HTML and CSS guidelines]] document has been started outlining a style guide for writing HTML and CSS for elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Important to note that this document is not intended to be applied outside of elements at present. As we are hoping to move entirely towards elements one day this will be the HTML and CSS guide for Moodle. However it will not be enforced in current output, its use may be recommended.&lt;br /&gt;
&lt;br /&gt;
Key ideas in this document include:&lt;br /&gt;
* Where to put CSS&lt;br /&gt;
* Prefixing our id&#039;s a classes is being purposed.&lt;br /&gt;
* Introducing notation (based somewhat on BEM) for classes on elements.&lt;br /&gt;
* Structure and whitespace rules for writing CSS.&lt;br /&gt;
* Commenting for CSS.&lt;br /&gt;
* Grids in Moodle - thinking about choosing a specific grid format for core Moodle that can be theme independent but overridden by themes.&lt;br /&gt;
&lt;br /&gt;
===Guide to creating output elements===&lt;br /&gt;
&lt;br /&gt;
A document titled [[Guide to creating output elements]] has been written already on how to write an output element.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will aid us and others in writing consistent elements that conform to the ideals we have chosen.&lt;br /&gt;
&lt;br /&gt;
==How this work is going to get done==&lt;br /&gt;
&lt;br /&gt;
* As always there is a limited timeframe on the release and limited man hours. We&#039;ve not converted everything to renderers yet so itd be false to think we could convert everything to elements.&lt;br /&gt;
* We will aim to create the designated elements in 2.8 and get some uses of each into Moodle to prove there use.&lt;br /&gt;
* The documentation will be finalised and completed before the release of 2.8.&lt;br /&gt;
* The element library will be integrated before the release of 2.8.&lt;br /&gt;
* Elements can be delegated, we&#039;ll get core to do a couple to ensure what we are planning is spot on and then we will happily accept any help offered.&lt;br /&gt;
* Conversion will be ongoing, it will likely be a couple of release before we truly see the benefits we hope to achieve.&lt;br /&gt;
&lt;br /&gt;
==Relevant links==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Docs pages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Output element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
* [[Element Library]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tracker issues&#039;&#039;&#039;&lt;br /&gt;
* MDL-45770 Stage 1 epic (see [[Render library specification]])&lt;br /&gt;
* MDL-45827 Spec the element library (see [[Element Library]])&lt;br /&gt;
* MDL-45828 Create the element library&lt;br /&gt;
* MDL-45829 Initial elements (see [[Output element planning]])&lt;br /&gt;
* MDL-45853 Document renderer best practices (see [[Renderer best practices]])&lt;br /&gt;
* MDL-45830 Document CSS style guide for elements (see [[Element HTML and CSS guidelines]])&lt;br /&gt;
* MDL-45885 Design and document elements (see [[Guide to creating output elements]])&lt;br /&gt;
* MDL-45854 Document JS and how it works with elements.&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:prototype-screenshot-element-library.png&amp;diff=45932</id>
		<title>File:prototype-screenshot-element-library.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:prototype-screenshot-element-library.png&amp;diff=45932"/>
		<updated>2014-07-22T12:41:24Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: A screenshot of the element library prototype.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A screenshot of the element library prototype.&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45931</id>
		<title>User:Sam Hemelryk/Output 2.8 GDM reference</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45931"/>
		<updated>2014-07-22T12:39:57Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Relevant links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General developer meeting output summary==&lt;br /&gt;
&lt;br /&gt;
Is the start of a large movement to organise and improve output in Moodle.&lt;br /&gt;
&lt;br /&gt;
What we&#039;re going to be doing:&lt;br /&gt;
* Adoption + creation of elements.&lt;br /&gt;
* Addition of element library.&lt;br /&gt;
* Output documentation.&lt;br /&gt;
&lt;br /&gt;
What we are trying to achieve:&lt;br /&gt;
* Standardise output in Moodle so that interfaces are more consistent, accessible, usable and every other buzz word to describe would could be summed up as a good quality.&lt;br /&gt;
* Make Moodle much easier to style, with the ultimate goal of making it possible to apply any frontend framework to Moodle with much greater ease.&lt;br /&gt;
* Speed up the development of interfaces in Moodle by providing developers with a selection of ready to use elements.&lt;br /&gt;
* Speed up the styling of interfaces by providing tools to aid designers in viewing the available elements in their available states without having to discover them.&lt;br /&gt;
&lt;br /&gt;
==The specification==&lt;br /&gt;
&lt;br /&gt;
* The [[Render library specification]] is the spec document for these output changes.&lt;br /&gt;
* Covers the goals for this project, what problems we currently face, how we hope to solve them and achieve our goals, and the general guff of any specification.&lt;br /&gt;
* Links to all of the other things coming out from this specification, just like this page in fact.&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Forum discussion on the spec] to see how things have evolved.&lt;br /&gt;
&lt;br /&gt;
==The proposal prototype==&lt;br /&gt;
&lt;br /&gt;
There have been several iterations of prototypes now, the development of the specification and the discussion on the forum has been leading its changes.&lt;br /&gt;
The current prototype code can be found here:&lt;br /&gt;
&lt;br /&gt;
    Repository: git://github.com/samhemelryk/moodle.git&lt;br /&gt;
    Branch: output_proposal_5&lt;br /&gt;
    Diff URL: https://github.com/samhemelryk/moodle/compare/output_prototype_5~8...output_prototype_5&lt;br /&gt;
&lt;br /&gt;
What&#039;s worth noting about this proposal:&lt;br /&gt;
* It has implement atomic design, elements consisting of atoms, molecules and organisms are represented by classes.&lt;br /&gt;
* element classes are namespaced under output, e.g. core_output_atom, mod_foo_output_atom.&lt;br /&gt;
* element classes have common functionality (properties, attributes, and a prerender method for example).&lt;br /&gt;
* existing renderer structure has been left unchanged so if you&#039;re already familiar with renderers you&#039;ll have no troubles with this.&lt;br /&gt;
* There are three themes that have been added to show how this looks when we introduce different frameworks and make use of them.&lt;br /&gt;
&lt;br /&gt;
==Elements and Atomic design==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to run with Atomic Design, for those not familiar with it Brad Frost&#039;s article on [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic web design] explains it all.&lt;br /&gt;
&lt;br /&gt;
It basically is a break down of interfaces in module components, compartmentalising as you go so that when you create interfaces you can build the components (aka elements) back up into larger purposeful structures.&lt;br /&gt;
&lt;br /&gt;
There are five levels he defines:&lt;br /&gt;
* Atoms (e.g. button, input, action)&lt;br /&gt;
* Molecules (&lt;br /&gt;
* Organisms&lt;br /&gt;
* Templates&lt;br /&gt;
* Pages&lt;br /&gt;
&lt;br /&gt;
We plan to make use of all of these as follows:&lt;br /&gt;
* Atoms - dedicated classes.&lt;br /&gt;
* Molecules - dedicated classes.&lt;br /&gt;
* Organisms - dedicated classes.&lt;br /&gt;
* Templates - render methods for constructing what is on a page so that it can be overridden.&lt;br /&gt;
* Pages - theme layout files essentially.&lt;br /&gt;
&lt;br /&gt;
Important notes:&lt;br /&gt;
* Worth noting is that we won&#039;t have atom classes for absolutely everything, only those that make sense to create atom classes for.&lt;br /&gt;
* We will have an action atom, the action could be rendered as a button, a link, a form, whatever, can have JS actions.&lt;br /&gt;
* We&#039;ll have a special text atom that can be used to pass plain text through the render system and apply the goodness available to atoms when required.&lt;br /&gt;
&lt;br /&gt;
==The element library==&lt;br /&gt;
Tracker issue: MDL-45828&lt;br /&gt;
&lt;br /&gt;
* Admin tool to demonstrate how an element is rendered&lt;br /&gt;
* Plugins can register elements (or any kind of renderable/renderer method) to display in the element library tool&lt;br /&gt;
* The element library admin tool shows&lt;br /&gt;
** Developer notes about the element&lt;br /&gt;
** Sample output generated by the thing (supplied with dummy data)&lt;br /&gt;
** The list of renderables called when rendering the sample output&lt;br /&gt;
** An easy way to switch the language from LTR/RTL&lt;br /&gt;
* All the new core elements will be listed in this tool&lt;br /&gt;
* The tool renders using the current theme, so themers can use it to test their new themes&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
Documentation is one of the big things that will come from this work, one of the most important.&amp;lt;br /&amp;gt;&lt;br /&gt;
Even if we convert very little for 2.8 this will form the basis for all future output work.&lt;br /&gt;
&lt;br /&gt;
At present we have a significant lack of documentation, here we hope to properly document things.&lt;br /&gt;
We want to have:&lt;br /&gt;
* Style guides for CSS &amp;amp; HTML&lt;br /&gt;
* Renderer best practices and guides&lt;br /&gt;
* Writing element guides&lt;br /&gt;
&lt;br /&gt;
Many of these have already been started. See below for some bullet points.&lt;br /&gt;
&lt;br /&gt;
===Renderer best practices===&lt;br /&gt;
&lt;br /&gt;
A [[Renderer best practices]] document has been started to aid people in writing better renderers.&lt;br /&gt;
&lt;br /&gt;
To summarise some key ideas that have come through it:&lt;br /&gt;
* Where renderers live, especially now that we&#039;ve got autoloading and the output namespace available.&lt;br /&gt;
* What a good renderer is.&lt;br /&gt;
* What not to do in your renderer (and why perhaps?)&lt;br /&gt;
* The different styles of render methods (layout, translator, render, convenience)&lt;br /&gt;
&lt;br /&gt;
===Element HTML and CSS guidelines===&lt;br /&gt;
&lt;br /&gt;
An [[Element HTML and CSS guidelines]] document has been started outlining a style guide for writing HTML and CSS for elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Important to note that this document is not intended to be applied outside of elements at present. As we are hoping to move entirely towards elements one day this will be the HTML and CSS guide for Moodle. However it will not be enforced in current output, its use may be recommended.&lt;br /&gt;
&lt;br /&gt;
Key ideas in this document include:&lt;br /&gt;
* Where to put CSS&lt;br /&gt;
* Prefixing our id&#039;s a classes is being purposed.&lt;br /&gt;
* Introducing notation (based somewhat on BEM) for classes on elements.&lt;br /&gt;
* Structure and whitespace rules for writing CSS.&lt;br /&gt;
* Commenting for CSS.&lt;br /&gt;
* Grids in Moodle - thinking about choosing a specific grid format for core Moodle that can be theme independent but overridden by themes.&lt;br /&gt;
&lt;br /&gt;
===Guide to creating output elements===&lt;br /&gt;
&lt;br /&gt;
A document titled [[Guide to creating output elements]] has been written already on how to write an output element.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will aid us and others in writing consistent elements that conform to the ideals we have chosen.&lt;br /&gt;
&lt;br /&gt;
==How this work is going to get done==&lt;br /&gt;
&lt;br /&gt;
* As always there is a limited timeframe on the release and limited man hours. We&#039;ve not converted everything to renderers yet so itd be false to think we could convert everything to elements.&lt;br /&gt;
* We will aim to create the designated elements in 2.8 and get some uses of each into Moodle to prove there use.&lt;br /&gt;
* The documentation will be finalised and completed before the release of 2.8.&lt;br /&gt;
* The element library will be integrated before the release of 2.8.&lt;br /&gt;
* Elements can be delegated, we&#039;ll get core to do a couple to ensure what we are planning is spot on and then we will happily accept any help offered.&lt;br /&gt;
* Conversion will be ongoing, it will likely be a couple of release before we truly see the benefits we hope to achieve.&lt;br /&gt;
&lt;br /&gt;
==Relevant links==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Docs pages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Output element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
* [[Element Library]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tracker issues&#039;&#039;&#039;&lt;br /&gt;
* MDL-45770 Stage 1 epic (see [[Render library specification]])&lt;br /&gt;
* MDL-45827 Spec the element library (see [[Element Library]])&lt;br /&gt;
* MDL-45828 Create the element library&lt;br /&gt;
* MDL-45829 Initial elements (see [[Output element planning]])&lt;br /&gt;
* MDL-45853 Document renderer best practices (see [[Renderer best practices]])&lt;br /&gt;
* MDL-45830 Document CSS style guide for elements (see [[Element HTML and CSS guidelines]])&lt;br /&gt;
* MDL-45885 Design and document elements (see [[Guide to creating output elements]])&lt;br /&gt;
* MDL-45854 Document JS and how it works with elements.&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45930</id>
		<title>User:Sam Hemelryk/Output 2.8 GDM reference</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45930"/>
		<updated>2014-07-22T12:33:22Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General developer meeting output summary==&lt;br /&gt;
&lt;br /&gt;
Is the start of a large movement to organise and improve output in Moodle.&lt;br /&gt;
&lt;br /&gt;
What we&#039;re going to be doing:&lt;br /&gt;
* Adoption + creation of elements.&lt;br /&gt;
* Addition of element library.&lt;br /&gt;
* Output documentation.&lt;br /&gt;
&lt;br /&gt;
What we are trying to achieve:&lt;br /&gt;
* Standardise output in Moodle so that interfaces are more consistent, accessible, usable and every other buzz word to describe would could be summed up as a good quality.&lt;br /&gt;
* Make Moodle much easier to style, with the ultimate goal of making it possible to apply any frontend framework to Moodle with much greater ease.&lt;br /&gt;
* Speed up the development of interfaces in Moodle by providing developers with a selection of ready to use elements.&lt;br /&gt;
* Speed up the styling of interfaces by providing tools to aid designers in viewing the available elements in their available states without having to discover them.&lt;br /&gt;
&lt;br /&gt;
==The specification==&lt;br /&gt;
&lt;br /&gt;
* The [[Render library specification]] is the spec document for these output changes.&lt;br /&gt;
* Covers the goals for this project, what problems we currently face, how we hope to solve them and achieve our goals, and the general guff of any specification.&lt;br /&gt;
* Links to all of the other things coming out from this specification, just like this page in fact.&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Forum discussion on the spec] to see how things have evolved.&lt;br /&gt;
&lt;br /&gt;
==The proposal prototype==&lt;br /&gt;
&lt;br /&gt;
There have been several iterations of prototypes now, the development of the specification and the discussion on the forum has been leading its changes.&lt;br /&gt;
The current prototype code can be found here:&lt;br /&gt;
&lt;br /&gt;
    Repository: git://github.com/samhemelryk/moodle.git&lt;br /&gt;
    Branch: output_proposal_5&lt;br /&gt;
    Diff URL: https://github.com/samhemelryk/moodle/compare/output_prototype_5~8...output_prototype_5&lt;br /&gt;
&lt;br /&gt;
What&#039;s worth noting about this proposal:&lt;br /&gt;
* It has implement atomic design, elements consisting of atoms, molecules and organisms are represented by classes.&lt;br /&gt;
* element classes are namespaced under output, e.g. core_output_atom, mod_foo_output_atom.&lt;br /&gt;
* element classes have common functionality (properties, attributes, and a prerender method for example).&lt;br /&gt;
* existing renderer structure has been left unchanged so if you&#039;re already familiar with renderers you&#039;ll have no troubles with this.&lt;br /&gt;
* There are three themes that have been added to show how this looks when we introduce different frameworks and make use of them.&lt;br /&gt;
&lt;br /&gt;
==Elements and Atomic design==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to run with Atomic Design, for those not familiar with it Brad Frost&#039;s article on [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic web design] explains it all.&lt;br /&gt;
&lt;br /&gt;
It basically is a break down of interfaces in module components, compartmentalising as you go so that when you create interfaces you can build the components (aka elements) back up into larger purposeful structures.&lt;br /&gt;
&lt;br /&gt;
There are five levels he defines:&lt;br /&gt;
* Atoms (e.g. button, input, action)&lt;br /&gt;
* Molecules (&lt;br /&gt;
* Organisms&lt;br /&gt;
* Templates&lt;br /&gt;
* Pages&lt;br /&gt;
&lt;br /&gt;
We plan to make use of all of these as follows:&lt;br /&gt;
* Atoms - dedicated classes.&lt;br /&gt;
* Molecules - dedicated classes.&lt;br /&gt;
* Organisms - dedicated classes.&lt;br /&gt;
* Templates - render methods for constructing what is on a page so that it can be overridden.&lt;br /&gt;
* Pages - theme layout files essentially.&lt;br /&gt;
&lt;br /&gt;
Important notes:&lt;br /&gt;
* Worth noting is that we won&#039;t have atom classes for absolutely everything, only those that make sense to create atom classes for.&lt;br /&gt;
* We will have an action atom, the action could be rendered as a button, a link, a form, whatever, can have JS actions.&lt;br /&gt;
* We&#039;ll have a special text atom that can be used to pass plain text through the render system and apply the goodness available to atoms when required.&lt;br /&gt;
&lt;br /&gt;
==The element library==&lt;br /&gt;
Tracker issue: MDL-45828&lt;br /&gt;
&lt;br /&gt;
* Admin tool to demonstrate how an element is rendered&lt;br /&gt;
* Plugins can register elements (or any kind of renderable/renderer method) to display in the element library tool&lt;br /&gt;
* The element library admin tool shows&lt;br /&gt;
** Developer notes about the element&lt;br /&gt;
** Sample output generated by the thing (supplied with dummy data)&lt;br /&gt;
** The list of renderables called when rendering the sample output&lt;br /&gt;
** An easy way to switch the language from LTR/RTL&lt;br /&gt;
* All the new core elements will be listed in this tool&lt;br /&gt;
* The tool renders using the current theme, so themers can use it to test their new themes&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
Documentation is one of the big things that will come from this work, one of the most important.&amp;lt;br /&amp;gt;&lt;br /&gt;
Even if we convert very little for 2.8 this will form the basis for all future output work.&lt;br /&gt;
&lt;br /&gt;
At present we have a significant lack of documentation, here we hope to properly document things.&lt;br /&gt;
We want to have:&lt;br /&gt;
* Style guides for CSS &amp;amp; HTML&lt;br /&gt;
* Renderer best practices and guides&lt;br /&gt;
* Writing element guides&lt;br /&gt;
&lt;br /&gt;
Many of these have already been started. See below for some bullet points.&lt;br /&gt;
&lt;br /&gt;
===Renderer best practices===&lt;br /&gt;
&lt;br /&gt;
A [[Renderer best practices]] document has been started to aid people in writing better renderers.&lt;br /&gt;
&lt;br /&gt;
To summarise some key ideas that have come through it:&lt;br /&gt;
* Where renderers live, especially now that we&#039;ve got autoloading and the output namespace available.&lt;br /&gt;
* What a good renderer is.&lt;br /&gt;
* What not to do in your renderer (and why perhaps?)&lt;br /&gt;
* The different styles of render methods (layout, translator, render, convenience)&lt;br /&gt;
&lt;br /&gt;
===Element HTML and CSS guidelines===&lt;br /&gt;
&lt;br /&gt;
An [[Element HTML and CSS guidelines]] document has been started outlining a style guide for writing HTML and CSS for elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Important to note that this document is not intended to be applied outside of elements at present. As we are hoping to move entirely towards elements one day this will be the HTML and CSS guide for Moodle. However it will not be enforced in current output, its use may be recommended.&lt;br /&gt;
&lt;br /&gt;
Key ideas in this document include:&lt;br /&gt;
* Where to put CSS&lt;br /&gt;
* Prefixing our id&#039;s a classes is being purposed.&lt;br /&gt;
* Introducing notation (based somewhat on BEM) for classes on elements.&lt;br /&gt;
* Structure and whitespace rules for writing CSS.&lt;br /&gt;
* Commenting for CSS.&lt;br /&gt;
* Grids in Moodle - thinking about choosing a specific grid format for core Moodle that can be theme independent but overridden by themes.&lt;br /&gt;
&lt;br /&gt;
===Guide to creating output elements===&lt;br /&gt;
&lt;br /&gt;
A document titled [[Guide to creating output elements]] has been written already on how to write an output element.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will aid us and others in writing consistent elements that conform to the ideals we have chosen.&lt;br /&gt;
&lt;br /&gt;
==Relevant links==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Docs pages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Output element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
* [[Element Library]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tracker issues&#039;&#039;&#039;&lt;br /&gt;
* MDL-45770 Stage 1 epic (see [[Render library specification]])&lt;br /&gt;
* MDL-45827 Spec the element library (see [[Element Library]])&lt;br /&gt;
* MDL-45828 Create the element library&lt;br /&gt;
* MDL-45829 Initial elements (see [[Output element planning]])&lt;br /&gt;
* MDL-45853 Document renderer best practices (see [[Renderer best practices]])&lt;br /&gt;
* MDL-45830 Document CSS style guide for elements (see [[Element HTML and CSS guidelines]])&lt;br /&gt;
* MDL-45885 Design and document elements (see [[Guide to creating output elements]])&lt;br /&gt;
* MDL-45854 Document JS and how it works with elements.&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45929</id>
		<title>User:Sam Hemelryk/Output 2.8 GDM reference</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45929"/>
		<updated>2014-07-22T12:33:01Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General developer meeting output summary==&lt;br /&gt;
&lt;br /&gt;
Is the start of a large movement to organise and improve output in Moodle.&lt;br /&gt;
&lt;br /&gt;
What we&#039;re going to be doing:&lt;br /&gt;
* Adoption + creation of elements.&lt;br /&gt;
* Addition of element library.&lt;br /&gt;
* Output documentation.&lt;br /&gt;
&lt;br /&gt;
What we are trying to achieve:&lt;br /&gt;
* Standardise output in Moodle so that interfaces are more consistent, accessible, usable and every other buzz word to describe would could be summed up as a good quality.&lt;br /&gt;
* Make Moodle much easier to style, with the ultimate goal of making it possible to apply any frontend framework to Moodle with much greater ease.&lt;br /&gt;
* Speed up the development of interfaces in Moodle by providing developers with a selection of ready to use elements.&lt;br /&gt;
* Speed up the styling of interfaces by providing tools to aid designers in viewing the available elements in their available states without having to discover them.&lt;br /&gt;
&lt;br /&gt;
==The specification==&lt;br /&gt;
&lt;br /&gt;
* The [[Render library specification]] is the spec document for these output changes.&lt;br /&gt;
* Covers the goals for this project, what problems we currently face, how we hope to solve them and achieve our goals, and the general guff of any specification.&lt;br /&gt;
* Links to all of the other things coming out from this specification, just like this page in fact.&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Forum discussion on the spec] to see how things have evolved.&lt;br /&gt;
&lt;br /&gt;
==The proposal prototype==&lt;br /&gt;
&lt;br /&gt;
There have been several iterations of prototypes now, the development of the specification and the discussion on the forum has been leading its changes.&lt;br /&gt;
The current prototype code can be found here:&lt;br /&gt;
&lt;br /&gt;
    Repository: git://github.com/samhemelryk/moodle.git&lt;br /&gt;
    Branch: output_proposal_5&lt;br /&gt;
    Diff URL: https://github.com/samhemelryk/moodle/compare/output_prototype_5~8...output_prototype_5&lt;br /&gt;
&lt;br /&gt;
What&#039;s worth noting about this proposal:&lt;br /&gt;
* It has implement atomic design, elements consisting of atoms, molecules and organisms are represented by classes.&lt;br /&gt;
* element classes are namespaced under output, e.g. core_output_atom, mod_foo_output_atom.&lt;br /&gt;
* element classes have common functionality (properties, attributes, and a prerender method for example).&lt;br /&gt;
* existing renderer structure has been left unchanged so if you&#039;re already familiar with renderers you&#039;ll have no troubles with this.&lt;br /&gt;
* There are three themes that have been added to show how this looks when we introduce different frameworks and make use of them.&lt;br /&gt;
&lt;br /&gt;
==Elements and Atomic design==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to run with Atomic Design, for those not familiar with it Brad Frost&#039;s article on [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic web design] explains it all.&lt;br /&gt;
&lt;br /&gt;
It basically is a break down of interfaces in module components, compartmentalising as you go so that when you create interfaces you can build the components (aka elements) back up into larger purposeful structures.&lt;br /&gt;
&lt;br /&gt;
There are five levels he defines:&lt;br /&gt;
* Atoms (e.g. button, input, action)&lt;br /&gt;
* Molecules (&lt;br /&gt;
* Organisms&lt;br /&gt;
* Templates&lt;br /&gt;
* Pages&lt;br /&gt;
&lt;br /&gt;
We plan to make use of all of these as follows:&lt;br /&gt;
* Atoms - dedicated classes.&lt;br /&gt;
* Molecules - dedicated classes.&lt;br /&gt;
* Organisms - dedicated classes.&lt;br /&gt;
* Templates - render methods for constructing what is on a page so that it can be overridden.&lt;br /&gt;
* Pages - theme layout files essentially.&lt;br /&gt;
&lt;br /&gt;
Important notes:&lt;br /&gt;
* Worth noting is that we won&#039;t have atom classes for absolutely everything, only those that make sense to create atom classes for.&lt;br /&gt;
* We will have an action atom, the action could be rendered as a button, a link, a form, whatever, can have JS actions.&lt;br /&gt;
* We&#039;ll have a special text atom that can be used to pass plain text through the render system and apply the goodness available to atoms when required.&lt;br /&gt;
&lt;br /&gt;
==The element library==&lt;br /&gt;
Tracker issue: MDL-45828&lt;br /&gt;
&lt;br /&gt;
* Admin tool to demonstrate how an element is rendered&lt;br /&gt;
* Plugins can register elements (or any kind of renderable/renderer method) to display in the element library tool&lt;br /&gt;
* The element library admin tool shows&lt;br /&gt;
** Developer notes about the element&lt;br /&gt;
** Sample output generated by the thing (supplied with dummy data)&lt;br /&gt;
** The list of renderables called when rendering the sample output&lt;br /&gt;
** An easy way to switch the language from LTR/RTL&lt;br /&gt;
* All the new core elements will be listed in this tool&lt;br /&gt;
* The tool renders using the current theme, so themers can use it to test their new themes&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
Documentation is one of the big things that will come from this work, one of the most important.&amp;lt;br /&amp;gt;&lt;br /&gt;
Even if we convert very little for 2.8 this will form the basis for all future output work.&lt;br /&gt;
&lt;br /&gt;
At present we have a significant lack of documentation, here we hope to properly document things.&lt;br /&gt;
We want to have:&lt;br /&gt;
* Style guides for CSS &amp;amp; HTML&lt;br /&gt;
* Renderer best practices and guides&lt;br /&gt;
* Writing element guides&lt;br /&gt;
&lt;br /&gt;
Many of these have already been started. See below for some bullet points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Renderer best practices===&lt;br /&gt;
&lt;br /&gt;
A [[Renderer best practices]] document has been started to aid people in writing better renderers.&lt;br /&gt;
&lt;br /&gt;
To summarise some key ideas that have come through it:&lt;br /&gt;
* Where renderers live, especially now that we&#039;ve got autoloading and the output namespace available.&lt;br /&gt;
* What a good renderer is.&lt;br /&gt;
* What not to do in your renderer (and why perhaps?)&lt;br /&gt;
* The different styles of render methods (layout, translator, render, convenience)&lt;br /&gt;
&lt;br /&gt;
===Element HTML and CSS guidelines===&lt;br /&gt;
&lt;br /&gt;
An [[Element HTML and CSS guidelines]] document has been started outlining a style guide for writing HTML and CSS for elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Important to note that this document is not intended to be applied outside of elements at present. As we are hoping to move entirely towards elements one day this will be the HTML and CSS guide for Moodle. However it will not be enforced in current output, its use may be recommended.&lt;br /&gt;
&lt;br /&gt;
Key ideas in this document include:&lt;br /&gt;
* Where to put CSS&lt;br /&gt;
* Prefixing our id&#039;s a classes is being purposed.&lt;br /&gt;
* Introducing notation (based somewhat on BEM) for classes on elements.&lt;br /&gt;
* Structure and whitespace rules for writing CSS.&lt;br /&gt;
* Commenting for CSS.&lt;br /&gt;
* Grids in Moodle - thinking about choosing a specific grid format for core Moodle that can be theme independent but overridden by themes.&lt;br /&gt;
&lt;br /&gt;
===Guide to creating output elements===&lt;br /&gt;
&lt;br /&gt;
A document titled [[Guide to creating output elements]] has been written already on how to write an output element.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will aid us and others in writing consistent elements that conform to the ideals we have chosen.&lt;br /&gt;
&lt;br /&gt;
==Relevant links==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Docs pages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Output element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
* [[Element Library]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tracker issues&#039;&#039;&#039;&lt;br /&gt;
* MDL-45770 Stage 1 epic (see [[Render library specification]])&lt;br /&gt;
* MDL-45827 Spec the element library (see [[Element Library]])&lt;br /&gt;
* MDL-45828 Create the element library&lt;br /&gt;
* MDL-45829 Initial elements (see [[Output element planning]])&lt;br /&gt;
* MDL-45853 Document renderer best practices (see [[Renderer best practices]])&lt;br /&gt;
* MDL-45830 Document CSS style guide for elements (see [[Element HTML and CSS guidelines]])&lt;br /&gt;
* MDL-45885 Design and document elements (see [[Guide to creating output elements]])&lt;br /&gt;
* MDL-45854 Document JS and how it works with elements.&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45925</id>
		<title>User:Sam Hemelryk/Output 2.8 GDM reference</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45925"/>
		<updated>2014-07-22T12:23:59Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Elements and Atomic design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General developer meeting output summary==&lt;br /&gt;
&lt;br /&gt;
Is the start of a large movement to organise and improve output in Moodle.&lt;br /&gt;
&lt;br /&gt;
What we&#039;re going to be doing:&lt;br /&gt;
* Adoption + creation of elements.&lt;br /&gt;
* Addition of element library.&lt;br /&gt;
* Output documentation.&lt;br /&gt;
&lt;br /&gt;
What we are trying to achieve:&lt;br /&gt;
* Standardise output in Moodle so that interfaces are more consistent, accessible, usable and every other buzz word to describe would could be summed up as a good quality.&lt;br /&gt;
* Make Moodle much easier to style, with the ultimate goal of making it possible to apply any frontend framework to Moodle with much greater ease.&lt;br /&gt;
* Speed up the development of interfaces in Moodle by providing developers with a selection of ready to use elements.&lt;br /&gt;
* Speed up the styling of interfaces by providing tools to aid designers in viewing the available elements in their available states without having to discover them.&lt;br /&gt;
&lt;br /&gt;
==The specification==&lt;br /&gt;
&lt;br /&gt;
* The [[Render library specification]] is the spec document for these output changes.&lt;br /&gt;
* Covers the goals for this project, what problems we currently face, how we hope to solve them and achieve our goals, and the general guff of any specification.&lt;br /&gt;
* Links to all of the other things coming out from this specification, just like this page in fact.&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Forum discussion on the spec] to see how things have evolved.&lt;br /&gt;
&lt;br /&gt;
==The proposal prototype==&lt;br /&gt;
&lt;br /&gt;
There have been several iterations of prototypes now, the development of the specification and the discussion on the forum has been leading its changes.&lt;br /&gt;
The current prototype code can be found here:&lt;br /&gt;
&lt;br /&gt;
    Repository: git://github.com/samhemelryk/moodle.git&lt;br /&gt;
    Branch: output_proposal_5&lt;br /&gt;
    Diff URL: https://github.com/samhemelryk/moodle/compare/output_prototype_5~8...output_prototype_5&lt;br /&gt;
&lt;br /&gt;
What&#039;s worth noting about this proposal:&lt;br /&gt;
* It has implement atomic design, elements consisting of atoms, molecules and organisms are represented by classes.&lt;br /&gt;
* element classes are namespaced under output, e.g. core_output_atom, mod_foo_output_atom.&lt;br /&gt;
* element classes have common functionality (properties, attributes, and a prerender method for example).&lt;br /&gt;
* existing renderer structure has been left unchanged so if you&#039;re already familiar with renderers you&#039;ll have no troubles with this.&lt;br /&gt;
* There are three themes that have been added to show how this looks when we introduce different frameworks and make use of them.&lt;br /&gt;
&lt;br /&gt;
==Elements and Atomic design==&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to run with Atomic Design, for those not familiar with it Brad Frost&#039;s article on [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic web design] explains it all.&lt;br /&gt;
&lt;br /&gt;
It basically is a break down of interfaces in module components, compartmentalising as you go so that when you create interfaces you can build the components (aka elements) back up into larger purposeful structures.&lt;br /&gt;
&lt;br /&gt;
There are five levels he defines:&lt;br /&gt;
* Atoms (e.g. button, input, action)&lt;br /&gt;
* Molecules (&lt;br /&gt;
* Organisms&lt;br /&gt;
* Templates&lt;br /&gt;
* Pages&lt;br /&gt;
&lt;br /&gt;
We plan to make use of all of these as follows:&lt;br /&gt;
* Atoms - dedicated classes.&lt;br /&gt;
* Molecules - dedicated classes.&lt;br /&gt;
* Organisms - dedicated classes.&lt;br /&gt;
* Templates - render methods for constructing what is on a page so that it can be overridden.&lt;br /&gt;
* Pages - theme layout files essentially.&lt;br /&gt;
&lt;br /&gt;
Important notes:&lt;br /&gt;
* Worth noting is that we won&#039;t have atom classes for absolutely everything, only those that make sense to create atom classes for.&lt;br /&gt;
* We will have an action atom, the action could be rendered as a button, a link, a form, whatever, can have JS actions.&lt;br /&gt;
* We&#039;ll have a special text atom that can be used to pass plain text through the render system and apply the goodness available to atoms when required.&lt;br /&gt;
&lt;br /&gt;
==The element library==&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Renderer best practices===&lt;br /&gt;
&lt;br /&gt;
A [[Renderer best practices]] document has been started to aid people in writing better renderers.&lt;br /&gt;
&lt;br /&gt;
To summarise some key ideas that have come through it:&lt;br /&gt;
&lt;br /&gt;
===Element HTML and CSS guidelines===&lt;br /&gt;
&lt;br /&gt;
An [[Element HTML and CSS guidelines]] document has been started outlining a style guide for writing HTML and CSS for elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Important to note that this document is not intended to be applied outside of elements at present. As we are hoping to move entirely towards elements one day this will be the HTML and CSS guide for Moodle. However it will not be enforced in current output, its use may be recommended.&lt;br /&gt;
&lt;br /&gt;
Key ideas in this document include:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Guide to creating output elements===&lt;br /&gt;
&lt;br /&gt;
A document titled [[Guide to creating output elements]] has been written already on how to write an output element.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will aid us and others in writing consistent elements that conform to the ideals we have chosen.&lt;br /&gt;
&lt;br /&gt;
==Relevant links==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Docs pages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Output element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
* [[Element Library]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tracker issues&#039;&#039;&#039;&lt;br /&gt;
* MDL-45770 Stage 1 epic (see [[Render library specification]])&lt;br /&gt;
* MDL-45827 Spec the element library (see [[Element Library]])&lt;br /&gt;
* MDL-45828 Create the element library&lt;br /&gt;
* MDL-45829 Initial elements (see [[Output element planning]])&lt;br /&gt;
* MDL-45853 Document renderer best practices (see [[Renderer best practices]])&lt;br /&gt;
* MDL-45830 Document CSS style guide for elements (see [[Element HTML and CSS guidelines]])&lt;br /&gt;
* MDL-45885 Design and document elements (see [[Guide to creating output elements]])&lt;br /&gt;
* MDL-45854 Document JS and how it works with elements.&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45924</id>
		<title>User:Sam Hemelryk/Output 2.8 GDM reference</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45924"/>
		<updated>2014-07-22T12:15:15Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* The specification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General developer meeting output summary==&lt;br /&gt;
&lt;br /&gt;
Is the start of a large movement to organise and improve output in Moodle.&lt;br /&gt;
&lt;br /&gt;
What we&#039;re going to be doing:&lt;br /&gt;
* Adoption + creation of elements.&lt;br /&gt;
* Addition of element library.&lt;br /&gt;
* Output documentation.&lt;br /&gt;
&lt;br /&gt;
What we are trying to achieve:&lt;br /&gt;
* Standardise output in Moodle so that interfaces are more consistent, accessible, usable and every other buzz word to describe would could be summed up as a good quality.&lt;br /&gt;
* Make Moodle much easier to style, with the ultimate goal of making it possible to apply any frontend framework to Moodle with much greater ease.&lt;br /&gt;
* Speed up the development of interfaces in Moodle by providing developers with a selection of ready to use elements.&lt;br /&gt;
* Speed up the styling of interfaces by providing tools to aid designers in viewing the available elements in their available states without having to discover them.&lt;br /&gt;
&lt;br /&gt;
==The specification==&lt;br /&gt;
&lt;br /&gt;
* The [[Render library specification]] is the spec document for these output changes.&lt;br /&gt;
* Covers the goals for this project, what problems we currently face, how we hope to solve them and achieve our goals, and the general guff of any specification.&lt;br /&gt;
* Links to all of the other things coming out from this specification, just like this page in fact.&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Forum discussion on the spec] to see how things have evolved.&lt;br /&gt;
&lt;br /&gt;
==The proposal prototype==&lt;br /&gt;
&lt;br /&gt;
There have been several iterations of prototypes now, the development of the specification and the discussion on the forum has been leading its changes.&lt;br /&gt;
The current prototype code can be found here:&lt;br /&gt;
&lt;br /&gt;
    Repository: git://github.com/samhemelryk/moodle.git&lt;br /&gt;
    Branch: output_proposal_5&lt;br /&gt;
    Diff URL: https://github.com/samhemelryk/moodle/compare/output_prototype_5~8...output_prototype_5&lt;br /&gt;
&lt;br /&gt;
What&#039;s worth noting about this proposal:&lt;br /&gt;
* It has implement atomic design, elements consisting of atoms, molecules and organisms are represented by classes.&lt;br /&gt;
* element classes are namespaced under output, e.g. core_output_atom, mod_foo_output_atom.&lt;br /&gt;
* element classes have common functionality (properties, attributes, and a prerender method for example).&lt;br /&gt;
* existing renderer structure has been left unchanged so if you&#039;re already familiar with renderers you&#039;ll have no troubles with this.&lt;br /&gt;
* There are three themes that have been added to show how this looks when we introduce different frameworks and make use of them.&lt;br /&gt;
&lt;br /&gt;
==Elements and Atomic design==&lt;br /&gt;
==The element library==&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Renderer best practices===&lt;br /&gt;
&lt;br /&gt;
A [[Renderer best practices]] document has been started to aid people in writing better renderers.&lt;br /&gt;
&lt;br /&gt;
To summarise some key ideas that have come through it:&lt;br /&gt;
&lt;br /&gt;
===Element HTML and CSS guidelines===&lt;br /&gt;
&lt;br /&gt;
An [[Element HTML and CSS guidelines]] document has been started outlining a style guide for writing HTML and CSS for elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Important to note that this document is not intended to be applied outside of elements at present. As we are hoping to move entirely towards elements one day this will be the HTML and CSS guide for Moodle. However it will not be enforced in current output, its use may be recommended.&lt;br /&gt;
&lt;br /&gt;
Key ideas in this document include:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Guide to creating output elements===&lt;br /&gt;
&lt;br /&gt;
A document titled [[Guide to creating output elements]] has been written already on how to write an output element.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will aid us and others in writing consistent elements that conform to the ideals we have chosen.&lt;br /&gt;
&lt;br /&gt;
==Relevant links==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Docs pages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Output element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
* [[Element Library]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tracker issues&#039;&#039;&#039;&lt;br /&gt;
* MDL-45770 Stage 1 epic (see [[Render library specification]])&lt;br /&gt;
* MDL-45827 Spec the element library (see [[Element Library]])&lt;br /&gt;
* MDL-45828 Create the element library&lt;br /&gt;
* MDL-45829 Initial elements (see [[Output element planning]])&lt;br /&gt;
* MDL-45853 Document renderer best practices (see [[Renderer best practices]])&lt;br /&gt;
* MDL-45830 Document CSS style guide for elements (see [[Element HTML and CSS guidelines]])&lt;br /&gt;
* MDL-45885 Design and document elements (see [[Guide to creating output elements]])&lt;br /&gt;
* MDL-45854 Document JS and how it works with elements.&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45923</id>
		<title>User:Sam Hemelryk/Output 2.8 GDM reference</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45923"/>
		<updated>2014-07-22T12:07:39Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* The specification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General developer meeting output summary==&lt;br /&gt;
&lt;br /&gt;
Is the start of a large movement to organise and improve output in Moodle.&lt;br /&gt;
&lt;br /&gt;
What we&#039;re going to be doing:&lt;br /&gt;
* Adoption + creation of elements.&lt;br /&gt;
* Addition of element library.&lt;br /&gt;
* Output documentation.&lt;br /&gt;
&lt;br /&gt;
What we are trying to achieve:&lt;br /&gt;
* Standardise output in Moodle so that interfaces are more consistent, accessible, usable and every other buzz word to describe would could be summed up as a good quality.&lt;br /&gt;
* Make Moodle much easier to style, with the ultimate goal of making it possible to apply any frontend framework to Moodle with much greater ease.&lt;br /&gt;
* Speed up the development of interfaces in Moodle by providing developers with a selection of ready to use elements.&lt;br /&gt;
* Speed up the styling of interfaces by providing tools to aid designers in viewing the available elements in their available states without having to discover them.&lt;br /&gt;
&lt;br /&gt;
==The specification==&lt;br /&gt;
&lt;br /&gt;
* The [[Render library specification]] is the spec document for these output changes.&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Forum discussion on the spec] to see how things have evolved.&lt;br /&gt;
* Covers the goals for this project, what problems we currently face, how we hope to solve them and achieve our goals, and the general guff of any specification.&lt;br /&gt;
* Links to all of the other things coming out from this specification, just like this page in fact.&lt;br /&gt;
&lt;br /&gt;
==Elements and Atomic design==&lt;br /&gt;
==The element library==&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Renderer best practices===&lt;br /&gt;
&lt;br /&gt;
A [[Renderer best practices]] document has been started to aid people in writing better renderers.&lt;br /&gt;
&lt;br /&gt;
To summarise some key ideas that have come through it:&lt;br /&gt;
&lt;br /&gt;
===Element HTML and CSS guidelines===&lt;br /&gt;
&lt;br /&gt;
An [[Element HTML and CSS guidelines]] document has been started outlining a style guide for writing HTML and CSS for elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Important to note that this document is not intended to be applied outside of elements at present. As we are hoping to move entirely towards elements one day this will be the HTML and CSS guide for Moodle. However it will not be enforced in current output, its use may be recommended.&lt;br /&gt;
&lt;br /&gt;
Key ideas in this document include:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Guide to creating output elements===&lt;br /&gt;
&lt;br /&gt;
A document titled [[Guide to creating output elements]] has been written already on how to write an output element.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will aid us and others in writing consistent elements that conform to the ideals we have chosen.&lt;br /&gt;
&lt;br /&gt;
==Relevant links==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Docs pages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Output element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
* [[Element Library]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tracker issues&#039;&#039;&#039;&lt;br /&gt;
* MDL-45770 Stage 1 epic (see [[Render library specification]])&lt;br /&gt;
* MDL-45827 Spec the element library (see [[Element Library]])&lt;br /&gt;
* MDL-45828 Create the element library&lt;br /&gt;
* MDL-45829 Initial elements (see [[Output element planning]])&lt;br /&gt;
* MDL-45853 Document renderer best practices (see [[Renderer best practices]])&lt;br /&gt;
* MDL-45830 Document CSS style guide for elements (see [[Element HTML and CSS guidelines]])&lt;br /&gt;
* MDL-45885 Design and document elements (see [[Guide to creating output elements]])&lt;br /&gt;
* MDL-45854 Document JS and how it works with elements.&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45922</id>
		<title>User:Sam Hemelryk/Output 2.8 GDM reference</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45922"/>
		<updated>2014-07-22T12:05:10Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* General developer meeting output summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General developer meeting output summary==&lt;br /&gt;
&lt;br /&gt;
Is the start of a large movement to organise and improve output in Moodle.&lt;br /&gt;
&lt;br /&gt;
What we&#039;re going to be doing:&lt;br /&gt;
* Adoption + creation of elements.&lt;br /&gt;
* Addition of element library.&lt;br /&gt;
* Output documentation.&lt;br /&gt;
&lt;br /&gt;
What we are trying to achieve:&lt;br /&gt;
* Standardise output in Moodle so that interfaces are more consistent, accessible, usable and every other buzz word to describe would could be summed up as a good quality.&lt;br /&gt;
* Make Moodle much easier to style, with the ultimate goal of making it possible to apply any frontend framework to Moodle with much greater ease.&lt;br /&gt;
* Speed up the development of interfaces in Moodle by providing developers with a selection of ready to use elements.&lt;br /&gt;
* Speed up the styling of interfaces by providing tools to aid designers in viewing the available elements in their available states without having to discover them.&lt;br /&gt;
&lt;br /&gt;
==The specification==&lt;br /&gt;
&lt;br /&gt;
* The [[Render library specification]] is the spec document for these output changes.&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Forum discussion on the spec] to see how things have evolved.&lt;br /&gt;
&lt;br /&gt;
==Elements and Atomic design==&lt;br /&gt;
==The element library==&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Renderer best practices===&lt;br /&gt;
&lt;br /&gt;
A [[Renderer best practices]] document has been started to aid people in writing better renderers.&lt;br /&gt;
&lt;br /&gt;
To summarise some key ideas that have come through it:&lt;br /&gt;
&lt;br /&gt;
===Element HTML and CSS guidelines===&lt;br /&gt;
&lt;br /&gt;
An [[Element HTML and CSS guidelines]] document has been started outlining a style guide for writing HTML and CSS for elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Important to note that this document is not intended to be applied outside of elements at present. As we are hoping to move entirely towards elements one day this will be the HTML and CSS guide for Moodle. However it will not be enforced in current output, its use may be recommended.&lt;br /&gt;
&lt;br /&gt;
Key ideas in this document include:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Guide to creating output elements===&lt;br /&gt;
&lt;br /&gt;
A document titled [[Guide to creating output elements]] has been written already on how to write an output element.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will aid us and others in writing consistent elements that conform to the ideals we have chosen.&lt;br /&gt;
&lt;br /&gt;
==Relevant links==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Docs pages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Output element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
* [[Element Library]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tracker issues&#039;&#039;&#039;&lt;br /&gt;
* MDL-45770 Stage 1 epic (see [[Render library specification]])&lt;br /&gt;
* MDL-45827 Spec the element library (see [[Element Library]])&lt;br /&gt;
* MDL-45828 Create the element library&lt;br /&gt;
* MDL-45829 Initial elements (see [[Output element planning]])&lt;br /&gt;
* MDL-45853 Document renderer best practices (see [[Renderer best practices]])&lt;br /&gt;
* MDL-45830 Document CSS style guide for elements (see [[Element HTML and CSS guidelines]])&lt;br /&gt;
* MDL-45885 Design and document elements (see [[Guide to creating output elements]])&lt;br /&gt;
* MDL-45854 Document JS and how it works with elements.&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45921</id>
		<title>User:Sam Hemelryk/Output 2.8 GDM reference</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45921"/>
		<updated>2014-07-22T11:56:54Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General developer meeting output summary==&lt;br /&gt;
&lt;br /&gt;
Is the start of a large movement to organise and improve output in Moodle.&lt;br /&gt;
&lt;br /&gt;
Overall project goals:&lt;br /&gt;
# Adoption + creation of elements.&lt;br /&gt;
# Addition of element library.&lt;br /&gt;
# Output documentation.&lt;br /&gt;
&lt;br /&gt;
==The specification==&lt;br /&gt;
&lt;br /&gt;
* The [[Render library specification]] is the spec document for these output changes.&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Forum discussion on the spec] to see how things have evolved.&lt;br /&gt;
&lt;br /&gt;
==Elements and Atomic design==&lt;br /&gt;
==The element library==&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Renderer best practices===&lt;br /&gt;
&lt;br /&gt;
A [[Renderer best practices]] document has been started to aid people in writing better renderers.&lt;br /&gt;
&lt;br /&gt;
To summarise some key ideas that have come through it:&lt;br /&gt;
&lt;br /&gt;
===Element HTML and CSS guidelines===&lt;br /&gt;
&lt;br /&gt;
An [[Element HTML and CSS guidelines]] document has been started outlining a style guide for writing HTML and CSS for elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Important to note that this document is not intended to be applied outside of elements at present. As we are hoping to move entirely towards elements one day this will be the HTML and CSS guide for Moodle. However it will not be enforced in current output, its use may be recommended.&lt;br /&gt;
&lt;br /&gt;
Key ideas in this document include:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Guide to creating output elements===&lt;br /&gt;
&lt;br /&gt;
A document titled [[Guide to creating output elements]] has been written already on how to write an output element.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will aid us and others in writing consistent elements that conform to the ideals we have chosen.&lt;br /&gt;
&lt;br /&gt;
==Relevant links==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Docs pages&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Output element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
* [[Element Library]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tracker issues&#039;&#039;&#039;&lt;br /&gt;
* MDL-45770 Stage 1 epic (see [[Render library specification]])&lt;br /&gt;
* MDL-45827 Spec the element library (see [[Element Library]])&lt;br /&gt;
* MDL-45828 Create the element library&lt;br /&gt;
* MDL-45829 Initial elements (see [[Output element planning]])&lt;br /&gt;
* MDL-45853 Document renderer best practices (see [[Renderer best practices]])&lt;br /&gt;
* MDL-45830 Document CSS style guide for elements (see [[Element HTML and CSS guidelines]])&lt;br /&gt;
* MDL-45885 Design and document elements (see [[Guide to creating output elements]])&lt;br /&gt;
* MDL-45854 Document JS and how it works with elements.&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45920</id>
		<title>User:Sam Hemelryk/Output 2.8 GDM reference</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Output_2.8_GDM_reference&amp;diff=45920"/>
		<updated>2014-07-22T11:45:52Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: Created page with &amp;quot;==General developer meeting output summary==  Is the start of a large movement to organise and improve output in Moodle.  Overall project goals: # Output documentation. # Adop...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==General developer meeting output summary==&lt;br /&gt;
&lt;br /&gt;
Is the start of a large movement to organise and improve output in Moodle.&lt;br /&gt;
&lt;br /&gt;
Overall project goals:&lt;br /&gt;
# Output documentation.&lt;br /&gt;
# Adoption + creation of elements.&lt;br /&gt;
# Addition of element library.&lt;br /&gt;
&lt;br /&gt;
==Documentation==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The specification==&lt;br /&gt;
&lt;br /&gt;
* The [[Render library specification]] is the spec document for these output changes.&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Forum discussion on the spec] to see how things have evolved.&lt;br /&gt;
&lt;br /&gt;
==Renderer best practices==&lt;br /&gt;
&lt;br /&gt;
A [[Renderer best practices]] document has been started to aid people in writing better renderers.&lt;br /&gt;
&lt;br /&gt;
To summarise some key ideas that have come through it:&lt;br /&gt;
&lt;br /&gt;
==Element HTML and CSS guidelines==&lt;br /&gt;
&lt;br /&gt;
An [[Element HTML and CSS guidelines]] document has been started outlining a style guide for writing HTML and CSS for elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Important to note that this document is not intended to be applied outside of elements at present. As we are hoping to move entirely towards elements one day this will be the HTML and CSS guide for Moodle. However it will not be enforced in current output, its use may be recommended.&lt;br /&gt;
&lt;br /&gt;
Key ideas in this document include:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Guide to creating output elements==&lt;br /&gt;
&lt;br /&gt;
A document has been written already on how to write an output element.&amp;lt;br /&amp;gt;&lt;br /&gt;
This will aid us and others in writing consistent elements that conform to the ideals we have chosen.&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk&amp;diff=45919</id>
		<title>User:Sam Hemelryk</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk&amp;diff=45919"/>
		<updated>2014-07-22T11:45:34Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hello, I am a senior developer at Moodle and have been with the project since the June 2009.&lt;br /&gt;
&lt;br /&gt;
For those interested I have written a tutorial on my Moodle development process with Git: [[User:Sam_Hemelryk/My_Moodle_Git_workflow]]&lt;br /&gt;
&lt;br /&gt;
A short list of documents I have created:&lt;br /&gt;
&lt;br /&gt;
* [[Themes 2.0]]&lt;br /&gt;
* [[Themes 2.0 creating your first theme]] - A quick step by step guide to creating your first theme.&lt;br /&gt;
* [[Themes 2.0 overriding a renderer]] - A tutorial on creating a custom renderer and changing the HTML Moodle produces.&lt;br /&gt;
* [[Themes 2.0 How to use images within your theme]] - Explains how to use and override images within your theme.&lt;br /&gt;
* [[Themes 2.0 adding a settings page]] - Looks at how to add a setting page making your theme easily customisable.&lt;br /&gt;
* [[Themes 2.0 extending the custom menu]] - Customising the custom menu.&lt;br /&gt;
* [[Themes 2.0 adding courses and categories to the custom menu]] - Extending the custom menu further adding all categories + courses&lt;br /&gt;
* [[Themes 2.0 how to make the dock horizontal]] - Modifying the dock to make it horizontal.&lt;br /&gt;
* [[Themes 2.0 adding upgrade code]]&lt;br /&gt;
* [[Styling and customising the dock]] - How to style and customise the dock.&lt;br /&gt;
* [[Using jQuery with Moodle 2.0]]&lt;br /&gt;
* [[The Moodle Universal Cache (MUC)]] &#039;&#039;originally written at [[User:Sam_Hemelryk/MUC_proposal]]&#039;&#039;&lt;br /&gt;
* [https://docs.moodle.org/27/en/Caching Caching] &#039;&#039;originally written at [[User:Sam_Hemelryk/Caching]]&#039;&#039;&lt;br /&gt;
* [https://docs.moodle.org/27/en/Cache_definitions Cache definitions] &#039;&#039;originally written at [[User:Sam Hemelryk/Cache definitions]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output in Moodle 2.8&#039;&#039;&#039;&lt;br /&gt;
* [[Output_element_planning]] &#039;&#039;originally written at [[User:Sam Hemelryk/Render library element planning]]&#039;&#039;&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[Renderer best practices]] &#039;&#039;originally written at [[User:Sam Hemelryk/Renderer best practices]]&#039;&#039;&lt;br /&gt;
* [[Element HTML and CSS guidelines]] &#039;&#039;originally written at [[User:Sam Hemelryk/CSS style guidelines]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Output 2.8 GDM reference]] &#039;&#039;reference notes on the output to be talked about at the General Developer Meeting July 2014&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk&amp;diff=45918</id>
		<title>User:Sam Hemelryk</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk&amp;diff=45918"/>
		<updated>2014-07-22T11:44:26Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hello, I am a senior developer at Moodle and have been with the project since the June 2009.&lt;br /&gt;
&lt;br /&gt;
For those interested I have written a tutorial on my Moodle development process with Git: [[User:Sam_Hemelryk/My_Moodle_Git_workflow]]&lt;br /&gt;
&lt;br /&gt;
A short list of documents I have created:&lt;br /&gt;
&lt;br /&gt;
* [[Themes 2.0]]&lt;br /&gt;
* [[Themes 2.0 creating your first theme]] - A quick step by step guide to creating your first theme.&lt;br /&gt;
* [[Themes 2.0 overriding a renderer]] - A tutorial on creating a custom renderer and changing the HTML Moodle produces.&lt;br /&gt;
* [[Themes 2.0 How to use images within your theme]] - Explains how to use and override images within your theme.&lt;br /&gt;
* [[Themes 2.0 adding a settings page]] - Looks at how to add a setting page making your theme easily customisable.&lt;br /&gt;
* [[Themes 2.0 extending the custom menu]] - Customising the custom menu.&lt;br /&gt;
* [[Themes 2.0 adding courses and categories to the custom menu]] - Extending the custom menu further adding all categories + courses&lt;br /&gt;
* [[Themes 2.0 how to make the dock horizontal]] - Modifying the dock to make it horizontal.&lt;br /&gt;
* [[Themes 2.0 adding upgrade code]]&lt;br /&gt;
* [[Styling and customising the dock]] - How to style and customise the dock.&lt;br /&gt;
* [[Using jQuery with Moodle 2.0]]&lt;br /&gt;
* [[The Moodle Universal Cache (MUC)]] &#039;&#039;originally written at [[User:Sam_Hemelryk/MUC_proposal]]&#039;&#039;&lt;br /&gt;
* [https://docs.moodle.org/27/en/Caching Caching] &#039;&#039;originally written at [[User:Sam_Hemelryk/Caching]]&#039;&#039;&lt;br /&gt;
* [https://docs.moodle.org/27/en/Cache_definitions Cache definitions] &#039;&#039;originally written at [[User:Sam Hemelryk/Cache definitions]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output in Moodle 2.8&#039;&#039;&#039;&lt;br /&gt;
* [[Output_element_planning]] &#039;&#039;originally written at [[User:Sam Hemelryk/Render library element planning]]&#039;&#039;&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[Renderer best practices]] &#039;&#039;originally written at [[User:Sam Hemelryk/Renderer best practices]]&#039;&#039;&lt;br /&gt;
* [[Element HTML and CSS guidelines]] &#039;&#039;originally written at [[User:Sam Hemelryk/CSS style guidelines]]&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Guide_to_creating_output_elements&amp;diff=45917</id>
		<title>Guide to creating output elements</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Guide_to_creating_output_elements&amp;diff=45917"/>
		<updated>2014-07-22T11:42:06Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45885&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
A guide to writing output elements and the render methods for them.&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
Don&#039;t worry if you don&#039;t understand these yet, this document is going to explain them.&lt;br /&gt;
However for the sake of providing a quick understanding of some of the terminology used in output here it is:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Atom&#039;&#039;&#039; A simple building block, think of it like a HTML tag as that is what it is in many cases.&lt;br /&gt;
* &#039;&#039;&#039;Molecule&#039;&#039;&#039; A collection of atoms combined together to serve a single purpose or offer a single interaction.&lt;br /&gt;
* &#039;&#039;&#039;Organism&#039;&#039;&#039; A collection of molecules and atoms combined together to form a part of the user interface, serving one or more related purposes.&lt;br /&gt;
* &#039;&#039;&#039;Element&#039;&#039;&#039; An element is an meta concept for the above, when we talk about elements we talk about one of or more of atoms, molecules, and organisms. &lt;br /&gt;
* &#039;&#039;&#039;Subelement &#039;&#039;&#039; When we speak of subelements we are talking about the smaller elements that are going to be of a larger element. e.g the molecules that are present in an organism.&lt;br /&gt;
* &#039;&#039;&#039;Renderable&#039;&#039;&#039; Used to mark the object as something that can be converted into output.&lt;br /&gt;
&lt;br /&gt;
==Understanding output in Moodle==&lt;br /&gt;
&lt;br /&gt;
In 2.8 the direction of output in Moodle was changed, or more accurately re-organised.&amp;lt;br /&amp;gt;&lt;br /&gt;
Most Moodle sites out there use a third party theme, or have a had a theme created for them. We can assume that themes are the most widely created plugin within Moodle.&lt;br /&gt;
They deal with the design of the site, and design by nature is a moving, shifting, trending, fluid.&amp;lt;br /&amp;gt;&lt;br /&gt;
How Moodle produces its look need to be flexible enough to cater to current trends, requirements such as usability and accessibility, be able to keep up with trends, and cater to personal tastes.&amp;lt;br /&amp;gt;&lt;br /&gt;
We&#039;ve long had renderers now that allow us to cater to this flexibility, however as Moodle has grown so has its interfaces. There are more interfaces, more controls, more possible interactions.&amp;lt;br /&amp;gt;&lt;br /&gt;
The move in 2.8 was to bring organisation to what was being done, to bring consistency to the party and the make this flexible a manageable possibility by having an organised set of elements to style rather than an endless array of interfaces and unique parts.&lt;br /&gt;
&lt;br /&gt;
The goals for the output project were:&lt;br /&gt;
* Add an element library to Moodle (A page in Moodle listing all of the renderables and how they look in the current theme).&lt;br /&gt;
* Add a complete set of core renderables that should be capable of completely rendering every new user interface.&lt;br /&gt;
* Update the Output API documentation.&lt;br /&gt;
* Create a output guide documentation including best practices.&lt;br /&gt;
&lt;br /&gt;
All of this leans towards making Moodle framework agnostic, so that any frontend framework can be applied to Moodle with as little work as possible.&lt;br /&gt;
&lt;br /&gt;
After reflection and research the decision to use a style of Atomic Design was made. Atomic Design is as you will come to understand later a compartmentalisation approach to interface design that facilitates simplicity and re-use.&lt;br /&gt;
&lt;br /&gt;
===Atomic Design, Renderables and Moodle===&lt;br /&gt;
&lt;br /&gt;
Renderables have been around for a long time now, they were one of the initial preferred means of creating reusable output components.&amp;lt;br /&amp;gt;&lt;br /&gt;
As of Moodle 2.8 there is a new kid on the block, Elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Elements within Moodle is based upon the Atomic Design principles outlined by Brad Frost in his [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic Design blog post] and can be one of three distinct types in Moodle, they are either Atoms, Molecules, or Organisms.&amp;lt;br /&amp;gt;&lt;br /&gt;
These elements are within Moodle actually renderables by inheritance, all elements (atoms, molecules, and organisms) must have an associated render method to produce HTML, but more on that later.&lt;br /&gt;
&lt;br /&gt;
Lets look at the three types of elements within Moodle.&lt;br /&gt;
&lt;br /&gt;
====Atoms====&lt;br /&gt;
&lt;br /&gt;
Atoms are the smallest part of the puzzle. Easily understood as HTML elements, an image, a table, list etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
Individually they offer very little, but are essential as they are what all larger things are built out of.&lt;br /&gt;
&lt;br /&gt;
Simply - Atoms don&#039;t serve any explicit purpose nor do they provide any interaction, they are just building blocks.&lt;br /&gt;
&lt;br /&gt;
====Molecules====&lt;br /&gt;
&lt;br /&gt;
Molecules are the combination of atoms into structures that begin to form part of the picture.&amp;lt;br /&amp;gt;&lt;br /&gt;
Atoms by themselves aren&#039;t useful, but by sticking a few of them together we create a molecule.&amp;lt;br /&amp;gt;&lt;br /&gt;
Think of molecules as simple objects that the user can interact with for a single purpose, a login prompt (title + two inputs + a button), a search form (title + input + button), or a menu (several links).&lt;br /&gt;
&lt;br /&gt;
Simply - Molecules provide a single interaction or purpose. They are constructed of Atoms only.&lt;br /&gt;
&lt;br /&gt;
====Organisms====&lt;br /&gt;
&lt;br /&gt;
Organisms make things interesting, the are more complex than molecules but not so clearly differentiated.&amp;lt;br /&amp;gt;&lt;br /&gt;
An organism is a construct of molecules that when combined together form a distinct part of an interface.&amp;lt;br /&amp;gt;&lt;br /&gt;
They tend to both interesting, and obviously more than a molecule.&amp;lt;br /&amp;gt;&lt;br /&gt;
The following are examples of molecules:&lt;br /&gt;
* A navigation bar containing a title, some navigation, and a user picture.&lt;br /&gt;
* A user content block (like a forum post) containing a user picture, a title, some content, and a date.&lt;br /&gt;
* A Moodle block containing a header, some actions, content, and a footer.&lt;br /&gt;
&lt;br /&gt;
Simple - Organisms can group several purposes or interactions into one related structure. They are constructed of Molecules.&lt;br /&gt;
&lt;br /&gt;
====What about templates and pages?====&lt;br /&gt;
&lt;br /&gt;
Atomic Design defines two additional compartmentalisations, templates and pages.&amp;lt;br /&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Templates&#039;&#039;&#039; it states are the grouping of predominantly organisms into a structure, think of it like a layout. It is organisation without content.&amp;lt;br /&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Pages&#039;&#039;&#039; are specific instances of the above templates, loaded with content as the user would see them.&lt;br /&gt;
&lt;br /&gt;
In regards to Moodle neither of these two ideas is explicitly dealt with, both ideas however are already partly included in Moodle in the form of theme layouts and current renderers.&amp;lt;br /&amp;gt;&lt;br /&gt;
Pages are a direct match to this approach, content in Moodle is dynamic and those layouts are where the output and content is joined.&amp;lt;br /&amp;gt;&lt;br /&gt;
Templates on the other hand are partly covered by layouts (for the page as a whole), and partly covered by renderers.&lt;br /&gt;
&lt;br /&gt;
Renderers form part of that picture because it is within a script that things are assembled.&amp;lt;br /&amp;gt;&lt;br /&gt;
Again as of Moodle 2.8 with the work on output a best practices guide for renderers has been written which will outline how best to write renderers to match our chosen approach and why they should be written as such.&lt;br /&gt;
&lt;br /&gt;
===How we made this fit within the Moodle dodecahedron===&lt;br /&gt;
&lt;br /&gt;
Within Moodle we&#039;ve decided to use the terminology from the Atomic Design approach. As discussed above templates and pages are not explicitly handled within Moodle, however atoms, molecules, and organisms are.&amp;lt;br /&amp;gt;&lt;br /&gt;
Class auto-loading has being used, and as these things belong to the Output API they have been organised by namespace under classes/output.&lt;br /&gt;
&lt;br /&gt;
The following are the base structures:&lt;br /&gt;
&lt;br /&gt;
; core\output\element implements renderable : This is the absolute bottom unit, it can only be utilised by the core Output API. It contains basic functionality to all atoms, molecules and organisms.&lt;br /&gt;
; core\output\atom extends element : This matches the Atomic Design atom concept. It is a basic building block often equating to just a single HTML tag.&amp;lt;br /&amp;gt;Within Moodle we don&#039;t created atom classes for each HTML tag. That approach was considered but the clutter, the classes it would introduce, and the render methods for those classes was deemed to outweigh the advantages having them would provide. Instead in many cases our smallest &amp;quot;renderable&amp;quot; element will be the molecule.&lt;br /&gt;
; core\output\molecule extends element : This matches the Atomic Design molecule concept. It serves a single purpose/interaction and can consist of atoms (as properties) but because we don&#039;t have classes/objects for every atom can also in some situations contain no atom objects at all.&lt;br /&gt;
; core\output\organism extends element : This matches the Atomic Design organism concept. It is a collection of other molecules and atoms, and can have serve several purposes and/or interactions that have all being grouped under a single umbrella, this organism.&lt;br /&gt;
&lt;br /&gt;
All of these base structure are abstract and cannot be directly instantiated. Instead actual atoms, molecules, and organisms must derive from one of atom, molecule, or organism.&amp;lt;rb /&amp;gt;&lt;br /&gt;
The element class is deemed to be internal to the Output API and therefore cannot be extended outside of the core Output API (at least the integrators won&#039;t accept it).&lt;br /&gt;
&lt;br /&gt;
===The importance of inheritance in rendering===&lt;br /&gt;
&lt;br /&gt;
By now you have a good picture of how we&#039;ve organised output in Moodle in 2.8.&amp;lt;br /&amp;gt;&lt;br /&gt;
What is left to discuss is the importance of this hierarchy and its impact on how we produce output in renderers.&lt;br /&gt;
&lt;br /&gt;
We know that Atoms form Molecules, which in turn form Organisms.&amp;lt;br /&amp;gt;&lt;br /&gt;
We try to apply this same inheritance within our renderers so that when you render an organism we start by producing the encompassing structure, then for each of the molecules that make it up we render on each. This passes the molecule to its own render method to produce the molecule. The same goes for the molecules that contain atoms, we produce the structure for the molecule and call render on each atom at the appropriate time for the structure.&amp;lt;br /&amp;gt;&lt;br /&gt;
Through this means there should in the perfect world scenario be one way to render each organism, molecule, and atom. Thus when a theme designer wishes to change how the search molecule looks for instance they need only change the render method for that one molecule, and every place that molecule is used, either stand alone or as part of a larger organism will be updated at the same time.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, with the present state of Moodle themes this idea of having the minimal possible render methods to produce the most consistent output is but a pipe-dream.&amp;lt;br /&amp;gt;&lt;br /&gt;
However as time goes on that will slowly correct itself, as more of Moodle is converted and themes begin to develop with this new approach.&amp;lt;br /&amp;gt;&lt;br /&gt;
For the time being the consistency that having a specific set of elements and the organisation of those elements is going to be a big win.&lt;br /&gt;
&lt;br /&gt;
==The element library==&lt;br /&gt;
&lt;br /&gt;
Hopefully you are already familiar with the element library in Moodle; if not then you really should take a look at it and get to understand what is it doing.&lt;br /&gt;
&lt;br /&gt;
The element library is a very important piece in the puzzle that is Output within Moodle.&amp;lt;br /&amp;gt;&lt;br /&gt;
It shows how an element looks in one or more scenarios, the scenarios usually revolving around varying contents.&lt;br /&gt;
&lt;br /&gt;
==Designing and writing an element==&lt;br /&gt;
&lt;br /&gt;
A step by step approach to working through the creation and rendering of an element so that it meets the Output standards for Moodle.&amp;lt;br /&amp;gt;&lt;br /&gt;
If you want a quick overview of what to do have a look at the [[#Peer-review checklist|peer-review checklist]] in the next section&lt;br /&gt;
&lt;br /&gt;
===Step 1: Are you sure you need to create an element===&lt;br /&gt;
We want Moodle to contain a limited number of elements. The problem that existed before this work was that every bit of code was creating its own output, and we do not want to end up back there.&lt;br /&gt;
&lt;br /&gt;
The very first thing to do is to be absolutely sure that you need to create this element.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Atoms and molecules&#039;&#039;&#039;&lt;br /&gt;
After the initial release this should be rare. It should be especially rare that you need to write an atom or molecule for a plugin.&amp;lt;br /&amp;gt;&lt;br /&gt;
Moodle should provide 95% of the atoms and molecules you could ever need. However if you have something that is truly new and unique in some way then perhaps indeed you do need to write an element.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Organisms&#039;&#039;&#039;&lt;br /&gt;
Writing an organism is going to be a common requirement. Within core there may be a finite number of organisms, only increasing as new Moodle elements are created and new interfaces added. However when creating plugins or updating output in existing plugins it is very likely that new organisms will be created. If you have an interface in a plugin that is somehow unique to that plugin then you have a organism.&lt;br /&gt;
&lt;br /&gt;
In both cases it is important that you search through the elements already in Moodle and see if there are any that meet your needs.&amp;lt;br /&amp;gt;&lt;br /&gt;
If there is something close in Moodle core already then perhaps you need to adjust your design to make use of the existing element rather than introducing something similar but slightly different.&amp;lt;br /&amp;gt;&lt;br /&gt;
If you find an element you could use in a core plugin then you should create an issue in our Tracker and request that the element be moved from the plugin to core.&amp;lt;br /&amp;gt;&lt;br /&gt;
Then for the time being copy the element from the plugin you found it in, into your plugin. This way it will look consistent, you can use it and if it does get accepted into core you don&#039;t have to change anything about how you use it.&lt;br /&gt;
&lt;br /&gt;
===Step 2: Define the element===&lt;br /&gt;
&lt;br /&gt;
It very important to be sure of what you want to create.&lt;br /&gt;
&lt;br /&gt;
The first thing to do is to work out what is it going to be, is it an atom, a molecule, or an organism?&amp;lt;br /&amp;gt;&lt;br /&gt;
Remember the following, they describe each of those in a single sentence:&lt;br /&gt;
; Atom : A basic building block that severs no purpose or interaction.&lt;br /&gt;
; Molecule :  Serves just a single purpose OR interaction, not usually a part of an interface by itself, grouped with other molecules and atoms to form an organism. &lt;br /&gt;
; Organism : A part of the interface, it is constructed of molecules and atoms, it can facilitate several like purposes and interactions&lt;br /&gt;
&lt;br /&gt;
It should be possible to create a flow chart to aid this decisions, unfortunately one has not being created yet.&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve decided what type of element it is going to be you are ready to start designing what other elements (if any) will make it up.&lt;br /&gt;
&lt;br /&gt;
Now is a good time to be very clear about the purpose of your element, as well as any interactions that you want it facilitate.&lt;br /&gt;
Consider writing down a clear and concise description of your element and sharing what you are planning in the forums, with colleagues or just generally with other developers.&lt;br /&gt;
This output approach is still fresh and we are all still learning how it works in detail so the more exposure you can get now the easier it will be down the track.&lt;br /&gt;
&lt;br /&gt;
When thinking about your element try to think about it is a blueprint to what you want to display. When displaying an actual something it is populated by data and that data is then used by a render method of a renderer to produce HTML.&lt;br /&gt;
Think about where that data is coming from, think about the renderer best practices, think about the style guide, and think about what others may and will do when overriding a renderer to override your render method.&lt;br /&gt;
&lt;br /&gt;
There are two additional important concepts to consider at this point as well, attributes and properties. Important enough to have their own heading so as to be easily found.&lt;br /&gt;
&lt;br /&gt;
====Attributes====&lt;br /&gt;
These are HTML attributes. It may be very very tempting to set attributes like classes and ID&#039;s within an element. But please do not.&amp;lt;br /&amp;gt;&lt;br /&gt;
Attributes should only be added to an element by the renderer. They may be added by any one of the three types of render methods you&#039;ll read about later.&lt;br /&gt;
&lt;br /&gt;
The reason for this is that we want the renderer to be solely responsible for translating an element to HTML. An instance of an element is simply a catalyst for the data contained within.&lt;br /&gt;
&lt;br /&gt;
Within a renderer attributes can be interacted with as follows:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// A publicly accessable array of attributes. Key =&amp;gt; Value.&lt;br /&gt;
$element-&amp;gt;attributes;&lt;br /&gt;
&lt;br /&gt;
// Set an attribute on the element.&lt;br /&gt;
$element-&amp;gt;set_attribute($key, $value);&lt;br /&gt;
&lt;br /&gt;
// Set an array of attributes on the element;&lt;br /&gt;
$element-&amp;gt;set_attributes(array(key1 =&amp;gt; value, key2 =&amp;gt; value));&lt;br /&gt;
&lt;br /&gt;
// Addes a CSS class to the attributes&lt;br /&gt;
$element-&amp;gt;add_class(&#039;some-class&#039;);&lt;br /&gt;
&lt;br /&gt;
// Returns the attributes as a string suitable for use in HTML output.&lt;br /&gt;
$element-&amp;gt;get_attributes();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Properties====&lt;br /&gt;
Talking about properties here I am not talking about class properties of the element that are used to contain data.&amp;lt;br /&amp;gt;&lt;br /&gt;
I am talking about the properties that describe the instance of the element. To get your head around this consider a menu that has several items within it. There are three common properties added by default to all elements that are applicable here:&lt;br /&gt;
&lt;br /&gt;
; active : A boolean property, set this to true if this item points to the current page. The active item.&lt;br /&gt;
; enabled : A boolean property again, set to true this says that the item is enabled and the user can perform the associated action. Set to false is like saying the user cannot interact with this menu item.&lt;br /&gt;
; dimmed : A Moodle-esq property. Set to true if the item is visible to the current user but not to every other user. Think of it like viewing a hidden course because you have the capability to.&lt;br /&gt;
&lt;br /&gt;
Properties can be added, and set by either a parent element, or a renderer if need be. They are used to convey properties that are applicable only in certain situations.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ability for an element to add properties to its subelements allows us more re-use of elements within renderers so that we don&#039;t need dedicated objects in situations where it is simply a property or two that differs from an available element.&lt;br /&gt;
&lt;br /&gt;
Properties can be interacted with the following methods and properties:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// Publicly accessable array of properties. Key =&amp;gt; Value.&lt;br /&gt;
$element-&amp;gt;properties;&lt;br /&gt;
&lt;br /&gt;
// Add a property to this element.&lt;br /&gt;
$element-&amp;gt;add_property(name, value);&lt;br /&gt;
&lt;br /&gt;
// Add an array of properties to this element.&lt;br /&gt;
$element-&amp;gt;add_properties(array(n1 =&amp;gt; value, n2 =&amp;gt; value));&lt;br /&gt;
&lt;br /&gt;
// Sets the value of a property.&lt;br /&gt;
$element-&amp;gt;set(name, value);&lt;br /&gt;
&lt;br /&gt;
// Gets the value of a property.&lt;br /&gt;
$element-&amp;gt;get(name);&lt;br /&gt;
&lt;br /&gt;
// Returns true is a property is set and is not empty.&lt;br /&gt;
$element-&amp;gt;is(name);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Step 3: Create the element class===&lt;br /&gt;
&lt;br /&gt;
Creating an element is really quite simple, the following headings explain what you need to know.&lt;br /&gt;
Remember if in doubt there are a lot of examples that can be easily found in Moodle core (within lib/output).&lt;br /&gt;
&lt;br /&gt;
====Element location====&lt;br /&gt;
All elements belong to the Output API and should be namespaced within it for autoloading and consistency with Moodle core elements.&lt;br /&gt;
This makes locating elements very easy, core elements will be located within an output subdirectory of the classes directory as shown below:&lt;br /&gt;
&lt;br /&gt;
: lib/classes/output/&#039;&#039;&#039;myelement.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Plugin elements will be located in a similar fashion within an output subdirectory of the classes directory. e.g.&lt;br /&gt;
&lt;br /&gt;
: mod/&#039;&#039;myplugin&#039;&#039;/classes/&#039;&#039;&#039;myelement.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Class name and inheritance====&lt;br /&gt;
Classes are namespaced for the output API and located in the file above. Because classes are namespaced the actual class name is simply the element name. The same name as was used for the file.&lt;br /&gt;
They must however extend the appropriate element type, if you are creating a molecule it must extend &#039;&#039;\core\output\molecule&#039;&#039;, if its an organism it must extend &#039;&#039;\core\output\organism&#039;&#039;.&lt;br /&gt;
For following is an example of how this would look for a core element:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
namespace core\output;&lt;br /&gt;
defined(&#039;MOODLE_INTERNAL&#039;) || die();&lt;br /&gt;
&lt;br /&gt;
class myelement extends organism {&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And for an element you are creating within a module plugin:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
namespace mod_myplugin\output;&lt;br /&gt;
defined(&#039;MOODLE_INTERNAL&#039;) || die();&lt;br /&gt;
&lt;br /&gt;
class myelement extends \core\output\organism {&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Class properties====&lt;br /&gt;
&lt;br /&gt;
We like to keep elements simple to interact with. For that reason we encourage people to store data and subelements that will be used during rendering as public class properties.&lt;br /&gt;
This is done so that data is accessed in a consistent fashion when interacting with an element. For this reason we would rather &#039;&#039;&#039;not&#039;&#039;&#039; see developers adding methods to an element unless truly required.&lt;br /&gt;
&lt;br /&gt;
Subelements are a good example. If you were writing a navigation bar organism for example you may have a title molecule, a menu molecule, and a search molecule. The title, menu and search molecules are the elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
These will become public class properties of your element.&lt;br /&gt;
&lt;br /&gt;
====Class methods====&lt;br /&gt;
&lt;br /&gt;
Elements should only have methods to support their own construction. As expressed above all information useful to a renderer should be stored in publicly accessible properties, none of it should have to be accessed via method calls.&lt;br /&gt;
This is done so that interaction with elements is consistent across all elements. Methods to aid the construction of the element are encouraged so that information can be easily added to the element.&lt;br /&gt;
&lt;br /&gt;
====Your constructor====&lt;br /&gt;
The constructor for your element should allow the developer to pass in the required data and subelements.&lt;br /&gt;
Consider when writing the constructor how developers will pass information into the element. In many cases there are going to be two types of data that will commonly be passed in:&lt;br /&gt;
# Elements (or arrays of) that make up parts of your element.&lt;br /&gt;
# Scalars (or arrays of) e.g. strings, integers, floats and booleans.&lt;br /&gt;
&lt;br /&gt;
Make the data that is absolutely required part of the constructor and simply have publicly accessible properties for the optional data that can be set by calling code if required.&lt;br /&gt;
&lt;br /&gt;
Its also worth considering if you are creating a molecule that perhaps data handling for the atoms that make it up may be worth including in your constructor.&amp;lt;br /&amp;gt;&lt;br /&gt;
For instance a dropdown consists of a trigger element (button, link, image) and a menu, the menu is a molecule that consists of items. The constructor of the dropdown could aid construction by accepting two arguments, the first a way to pass in a trigger, and the second either an already build menu element OR an array of items that get used to construct a menu element within the dropdown constructor.&lt;br /&gt;
&lt;br /&gt;
Some points to remember:&lt;br /&gt;
* Don&#039;t forget all properties should default to null if they do not have data set.&lt;br /&gt;
* If you have a collection of something as a property consider adding add_xxx() and add_xxxs() methods to aid the construction of elements.&lt;br /&gt;
&lt;br /&gt;
===Step 4: Write the render methods===&lt;br /&gt;
&lt;br /&gt;
There are 3 categories of render methods that will exist within every renderer and depending upon the type of your element you will be creating one or more of these methods for it.&lt;br /&gt;
&lt;br /&gt;
Why the three types of render method? There are two key reasons to take the above apporach.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Re-use&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
By ensuring we call the render method to produce elements and subelements when ever possible we will hopefully be making it easier to style Moodle as it won&#039;t be necessary to style absolutely everything individually. Instead if render has being used consistently to produce a button for example styling the HTML produced by &#039;&#039;render_button()&#039;&#039; should style all buttons throughout Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make overriding renderers in themes more controlable&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
The three types of render methods are designed to separate the logic and display that is permissable in renderers.&amp;lt;br /&amp;gt;&lt;br /&gt;
Render method should contain as little logic and PHP as possible, however in many situations a bit of PHP and perhaps a bit of logic is going to be required in order to take data from one form and make it ready to present.&amp;lt;br /&amp;gt;&lt;br /&gt;
If overriding a renderer within a theme the theme developer can look at what they want to achieve and choose the suitable method to override.&amp;lt;br /&amp;gt;&lt;br /&gt;
If they are looking to change the markup for an element then they can override the render method, they will not need to know anything about how the element was constructed or what information went into it. They can focus on the data the element has and produce the HTML they desire.&amp;lt;br /&amp;gt;&lt;br /&gt;
If they choose to change data, or want to display something different to what is there by default then they can override the translator method and continue to hack away to their hearts content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hopefully as you read about the render methods below the advantages to this approach will become clear.&lt;br /&gt;
&lt;br /&gt;
====Render method====&lt;br /&gt;
&lt;br /&gt;
This is the easiest to understand and no matter what type of element you have created you will need to write a render method.&lt;br /&gt;
The render method takes an element and returns HTML to display it.&lt;br /&gt;
&lt;br /&gt;
The render method takes a strict format:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Produce HTML to display myelement.&lt;br /&gt;
 *&lt;br /&gt;
 * @param \core\output\myelement $myelement The element to display.&lt;br /&gt;
 * @return string An HTML version of the element.&lt;br /&gt;
 */&lt;br /&gt;
protected function render_myelement(\core\output\myelement $myelement) {&lt;br /&gt;
    // Generate HTML for the element.&lt;br /&gt;
    return $html;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following are rules to follow when creating a render method.&lt;br /&gt;
&lt;br /&gt;
* It display the element, nothing else.&lt;br /&gt;
* It is a protected method.&lt;br /&gt;
* The name of the method is always &amp;quot;render_&amp;quot; followed by the &#039;&#039;&#039;non-namespaced&#039;&#039;&#039; name of your element.&lt;br /&gt;
* There is only ever &#039;&#039;&#039;one&#039;&#039;&#039; argument, the element to render and it should be typehinted.&lt;br /&gt;
* It will contain no logic.&lt;br /&gt;
* It uses the public properties of the element for data.&lt;br /&gt;
* It supplments this by using the available methods &#039;&#039;&#039;ONLY IF ABSOLUTELY REQUIRED&#039;&#039;&#039;&lt;br /&gt;
* It returns a string, the HTML to display the element.&lt;br /&gt;
&lt;br /&gt;
This method is very simple to understand, and providing you have properly researched and proposed your element it should be even easier to write.&lt;br /&gt;
&lt;br /&gt;
If you are writing a render method for molecule or organism then you likely will have subelements that have being used within your element.&lt;br /&gt;
Where possible you should call &#039;&#039;&#039;$this-&amp;gt;render()&#039;&#039;&#039; on the subelements to produce HTML for them that can then be included in the HTML that you are producing for your element.&lt;br /&gt;
Only if you absolutely must should you handle the generation of HTML for subelements directly within the render method for your element.&amp;lt;br /&amp;gt;&lt;br /&gt;
If you do produce the HTML for a subelement without calling render than &#039;&#039;&#039;you must&#039;&#039;&#039; manually call the subelements &#039;&#039;prerender&#039;&#039; method to ensure that it has an opertunity to complete and requisits it has before rendering.&lt;br /&gt;
&lt;br /&gt;
This is done to ensure that where possible we re-use the HTML for an element. By doing it we reduce the number of elements that a theme must style if all it is doing is styling.&amp;lt;br /&amp;gt;&lt;br /&gt;
If a theme overrides a render method it is not obligated to take this same approach. Theme overridden renderers can do as they please, any duplication of structure they introduce is their own business.&lt;br /&gt;
&lt;br /&gt;
====Convenience method====&lt;br /&gt;
&lt;br /&gt;
The name for this type of method provide a big hint as to what it is, it is a method to conveniently construct and render an instance of your element.&lt;br /&gt;
This method also takes a very simple, predicatable form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create and render a new myelement.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mixed $arg1&lt;br /&gt;
 * @param mixed $arg2&lt;br /&gt;
 * @param mixed $arg3&lt;br /&gt;
 * @return string HTML for myelement.&lt;br /&gt;
 */&lt;br /&gt;
public function myelement($arg1, $arg2, $arg3 = null) {&lt;br /&gt;
    $obj = new \core\output\myelement($arg1, $arg2, $arg3);&lt;br /&gt;
    return $this-&amp;gt;render($obj);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This type of method always does three things:&lt;br /&gt;
# It takes the arguments necessary to create a new instance of myelement.&lt;br /&gt;
# It creates a new instance of myelement given the arguments it is given and sets it up as required.&lt;br /&gt;
# It calls &#039;&#039;&#039;$this-&amp;gt;render()&#039;&#039;&#039; and gives it the object, returning the outcome.&lt;br /&gt;
&lt;br /&gt;
There are a few things to observe when writing a convenience method:&lt;br /&gt;
# It is always public.&lt;br /&gt;
# Its arguments should be complete.&lt;br /&gt;
#* Meaning that they should be arguments that can be immediately to the element &lt;br /&gt;
#* OR can be checked in conditions to alter the element.&lt;br /&gt;
#* They should not be objects to support the generation of data. The data should be complete.&lt;br /&gt;
# It should &#039;&#039;&#039;not&#039;&#039;&#039; produce any HTML itself, the render method is responsible for this.&lt;br /&gt;
# It returns a string, the HTML to display for the given element.&lt;br /&gt;
&lt;br /&gt;
In the case of molecules and organisms it is permissable for the convencience method to take actual subelements OR the arguments required to create necessary subelements. This is at the discretion of the developer and may be determinent on the number of arguments required to construct the element.&amp;lt;br /&amp;gt;&lt;br /&gt;
Complex elements that require a lot of data to set up are probably not ideal candidates to create convenience methods for.&lt;br /&gt;
&lt;br /&gt;
====Translator method====&lt;br /&gt;
&lt;br /&gt;
These methods take complex arguments such as data and objects from outside of the Output scope and manipulate/smooth the data into a complex organism or molecule.&amp;lt;br /&amp;gt;&lt;br /&gt;
They should be used to pass in the information the current element requires as well as any information that may be used by an overriding renderer to access additional data that may be desired.&lt;br /&gt;
&lt;br /&gt;
These are likely to be rare for core elements, however just about essential for elements being introduced by plugins for example where having retrieving data from plugin objects for use in an element or subelements is going to be required.&amp;lt;br /&amp;gt;&lt;br /&gt;
If for example you consider how your would render a forum discussion the translator method would likely take a forum discussion object and use a method of it to retrieve a nested array of forum posts that can then be used to create a discussion element, and its post subselements.&lt;br /&gt;
&lt;br /&gt;
Just like the above convenience method the translator method should not produce HTML itself, instead it should create the necessary element and any required subelements before calling &#039;&#039;&#039;$this-&amp;gt;render()&#039;&#039;&#039; on the subelement.&lt;br /&gt;
&lt;br /&gt;
Its important to note the pupose of having these methods as renderer methods and not having them abstracted to another layer of your code.&amp;lt;br /&amp;gt;&lt;br /&gt;
Because these methods exist within the renderer they can overridden by the theme in order to change the information that is used to construct the elements. This is also why translator methods should be given arguments that not just relate to what you immediately require for your idea of output, but also closely related things that may be required for others who wish to change the output.&lt;br /&gt;
&lt;br /&gt;
===Step 5: Enhance your output with JavaScript===&lt;br /&gt;
If you&#039;ve planned to add JavaScript to your project then now is the time to look at achieving this.&lt;br /&gt;
&lt;br /&gt;
This section needs a lot more work, there is a tracker issue [https://tracker.moodle.org/browse/MDL-45854 MDL-45854 Define and document JavaScript output guide] which once complete should make writing this section easy.&lt;br /&gt;
&lt;br /&gt;
Some notes for the time being:&lt;br /&gt;
* JavaScript should be initialised by the renderer within the render method.&lt;br /&gt;
* Simple element_actions can be attached to elements by calling &#039;&#039;$element-&amp;gt;add_js_action()&#039;&#039;.&lt;br /&gt;
* When attaching events to an element it should be done by ID.&lt;br /&gt;
* When delegating events to an element it should be done using a data attribute &#039;&#039;&#039;data-enhance=&amp;quot;action&amp;quot;&#039;&#039;&#039; which requires the JS selector &#039;&#039;[data-enhance=&amp;quot;action&amp;quot;]&#039;&#039;&lt;br /&gt;
* If you need an ID on your element for JS call &#039;&#039;&#039;$element-&amp;gt;require_id()&#039;&#039;&#039; which will generate an ID if one is not present (remember you are enhancing you can&#039;t assume one has or has not been set already)&lt;br /&gt;
* JS should follow our [[JavaScript guidelines]]&lt;br /&gt;
&lt;br /&gt;
===Step 6: Write generator samples===&lt;br /&gt;
More to come here as the [[Element_Library]] evolves.&lt;br /&gt;
&lt;br /&gt;
===Step 7: Style those samples in bootstrapbase and base===&lt;br /&gt;
&lt;br /&gt;
Hopefully when designing your element you have already considered how it is going to look, and had taken into consideration what is available in at least bootstrap base.&amp;lt;br /&amp;gt;&lt;br /&gt;
Because you have already written the element generator in the steps above you can easily refer to the element library when styling your element and testing.&lt;br /&gt;
&lt;br /&gt;
Its recommended to start with bootstrapbase as this is the scaffolding theme that our default theme &#039;&#039;clean&#039;&#039; is build upon.&lt;br /&gt;
All CSS for your element within the bootstrapbase theme should be added to &#039;&#039;&#039;theme/bootstrapbase/less/output_elements.less&#039;&#039;&#039; and be written in hierarchical less so that it is clear which styles apply to your element.&amp;lt;br /&amp;gt;&lt;br /&gt;
The CSS should be preceeded by a clear heading that identifies which element the styles belong to as well.&lt;br /&gt;
&lt;br /&gt;
It is also necessary to style the element in the base theme.&amp;lt;br /&amp;gt;&lt;br /&gt;
All CSS for your element within the base theme should be added to &#039;&#039;&#039;theme/base/style/element.css&#039;&#039;&#039; and like above should preceeded by a clear heading that identifies which element the styles belong to.&lt;br /&gt;
&lt;br /&gt;
The actual Less/CSS should be styled according to our [[Element HTML and CSS guidelines]]&lt;br /&gt;
&lt;br /&gt;
===Step 8: Write tests===&lt;br /&gt;
&lt;br /&gt;
Both acceptance and unit tests may be applicable to your element depending upon what you&#039;ve done, and just like all of new code arriving for Moodle tests are now an expectation.&lt;br /&gt;
You can not of course create tests to automatically check the display of your element, however the element library facilitates a user manually doing that.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PHPUnit tests&#039;&#039;&#039;&lt;br /&gt;
If your constructor contains any logic for smooth data into its properties then this should certainly be tested.&amp;lt;br /&amp;gt;&lt;br /&gt;
Likewise if you&#039;ve added any methods to aid the construction of your element they should be tested as well.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Acceptance tests&#039;&#039;&#039;&lt;br /&gt;
These are particularly applicable if your element facilitates any kind of interaction. If so then it is worthwhile creating a test scenario for this interaction.&amp;lt;br /&amp;gt;&lt;br /&gt;
If the interaction triggers a visual response, like clicking a button and a dropdown appears then this can be easily tested within the element library.&amp;lt;br /&amp;gt;&lt;br /&gt;
If a more complex interaction is taking place then you should consider writing a test that belongs to a code that makes use of your element.&lt;br /&gt;
For instance if your element is a search form and it is used within the forum consider writing an acceptance test for the forum testing your element if there is not already one there.&lt;br /&gt;
&lt;br /&gt;
===Step 7: Use your element===&lt;br /&gt;
Congratulations! At this point you have written your element, you&#039;ve written the required renderer methods and supporting generators and tests.&amp;lt;br /&amp;gt;&lt;br /&gt;
You are now ready to use your element within your code.&lt;br /&gt;
&lt;br /&gt;
==Peer-review checklist==&lt;br /&gt;
The following is a checklist guide of what to look for when reviewing an element and/or element render methods.&lt;br /&gt;
Items already on the peer-review checklist have being excluded.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;The element class&#039;&#039;&#039;&lt;br /&gt;
 [ ] The file is located in classes/output/elementname.php&lt;br /&gt;
 [ ] Autoloading is used, the file has not being included anywhere.&lt;br /&gt;
 [ ] The element is correctly namespaced to the Output API (namespace core\output OR mod_plugin\output).&lt;br /&gt;
 [ ] The element name is accurate to its function and concise.&lt;br /&gt;
 [ ] It is a unique element and not a duplicate of another element.&lt;br /&gt;
 [ ] It extends either atom, molecule or organism&lt;br /&gt;
 [ ] All data used during rendering is accessed through public properties.&lt;br /&gt;
 [ ] All public properties of the class are data that can be used during rendering.&lt;br /&gt;
 [ ] All optional public properties (not set within the constructor) default to null.&lt;br /&gt;
 [ ] All/any methods the class has aid in its construction (importantly they don&#039;t return data)&lt;br /&gt;
 &#039;&#039;&#039;Styles for a core element&#039;&#039;&#039;&lt;br /&gt;
 [ ] The element has being styled in at least the bootstrapbase and base themes.&lt;br /&gt;
 [ ] The styles in bootstrap base have being added to theme/bootstrapbase/less/output_elements.less&lt;br /&gt;
 [ ] Bootstrapbase styles have been written in less format and are preceeded by a clear heading of the element they belong to.&lt;br /&gt;
 &#039;&#039;&#039;Styles for a plugin element&#039;&#039;&#039;&lt;br /&gt;
 [ ] The element has being styled in at least the bootstrapbase and base themes.&lt;br /&gt;
 &#039;&#039;&#039;Renderer&#039;&#039;&#039;&lt;br /&gt;
 [ ] Does the renderer conform to the [[Renderer best practices]]?&lt;br /&gt;
 &#039;&#039;&#039;Renderer - render method (required)&#039;&#039;&#039;&lt;br /&gt;
 [ ] A method has being written.&lt;br /&gt;
 [ ] The method is protected.&lt;br /&gt;
 [ ] The method takes a single argument, an element and and adequate typehint is in place.&lt;br /&gt;
 [ ] The method contains no logic, no globals.&lt;br /&gt;
 [ ] The method returns HTML.&lt;br /&gt;
 &#039;&#039;&#039;Renderer - convenience method (optional)&#039;&#039;&#039;&lt;br /&gt;
 [ ] The method is public.&lt;br /&gt;
 [ ] All arguments are complete arguments (see above docs for details)&lt;br /&gt;
 [ ] Contains no logic other than data smoothing if absolutely required.&lt;br /&gt;
 [ ] Does not produce any HTML itself.&lt;br /&gt;
 [ ] Call &#039;&#039;&#039;$this-&amp;gt;render($element);&#039;&#039;&#039; and returns the output.&lt;br /&gt;
 &#039;&#039;&#039;Renderer - translator method (optional)&#039;&#039;&#039;&lt;br /&gt;
 [ ] The method is public.&lt;br /&gt;
 [ ] Logic is minimal and the related to smoothing data from arguments into elements.&lt;br /&gt;
 [ ] Produces a single element only/&lt;br /&gt;
 [ ] Produces no HTML itself.&lt;br /&gt;
 [ ] Call &#039;&#039;&#039;$this-&amp;gt;render($element);&#039;&#039;&#039; and returns the output.&lt;br /&gt;
&lt;br /&gt;
==Tracker issues==&lt;br /&gt;
The following tracker issues relate in one way or another to the development and continued work on Output.&lt;br /&gt;
&lt;br /&gt;
* MDL-45885 Decide how output elements (the issue that saw this document created)&lt;br /&gt;
* MDL-45770 Implement stage 1 tasks from the Render Library specification&lt;br /&gt;
* MDL-41663 Allow renderers and renderables in a namespace to be auto loaded.&lt;br /&gt;
* MDL-45828 Create the element library admin tool.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Render library specification]] - The original output specification for Moodle 2.8&lt;br /&gt;
* [[Output element planning]] - Thoughts on initial elements that should be created.&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Element_HTML_and_CSS_guidelines&amp;diff=45916</id>
		<title>Element HTML and CSS guidelines</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Element_HTML_and_CSS_guidelines&amp;diff=45916"/>
		<updated>2014-07-22T11:40:03Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45830&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
This is a guide to writing HTML and CSS for elements within Moodle.&lt;br /&gt;
In the future this will likely become the HTML and CSS guide for output in Moodle as we want to move elements. However at present we don&#039;t want to enforce this for all output, just new conversions to elements.&lt;br /&gt;
&lt;br /&gt;
==Why have a strict guide==&lt;br /&gt;
&lt;br /&gt;
At the time of writing this CSS within Moodle (2.7) themes is in a poor state and has been for a long time. Without previously having a guide we were finding that:&lt;br /&gt;
&lt;br /&gt;
* As there was no formal guide to creating id&#039;s or classes, each developer does there own thing.&lt;br /&gt;
* As there was no formal guide on how to write CSS there were numerous techniques used when writing CSS and no consistency.&lt;br /&gt;
* Majority of pages create uniuqe output and require unique CSS, there is very little re-use of design.&lt;br /&gt;
&lt;br /&gt;
While those points may not sound bad to you consider that in following stats from Moodle 2.7 themes:&lt;br /&gt;
&lt;br /&gt;
* Base theme contains 3802 rulesets with a total of 5800 styles.&lt;br /&gt;
* Bootstrapbase theme contains 5170 rulesets with a total of 9362 styles.&lt;br /&gt;
* Clean theme contains 5172 rulesets with a total of 9366 styles.&lt;br /&gt;
* More theme contains 5177 rulesets with a total of 9063 styles.&lt;br /&gt;
&lt;br /&gt;
You get the picture, several thousand selectors containing nearly 10000 styles.&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.8 we commited to introducing a element library to aid the reuse of design and documenting all aspects of output including a guide on writing CSS for Moodle. This is that guide.&lt;br /&gt;
&lt;br /&gt;
==Our goals==&lt;br /&gt;
&lt;br /&gt;
Its very important to understand what we are trying to achieve with this style guide and output in general.&lt;br /&gt;
&lt;br /&gt;
; Frontend framework agnostic : We want theme designers to be able to apply present and future frontend frameworks to Moodle with minimal effort.&lt;br /&gt;
; Consistent interfaces : We want Moodle to have consistency throughout its interfaces, minimising the amount of frontend design and development that is required in coding and styling an interface.&lt;br /&gt;
; Cleanly formatted HTML and CSS : to minimise both development time and to make our renderers and CSS and more maintainable.&lt;br /&gt;
&lt;br /&gt;
We plan to faciliate these with the following:&lt;br /&gt;
; Elements : Highly re-usable objects to produce HTML, these will be used consistently and relied upon by developers creating interfaces. By having these elements we create a consistent look, interface creation will be much quicker and theme designers through the re-use of a limited number of elements.&lt;br /&gt;
; Element library : A tool to show samples of each element, this can be used to view and test designs. It aids the developer by showing them the elements they can select from when creating an interface, and it aids designers by giving them a test area that doesn&#039;t require them to dig through every page in Moodle.&lt;br /&gt;
; Documentation : We will now have proper documentation on all aspects of output. Including this CSS style guide, a renderer best practices guide, and a guide to creating elements.&lt;br /&gt;
&lt;br /&gt;
==Where to put CSS in Moodle core==&lt;br /&gt;
&lt;br /&gt;
CSS can reside in a number of locations depending upon what you are styling.&lt;br /&gt;
&lt;br /&gt;
Remember it doesn&#039;t matter how many CSS files we end up with, on a production site with Theme designer mode switched off (default) all CSS files will be combined and minimised into a single file that is served to the client.&lt;br /&gt;
Excepting the case of IE where we must split the CSS into several smaller files to work around browser limitations.&lt;br /&gt;
&lt;br /&gt;
===CSS for elements===&lt;br /&gt;
As we are moving to using elements you will find that CSS for elements is where most of the effort is going to go.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should reside within themes only, you will find that elements must be styled in all core base themes, this means at least Bootstrapbase and base.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should be located within either &#039;&#039;&#039;theme/themename/style/elements/elementname.css&#039;&#039;&#039; or &#039;&#039;&#039;theme/themename/less/elements/elementname.css&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The actual CSS file should be named according to the element. As elements can be namespaced we need to ensure that that is reflected in the name of the file.&lt;br /&gt;
For instance:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Element&lt;br /&gt;
! CSS location in base&lt;br /&gt;
! CSS location in bootstrapbase&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\button&lt;br /&gt;
| style/elements/core_output_button.css&lt;br /&gt;
| less/moodle/elements/core_output_button.css&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\navigation_bar&lt;br /&gt;
| style/elements/core_output_navigation_bar.css&lt;br /&gt;
| less/moodle/elements/core_output_navigation_bar.css&lt;br /&gt;
|-&lt;br /&gt;
| \mod_assign\output\user_submission&lt;br /&gt;
| style/elements/mod_assign_output_user_submission.css&lt;br /&gt;
| less/moodle/elements/mod_assign_output_user_submission.css&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These will still need to be included in the theme, by which ever means is relevant.&lt;br /&gt;
If you are using &#039;&#039;.css&#039;&#039; files like the base theme does then you will use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// In your themes config.php&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;elements/core_output_button&#039;,&lt;br /&gt;
    &#039;elements/core_output_navigation_bar&#039;,&lt;br /&gt;
    &#039;elements/mod_assign_output_user_submission&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using less as bootstrapbase does then you will use:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** In your primary less file **/&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_button&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_navigation_bar&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/mod_assign_output_user_submission&amp;quot;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General CSS===&lt;br /&gt;
&lt;br /&gt;
This is CSS for the theme that doesn&#039;t relate to a specific element. Hopefully as we convert more and more of Moodles interfaces to use elements we should see less general CSS.&lt;br /&gt;
&lt;br /&gt;
In any case nothing has changed in regards to the location of general CSS.&lt;br /&gt;
; CSS : If your theme is using standard CSS then it must be located within the &#039;&#039;style&#039;&#039; directory of your theme and should be in logically separated files.&lt;br /&gt;
; Less : If your theme is using less then it should be located in a &#039;&#039;less/moodle&#039;&#039; directory within your theme.&lt;br /&gt;
&lt;br /&gt;
We recommend that you separate styles into files based upon the Moodle component being styled. Again as all CSS files get combined into a single file on production sites it doesn&#039;t matter how many files you end up with.&lt;br /&gt;
&lt;br /&gt;
This would lead to files named like:&lt;br /&gt;
* style/core.css&lt;br /&gt;
* style/course.css&lt;br /&gt;
* style/mod_forum.css&lt;br /&gt;
&lt;br /&gt;
===Where to put CSS in plugins===&lt;br /&gt;
&lt;br /&gt;
It is possible in Moodle to add CSS stylesheets to all plugins (including core plugins).&amp;lt;br /&amp;gt;&lt;br /&gt;
Moodle always looks for a &#039;&#039;styles.css&#039;&#039; file within your plugins directory, and it also looks for a styles_themename.css where themename is the name of the currect theme being used.&lt;br /&gt;
&lt;br /&gt;
For instance the following could be added to the forum module:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;mod/forum/styles.css&#039;&#039;: Used all the time.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_base.css&#039;&#039; : Used when the user is using the base theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_bootstrapbase.css&#039;&#039; : Used when the user is using the bootstrapbase theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_clean.css&#039;&#039; : Used when the user is using the clean theme.&lt;br /&gt;
&lt;br /&gt;
===CSS in core plugins===&lt;br /&gt;
&lt;br /&gt;
For core plugins only styles.css is permitted and it should only ever contain styles essential to the presentation of the plugin.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present styles essential for the display of the plugin are allowed here, however when the plugin interfaces have been converted to use elements this file should be nearly empty and contain only the following:&lt;br /&gt;
* Images, icons and text used for visual presentation such as icons to notify state (expanded/collapsed, warnings...)&lt;br /&gt;
* Accessiblity orientated styles required to make the interface accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Under no circumstances should it contain any visual stylings such as border, rounded corners, and background colours not associated with state.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==HTML==&lt;br /&gt;
&lt;br /&gt;
The following sections detail rules in place for writing HTML.&lt;br /&gt;
&lt;br /&gt;
Before we start a couple of general recommendations:&lt;br /&gt;
&lt;br /&gt;
; Use hyphens rather than underscores when concatenating strings in attributes : for example &#039;&#039;.course-new-activity-chooser&#039;&#039; instead of &#039;&#039;.course_new_activity_chooser&#039;&#039;. By all doing this we will have a more consistent appearance and as We use underscores as part of frankenstyle which is prominent in CSS helps us to reduce the chance of naming conflicts.&lt;br /&gt;
; Think semantics - but don&#039;t get caught up in it : Semantic CSS is beautiful CSS lending itself ultimately to the redesign that is going to happen. But enforcing a semantic design can be an arduous journey. Instead we encourage semantic CSS but are happy to see non-semantic CSS when it is for the greater good.&lt;br /&gt;
&lt;br /&gt;
===Using the ID attribute===&lt;br /&gt;
&lt;br /&gt;
The situation of having a single JavaScript driven element was considered but even then it is better to style only classes and other attributes as we can&#039;t be sure what the future holds.&lt;br /&gt;
&lt;br /&gt;
There are three rules you should follow when creating an ID:&lt;br /&gt;
&lt;br /&gt;
# They should only be given to elements and HTML nodes that need to be interacted with by JavaScript.&lt;br /&gt;
# It should always start with &#039;&#039;&#039;m-&#039;&#039;&#039; &#039;&#039;(see note below)&#039;&#039;&lt;br /&gt;
# The actual ID should be descriptive of the node and contents as a whole unit. It must fully and concisely describe its purpose.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that in an ideal world ID&#039;s should not be used for styling.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Good&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-course-new-activity-chooser&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bad&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
It doesn&#039;t have the m- prefix&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This may appear OK at first but when you think about it selecting an activity within Moodle&lt;br /&gt;
is something that is done in multiple places and the this widget may not be applicable to&lt;br /&gt;
every place, as there may be other activity selector JS one day introduced having a&lt;br /&gt;
more complete ID is important&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-activity-selector&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The requirement to use m- prefix is entirely new, this has been created as this instantly reduces the chances of conflicting with present and future frontend frameworks that may be adopted by core or third party themes. Aiding our goal of being frontend framework agnostic.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will also help reduce the chance of conflicts in any third party code that may be used either by us in core, or by outside developers in their own code.&lt;br /&gt;
Moodle ID&#039;s will also be much more easily recognisable which we expect will be a benefit as JavaScript use in Moodle continues to increase.&lt;br /&gt;
&lt;br /&gt;
===Naming CSS classes===&lt;br /&gt;
&lt;br /&gt;
This is where a bit of organisation goes a long way and we want to be reasonably thorough in a consistent naming scheme and implementation.&lt;br /&gt;
&lt;br /&gt;
The very first thing to mention is that all classes in Moodle must now be prefixed by *m-*.&lt;br /&gt;
This instantly identifes a class as belonging to Moodle, it aids us in avoiding conflicts with any non-Moodle css that may be loaded, and it is part of our framework agnostic plan.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
All CSS classes must start with *m-*&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several prefix that are used within Moodle output now that should not be used as prefixs for classes unless they are serving the desired purpose.&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes are:&lt;br /&gt;
&lt;br /&gt;
; m-element : Prefix used on element classes, where m-element preceeds the name of the element, e.g. m-element-button, m-element-search&lt;br /&gt;
; m-state : Prefix used for CSS classes representing the state of an item, e.g. m-state-disabled, m-state-active, m-state-expanded.&lt;br /&gt;
; m-grid : Prefix used for creating HTML grids.&lt;br /&gt;
&lt;br /&gt;
====Elements====&lt;br /&gt;
&lt;br /&gt;
Semantic design where it gives the best result, smart design where there is a better solution.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re not already familiar with the idea of semantic CSS then Chris Coylers artical [http://css-tricks.com/semantic-class-names/ What makes for a semantic class name] is a great starting point.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve not commit to adopting any one strict approach for writing CSS. We have adopted atomic design for our HTML elements, a design style which fits nicely with the likes of OOCSS, however be very clear that we are not adopting the OOCSS approach in its entirety. The high level abstraction of the visual aspects of elements into highly reusable agnostic classes does not always lend itself well to the Moodle world in which the we wish to be frontend framework agnostic and support largescale completely customisable themes.&amp;lt;br /&amp;gt;&lt;br /&gt;
The highly reusable classes that appeal to one designer, or to one frontend framework may not apply to another.&amp;lt;br /&amp;gt;&lt;br /&gt;
This decision is also impacted by our current default theme bootstrapbase that does not use well abstracted OOCSS in its design.&lt;br /&gt;
&lt;br /&gt;
Atomic design is going to see us end up with many parent child relationships in our HTML that we must carry through to our CSS. Through atomic design we start with smalled atoms and molecules that get built into larger organisms and placed within layouts.&lt;br /&gt;
&lt;br /&gt;
Every element should have a single class that identifies it as element X.&lt;br /&gt;
&lt;br /&gt;
For instance the button atom will have the class *m-element-button*&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button class=&amp;quot;m-element-button&amp;quot;&amp;gt;I am a button&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is simply the prefix &amp;quot;m-element&amp;quot; plus the element name.&lt;br /&gt;
&lt;br /&gt;
The purpose of this class is to allow the element to be styled with ease. The class name should be applied to the root node for the element, it should never be applied any lower.&lt;br /&gt;
&lt;br /&gt;
By having one class for the element, and always and only applied to the root node it makes it very easy in HTML to see where one element belongs to another.&lt;br /&gt;
&lt;br /&gt;
The following is an example of the search molecule, which in turn contains two button atoms.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to partially adopt BEM as a CSS standard when writing CSS for elements.&lt;br /&gt;
BEM isn&#039;t a new CSS standard, but its not widely known either. Its existence fills a gap in how to style elements consistently. Through two basic notation techniques you can easily notate the purpose of structures that belong to an element and notate the intent of an element that is desired if the element has multiple versions.&lt;br /&gt;
&lt;br /&gt;
; Notating purpose : Here we use a suffix *__purpose*, the key being the two underscores.&lt;br /&gt;
; Notating intent : Here we use a suffix *--intent*, the key being the two hyphens.&lt;br /&gt;
&lt;br /&gt;
You&#039;ll notice in the example above that there is no way to style the continue button differently from the cancel button without relying on its name, something we certainly don&#039;t want to do.&lt;br /&gt;
The solution is to wrap each button in a div and give each div a class.&lt;br /&gt;
The BEM standard comes into play here in naming the classes, the following shows how you would apply BEM to show the purpose of each button in a way that can be easily interpreted and styled in CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__cancel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__continue&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now each button is wrapped in a div with a class, *m-element-confirmation__cancel* and *m-element-confirmation__continue*.&lt;br /&gt;
This class can be read by the themer and because of the __ can be easily identified as both belonging to the m-element-confirmation and serving a specific purpose, continue or cancel.&lt;br /&gt;
&lt;br /&gt;
Now to explain the idea of intents.&lt;br /&gt;
An intent is when a single element takes on a different apprearance to convey a specific meaning. A little bit like a state, but with more meaning.&lt;br /&gt;
An easy example is notifications where you will no doubt be familiar with the idea of having a error notifications, warning notifications, success notification etc. Each of error, warning, and success is a intent.&lt;br /&gt;
&lt;br /&gt;
The following shows how this would work:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- A standard notification --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- A warning --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification m-element-notification--warning&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Grids====&lt;br /&gt;
&lt;br /&gt;
We need to adopt a single grid framework.&lt;br /&gt;
&lt;br /&gt;
Personally I don&#039;t think we should use pure bootstrap or pure YUI, instead we should choose one of these and build it use our class name structures.&lt;br /&gt;
&lt;br /&gt;
All grid classes should start with m-grid.&lt;br /&gt;
&lt;br /&gt;
==CSS==&lt;br /&gt;
&lt;br /&gt;
Before we begin lets lay down some ground level goals, things that will help us achieve clear and understandable CSS in the future.&lt;br /&gt;
* Formatting, ordering, alignment, and spacing are all important in having CSS that can be easily read by others.&lt;br /&gt;
* Don&#039;t optimise your CSS, be verbose and stick to the styles in this guide. We have tools that will handle optimisation for you.&lt;br /&gt;
* Never use *!important* in your CSS unless it is absolutely impossible to avoid doing so.&lt;br /&gt;
&lt;br /&gt;
===Terminology===&lt;br /&gt;
&lt;br /&gt;
Its important that when we are speaking about CSS we are speaking the same language.&lt;br /&gt;
Lets look at the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-page .m-selector-1,&lt;br /&gt;
.m-page .m-selector-2,&lt;br /&gt;
.m-page .m-selector-3 {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
    color: #000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-1 {&lt;br /&gt;
    margin: 1em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Ruleset : Each of the two rules is a single *ruleset*.&lt;br /&gt;
; Rule: _.m-page .m-selector-1_ is a rule.&lt;br /&gt;
; Selector : _.m-selector-1_ is a *selector*, it is a single part of a rule.&lt;br /&gt;
; Declaration : _background-color: #FFF_ is a declaration.&lt;br /&gt;
;&lt;br /&gt;
&lt;br /&gt;
===Essential formatting===&lt;br /&gt;
&lt;br /&gt;
The following are the guies for writing CSS.&lt;br /&gt;
&lt;br /&gt;
* Always use spaces - never use tabs. All editors can be configured to do it.&lt;br /&gt;
* Indent by 4 spaces - never more, never less.&lt;br /&gt;
* A single empty line between rulesets to maintain consistent spacing of rules.&lt;br /&gt;
* One rule per line.&lt;br /&gt;
* A single space between each selector in a rule.&lt;br /&gt;
* No space between a rule and the comma in a ruleset.&lt;br /&gt;
* A single space between a selector and the opening brace of a ruleset.&lt;br /&gt;
* One level of indentation before each declaration.&lt;br /&gt;
* A single space the colon in a declaration.&lt;br /&gt;
* A single space after each item in a declaration containing multiple items.&lt;br /&gt;
&lt;br /&gt;
The following shows how the above rules apply:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-selector-1,&lt;br /&gt;
.m-selector-2 .m-selector-3 {&lt;br /&gt;
    background: #ffa800 url(&amp;quot;background.png&amp;quot;) no-repeat right top;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    display: inline-block;&lt;br /&gt;
    font-family: arial, sans-serif;&lt;br /&gt;
    margin: 5px 10px;&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-4 {&lt;br /&gt;
    border-radius: 3px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General rules===&lt;br /&gt;
&lt;br /&gt;
Declaration ordering is the very first thing to discuss. There is no strict rule on how to order your declarations, however there is a recommendation.&lt;br /&gt;
We recommend that you order declarations within a ruleset alphabetically.&lt;br /&gt;
If we all start doing this then when you read CSS written by someone else you will soon learn to very quickly find your way around the declarations within a rule.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Recommended **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    color: #000;&lt;br /&gt;
    display: block;&lt;br /&gt;
    margin: 5px;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do not use a measurement unit when writing a 0 value.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use lowercase and shorthand values for colours.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #ffffff;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: white;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always quote variable values.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector[attr=&amp;quot;variable&amp;quot;] {&lt;br /&gt;
    background-image: url(&amp;quot;image.png&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector[attr=variable] {&lt;br /&gt;
    background-image: url(image.png);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Commenting===&lt;br /&gt;
&lt;br /&gt;
Always comment your CSS and Less.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Styles for the button atom.&lt;br /&gt;
 */&lt;br /&gt;
.m-element-button {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rules and exceptions for less===&lt;br /&gt;
&lt;br /&gt;
Need to write some guff on Less.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Render library specification]] - The original output specification for Moodle 2.8&lt;br /&gt;
* [[Output element planning]] - Thoughts on initial elements that should be created.&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Renderer_best_practices&amp;diff=45915</id>
		<title>Renderer best practices</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Renderer_best_practices&amp;diff=45915"/>
		<updated>2014-07-22T11:39:56Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45853&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
This page documents renderer best practices.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
* Must mention atomic design and how the concept of &amp;quot;templates&amp;quot; should be applied. Relates to the next note. A forth method type for renderers?&lt;br /&gt;
* Within a component or plugin that has a renderer use the renderer for EVERYTHING within that area. [https://moodle.org/mod/forum/discuss.php?d=262817#p1138926 forum post that ignited this]&lt;br /&gt;
* Reference and probably copy the three render methods from [Guide to creating output elements]&lt;br /&gt;
&lt;br /&gt;
==Renderer best practices==&lt;br /&gt;
&lt;br /&gt;
This document discusses the recommended practises to follow when writing renderers for Moodle. It was created in Moodle 2.8 as part of the element library specification that took place.&lt;br /&gt;
&lt;br /&gt;
Renderers provide an abstraction of logic and display. They serve Moodle to both encourage us to properly structure our code and to provide a means by which themes can take control of output to completely customise the look of Moodle.&lt;br /&gt;
Elements and the element library provide us a set of building blocks to use when creating output. These provide us a consistent and manageable look that also minimising the amount of customisation required by a theme to change the look and feel of Moodle.&lt;br /&gt;
Here we make a recommendation on how to write renderers to maximise the benefits to both yourself as a developer and to designers who have to customise the interfaces you create.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
Its important to understand the goals for output before you start looking at renderers as they are just one part of the output plan.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output in Moodle is designed to:&#039;&#039;&#039;&lt;br /&gt;
* Aid developers in properly abstracting output from logic.&lt;br /&gt;
* Allow designers to take complete control of output from within a theme if they wish.&lt;br /&gt;
* Provide a consisten look and feel for Moodle user.&lt;br /&gt;
* Allow developers to more rapidly create interfaces by having a set of elements at their finger tips.&lt;br /&gt;
* Minimise the efforts designers must extrude in order to customise the look and feel of Moodle by limiting the output to a set of elements.&lt;br /&gt;
* Aid designers by providing tools to support styling Moodle such as the element library.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Renderers in Moodle:&#039;&#039;&#039;&lt;br /&gt;
* Are the link between Moodle and a theme through which all output is generated.&lt;br /&gt;
* Are organised for the benefit of designers, and should be written following this document.&lt;br /&gt;
* Most importantly allow designers to override the HTML that wraps the data being displayed in turn allowing designers to re-design output in a theme.&lt;br /&gt;
* Allow designers to change the information being displayed by providing not just what is initially required but that which that may require.&lt;br /&gt;
&lt;br /&gt;
==A simple set of rules for a good renderer==&lt;br /&gt;
&lt;br /&gt;
Summarising what will be discussed further in this document a good renderer can be summarised as:&lt;br /&gt;
&lt;br /&gt;
* Think in elements. We have an element library, when planning the output for your plugin/component start with the elements in the element library and the markup they provide.&lt;br /&gt;
* Containing only methods confroming to the four method types discussed below.&lt;br /&gt;
* Encapsulated data is given, maximising the information available to the renderer and minimising the number of arguments.&lt;br /&gt;
* Free of logic relating to anything except output. This includes not calculating the likes of links and capabilities.&lt;br /&gt;
* Uses helper methods to manipulate data where manipulate is absolutely required, essentially abstracting logic to conform to the above rule.&lt;br /&gt;
* Utilise the core elements as much as is possible.&lt;br /&gt;
* Recognise unique output needs and create element(s) for it.&lt;br /&gt;
* The render method should be used as often as possible to maximise consistent look.&lt;br /&gt;
&lt;br /&gt;
==The don&#039;ts==&lt;br /&gt;
&lt;br /&gt;
The following are things that should not be done within a renderer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT:&#039;&#039;&#039;&lt;br /&gt;
* design interfaces from scratch when desiging output for your plugin/component. Always start with the elements found in the element library.&lt;br /&gt;
* Use logic that isn&#039;t essential to producing output. This includes but is not limited to the following:&lt;br /&gt;
** Database interaction of any kind.&lt;br /&gt;
** Access or capability checks.&lt;br /&gt;
** Generation of data such as producing URL&#039;s, that should be owned by the plugin/component and made available preferably through the given arguments or failing that through a helper method.&lt;br /&gt;
* Generate HTML for something that should be an element, convert it to an element and call render on it.&lt;br /&gt;
* Create custom elements for everything you plan to output, instead try to maximise the core elements that you use.&lt;br /&gt;
* Write your own render methods for subelements of the elements you create. Only do this if you absolutely must change the markup from that produced by the natural render method for the element.&lt;br /&gt;
&lt;br /&gt;
==Creating a renderer==&lt;br /&gt;
&lt;br /&gt;
===Location and naming===&lt;br /&gt;
As of Moodle 2.8 renderers can be put into the output namespace. This is the recommended placement for Renderers in Moodle 2.8 and up, however the alternatives will also be listed here.&lt;br /&gt;
&lt;br /&gt;
Recommended:&lt;br /&gt;
* Put your renderer in &#039;&#039;&#039;mod/yourplugin/output/renderer.php&#039;&#039;&#039; use the namespace &#039;&#039;&#039;mod_yourplugin\output&#039;&#039;&#039; and call your class &#039;&#039;&#039;renderer&#039;&#039;&#039;.&lt;br /&gt;
* To get an instance of your renderer &#039;&#039;$PAGE-&amp;gt;get_renderer(&#039;mod_yourplugin&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is how mod/yourplugin/output/renderer.php will look:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
namespace mod_yourplugin\output;&lt;br /&gt;
&lt;br /&gt;
class renderer extends \plugin_renderer_base {&lt;br /&gt;
    // Your renderer methods in here.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also available but not recommended:&lt;br /&gt;
* Put your renderer in &#039;&#039;&#039;mod/yourplugin/renderer.php&#039;&#039;&#039; do NOT namespace it, and call your class &#039;&#039;&#039;mod_yourplugin_renderer&#039;&#039;&#039;.&lt;br /&gt;
* To get an instance of your renderer &#039;&#039;$PAGE-&amp;gt;get_renderer(&#039;mod_yourplugin&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This was how things were done in earlier versions of Moodle (2.7 and below).&lt;br /&gt;
&lt;br /&gt;
===Render methods===&lt;br /&gt;
&lt;br /&gt;
Renderers can be well structured, the purpose of them is the same across all plugins and components.&lt;br /&gt;
There are four distinct types of render methods that you can expect to find in a renderer, and these four can be categorised into one of two categories.&lt;br /&gt;
&lt;br /&gt;
The four types of render methods:&lt;br /&gt;
# Layout methods&lt;br /&gt;
# Translator methods&lt;br /&gt;
# Render methods&lt;br /&gt;
# Convenience methods&lt;br /&gt;
&lt;br /&gt;
These four methods can then be categorised in two ways:&lt;br /&gt;
; Plugin|Component method : The layout and translator methods are plugin or component methods. They take data for a plugin or component and meld it into renderables. These methods relate to and can be said to be owned by the plugin or component. &lt;br /&gt;
; Element methods :  The render and convenience methods relate only to elements. They take already encapsulated abstracted data and simply output HTML structure around it. They pay no regard to the plugin or component and are completely and solely bound to the output of an element.&lt;br /&gt;
&lt;br /&gt;
====Layout methods====&lt;br /&gt;
&lt;br /&gt;
====Translator methods====&lt;br /&gt;
&lt;br /&gt;
====Render methods====&lt;br /&gt;
If you&#039;ve spent any time working with renderers in the past you will already be familiar with the concept of a render method.&lt;br /&gt;
All elements within Moodle inherit the renderable interface. To produce output for them you call the renderers render method and give the element.&lt;br /&gt;
The render method looks at what is given and looks &lt;br /&gt;
&lt;br /&gt;
====Convenience methods====&lt;br /&gt;
These are very simple. A convenience method is simply an easy way to build and output an element in a single step.&lt;br /&gt;
If you take an element, likely an atom or molecule, a convenience method would have the same arguments as the constructor for the element, build an instance of the element and call render on it.&lt;br /&gt;
The following is a simple example using heading:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A convenience method to render a heading.&lt;br /&gt;
 */&lt;br /&gt;
public function heading($content, $level = 2) {&lt;br /&gt;
    $heading = new \core\output\heading($content, $level);&lt;br /&gt;
    return $this-&amp;gt;render($heading);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating output elements==&lt;br /&gt;
This is a big field and as such a dedicated document has been writen as a [[Guide to creating output elements]].&lt;br /&gt;
&lt;br /&gt;
==Tips on properly structuring your plugin==&lt;br /&gt;
Talk here about OO structuring of code, ensuring a traversable heirarchy that enables maximum movement of code structure to obtain data and in turn minimises necessary arguments for layout methods.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Render library specification]] - The original output specification for Moodle 2.8&lt;br /&gt;
* [[Output element planning]] - Thoughts on initial elements that should be created.&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Guide_to_creating_output_elements&amp;diff=45914</id>
		<title>Guide to creating output elements</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Guide_to_creating_output_elements&amp;diff=45914"/>
		<updated>2014-07-22T11:39:41Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45885&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
A guide to writing output elements and the render methods for them.&lt;br /&gt;
&lt;br /&gt;
==Terminology==&lt;br /&gt;
&lt;br /&gt;
Don&#039;t worry if you don&#039;t understand these yet, this document is going to explain them.&lt;br /&gt;
However for the sake of providing a quick understanding of some of the terminology used in output here it is:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Atom&#039;&#039;&#039; A simple building block, think of it like a HTML tag as that is what it is in many cases.&lt;br /&gt;
* &#039;&#039;&#039;Molecule&#039;&#039;&#039; A collection of atoms combined together to serve a single purpose or offer a single interaction.&lt;br /&gt;
* &#039;&#039;&#039;Organism&#039;&#039;&#039; A collection of molecules and atoms combined together to form a part of the user interface, serving one or more related purposes.&lt;br /&gt;
* &#039;&#039;&#039;Element&#039;&#039;&#039; An element is an meta concept for the above, when we talk about elements we talk about one of or more of atoms, molecules, and organisms. &lt;br /&gt;
* &#039;&#039;&#039;Subelement &#039;&#039;&#039; When we speak of subelements we are talking about the smaller elements that are going to be of a larger element. e.g the molecules that are present in an organism.&lt;br /&gt;
* &#039;&#039;&#039;Renderable&#039;&#039;&#039; Used to mark the object as something that can be converted into output.&lt;br /&gt;
&lt;br /&gt;
==Understanding output in Moodle==&lt;br /&gt;
&lt;br /&gt;
In 2.8 the direction of output in Moodle was changed, or more accurately re-organised.&amp;lt;br /&amp;gt;&lt;br /&gt;
Most Moodle sites out there use a third party theme, or have a had a theme created for them. We can assume that themes are the most widely created plugin within Moodle.&lt;br /&gt;
They deal with the design of the site, and design by nature is a moving, shifting, trending, fluid.&amp;lt;br /&amp;gt;&lt;br /&gt;
How Moodle produces its look need to be flexible enough to cater to current trends, requirements such as usability and accessibility, be able to keep up with trends, and cater to personal tastes.&amp;lt;br /&amp;gt;&lt;br /&gt;
We&#039;ve long had renderers now that allow us to cater to this flexibility, however as Moodle has grown so has its interfaces. There are more interfaces, more controls, more possible interactions.&amp;lt;br /&amp;gt;&lt;br /&gt;
The move in 2.8 was to bring organisation to what was being done, to bring consistency to the party and the make this flexible a manageable possibility by having an organised set of elements to style rather than an endless array of interfaces and unique parts.&lt;br /&gt;
&lt;br /&gt;
The goals for the output project were:&lt;br /&gt;
* Add an element library to Moodle (A page in Moodle listing all of the renderables and how they look in the current theme).&lt;br /&gt;
* Add a complete set of core renderables that should be capable of completely rendering every new user interface.&lt;br /&gt;
* Update the Output API documentation.&lt;br /&gt;
* Create a output guide documentation including best practices.&lt;br /&gt;
&lt;br /&gt;
All of this leans towards making Moodle framework agnostic, so that any frontend framework can be applied to Moodle with as little work as possible.&lt;br /&gt;
&lt;br /&gt;
After reflection and research the decision to use a style of Atomic Design was made. Atomic Design is as you will come to understand later a compartmentalisation approach to interface design that facilitates simplicity and re-use.&lt;br /&gt;
&lt;br /&gt;
===Atomic Design, Renderables and Moodle===&lt;br /&gt;
&lt;br /&gt;
Renderables have been around for a long time now, they were one of the initial preferred means of creating reusable output components.&amp;lt;br /&amp;gt;&lt;br /&gt;
As of Moodle 2.8 there is a new kid on the block, Elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
Elements within Moodle is based upon the Atomic Design principles outlined by Brad Frost in his [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic Design blog post] and can be one of three distinct types in Moodle, they are either Atoms, Molecules, or Organisms.&amp;lt;br /&amp;gt;&lt;br /&gt;
These elements are within Moodle actually renderables by inheritance, all elements (atoms, molecules, and organisms) must have an associated render method to produce HTML, but more on that later.&lt;br /&gt;
&lt;br /&gt;
Lets look at the three types of elements within Moodle.&lt;br /&gt;
&lt;br /&gt;
====Atoms====&lt;br /&gt;
&lt;br /&gt;
Atoms are the smallest part of the puzzle. Easily understood as HTML elements, an image, a table, list etc.&amp;lt;br /&amp;gt;&lt;br /&gt;
Individually they offer very little, but are essential as they are what all larger things are built out of.&lt;br /&gt;
&lt;br /&gt;
Simply - Atoms don&#039;t serve any explicit purpose nor do they provide any interaction, they are just building blocks.&lt;br /&gt;
&lt;br /&gt;
====Molecules====&lt;br /&gt;
&lt;br /&gt;
Molecules are the combination of atoms into structures that begin to form part of the picture.&amp;lt;br /&amp;gt;&lt;br /&gt;
Atoms by themselves aren&#039;t useful, but by sticking a few of them together we create a molecule.&amp;lt;br /&amp;gt;&lt;br /&gt;
Think of molecules as simple objects that the user can interact with for a single purpose, a login prompt (title + two inputs + a button), a search form (title + input + button), or a menu (several links).&lt;br /&gt;
&lt;br /&gt;
Simply - Molecules provide a single interaction or purpose. They are constructed of Atoms only.&lt;br /&gt;
&lt;br /&gt;
====Organisms====&lt;br /&gt;
&lt;br /&gt;
Organisms make things interesting, the are more complex than molecules but not so clearly differentiated.&amp;lt;br /&amp;gt;&lt;br /&gt;
An organism is a construct of molecules that when combined together form a distinct part of an interface.&amp;lt;br /&amp;gt;&lt;br /&gt;
They tend to both interesting, and obviously more than a molecule.&amp;lt;br /&amp;gt;&lt;br /&gt;
The following are examples of molecules:&lt;br /&gt;
* A navigation bar containing a title, some navigation, and a user picture.&lt;br /&gt;
* A user content block (like a forum post) containing a user picture, a title, some content, and a date.&lt;br /&gt;
* A Moodle block containing a header, some actions, content, and a footer.&lt;br /&gt;
&lt;br /&gt;
Simple - Organisms can group several purposes or interactions into one related structure. They are constructed of Molecules.&lt;br /&gt;
&lt;br /&gt;
====What about templates and pages?====&lt;br /&gt;
&lt;br /&gt;
Atomic Design defines two additional compartmentalisations, templates and pages.&amp;lt;br /&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Templates&#039;&#039;&#039; it states are the grouping of predominantly organisms into a structure, think of it like a layout. It is organisation without content.&amp;lt;br /&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Pages&#039;&#039;&#039; are specific instances of the above templates, loaded with content as the user would see them.&lt;br /&gt;
&lt;br /&gt;
In regards to Moodle neither of these two ideas is explicitly dealt with, both ideas however are already partly included in Moodle in the form of theme layouts and current renderers.&amp;lt;br /&amp;gt;&lt;br /&gt;
Pages are a direct match to this approach, content in Moodle is dynamic and those layouts are where the output and content is joined.&amp;lt;br /&amp;gt;&lt;br /&gt;
Templates on the other hand are partly covered by layouts (for the page as a whole), and partly covered by renderers.&lt;br /&gt;
&lt;br /&gt;
Renderers form part of that picture because it is within a script that things are assembled.&amp;lt;br /&amp;gt;&lt;br /&gt;
Again as of Moodle 2.8 with the work on output a best practices guide for renderers has been written which will outline how best to write renderers to match our chosen approach and why they should be written as such.&lt;br /&gt;
&lt;br /&gt;
===How we made this fit within the Moodle dodecahedron===&lt;br /&gt;
&lt;br /&gt;
Within Moodle we&#039;ve decided to use the terminology from the Atomic Design approach. As discussed above templates and pages are not explicitly handled within Moodle, however atoms, molecules, and organisms are.&amp;lt;br /&amp;gt;&lt;br /&gt;
Class auto-loading has being used, and as these things belong to the Output API they have been organised by namespace under classes/output.&lt;br /&gt;
&lt;br /&gt;
The following are the base structures:&lt;br /&gt;
&lt;br /&gt;
; core\output\element implements renderable : This is the absolute bottom unit, it can only be utilised by the core Output API. It contains basic functionality to all atoms, molecules and organisms.&lt;br /&gt;
; core\output\atom extends element : This matches the Atomic Design atom concept. It is a basic building block often equating to just a single HTML tag.&amp;lt;br /&amp;gt;Within Moodle we don&#039;t created atom classes for each HTML tag. That approach was considered but the clutter, the classes it would introduce, and the render methods for those classes was deemed to outweigh the advantages having them would provide. Instead in many cases our smallest &amp;quot;renderable&amp;quot; element will be the molecule.&lt;br /&gt;
; core\output\molecule extends element : This matches the Atomic Design molecule concept. It serves a single purpose/interaction and can consist of atoms (as properties) but because we don&#039;t have classes/objects for every atom can also in some situations contain no atom objects at all.&lt;br /&gt;
; core\output\organism extends element : This matches the Atomic Design organism concept. It is a collection of other molecules and atoms, and can have serve several purposes and/or interactions that have all being grouped under a single umbrella, this organism.&lt;br /&gt;
&lt;br /&gt;
All of these base structure are abstract and cannot be directly instantiated. Instead actual atoms, molecules, and organisms must derive from one of atom, molecule, or organism.&amp;lt;rb /&amp;gt;&lt;br /&gt;
The element class is deemed to be internal to the Output API and therefore cannot be extended outside of the core Output API (at least the integrators won&#039;t accept it).&lt;br /&gt;
&lt;br /&gt;
===The importance of inheritance in rendering===&lt;br /&gt;
&lt;br /&gt;
By now you have a good picture of how we&#039;ve organised output in Moodle in 2.8.&amp;lt;br /&amp;gt;&lt;br /&gt;
What is left to discuss is the importance of this hierarchy and its impact on how we produce output in renderers.&lt;br /&gt;
&lt;br /&gt;
We know that Atoms form Molecules, which in turn form Organisms.&amp;lt;br /&amp;gt;&lt;br /&gt;
We try to apply this same inheritance within our renderers so that when you render an organism we start by producing the encompassing structure, then for each of the molecules that make it up we render on each. This passes the molecule to its own render method to produce the molecule. The same goes for the molecules that contain atoms, we produce the structure for the molecule and call render on each atom at the appropriate time for the structure.&amp;lt;br /&amp;gt;&lt;br /&gt;
Through this means there should in the perfect world scenario be one way to render each organism, molecule, and atom. Thus when a theme designer wishes to change how the search molecule looks for instance they need only change the render method for that one molecule, and every place that molecule is used, either stand alone or as part of a larger organism will be updated at the same time.&lt;br /&gt;
&lt;br /&gt;
Unfortunately, with the present state of Moodle themes this idea of having the minimal possible render methods to produce the most consistent output is but a pipe-dream.&amp;lt;br /&amp;gt;&lt;br /&gt;
However as time goes on that will slowly correct itself, as more of Moodle is converted and themes begin to develop with this new approach.&amp;lt;br /&amp;gt;&lt;br /&gt;
For the time being the consistency that having a specific set of elements and the organisation of those elements is going to be a big win.&lt;br /&gt;
&lt;br /&gt;
==The element library==&lt;br /&gt;
&lt;br /&gt;
Hopefully you are already familiar with the element library in Moodle; if not then you really should take a look at it and get to understand what is it doing.&lt;br /&gt;
&lt;br /&gt;
The element library is a very important piece in the puzzle that is Output within Moodle.&amp;lt;br /&amp;gt;&lt;br /&gt;
It shows how an element looks in one or more scenarios, the scenarios usually revolving around varying contents.&lt;br /&gt;
&lt;br /&gt;
==Designing and writing an element==&lt;br /&gt;
&lt;br /&gt;
A step by step approach to working through the creation and rendering of an element so that it meets the Output standards for Moodle.&amp;lt;br /&amp;gt;&lt;br /&gt;
If you want a quick overview of what to do have a look at the [[#Peer-review checklist|peer-review checklist]] in the next section&lt;br /&gt;
&lt;br /&gt;
===Step 1: Are you sure you need to create an element===&lt;br /&gt;
We want Moodle to contain a limited number of elements. The problem that existed before this work was that every bit of code was creating its own output, and we do not want to end up back there.&lt;br /&gt;
&lt;br /&gt;
The very first thing to do is to be absolutely sure that you need to create this element.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Atoms and molecules&#039;&#039;&#039;&lt;br /&gt;
After the initial release this should be rare. It should be especially rare that you need to write an atom or molecule for a plugin.&amp;lt;br /&amp;gt;&lt;br /&gt;
Moodle should provide 95% of the atoms and molecules you could ever need. However if you have something that is truly new and unique in some way then perhaps indeed you do need to write an element.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Organisms&#039;&#039;&#039;&lt;br /&gt;
Writing an organism is going to be a common requirement. Within core there may be a finite number of organisms, only increasing as new Moodle elements are created and new interfaces added. However when creating plugins or updating output in existing plugins it is very likely that new organisms will be created. If you have an interface in a plugin that is somehow unique to that plugin then you have a organism.&lt;br /&gt;
&lt;br /&gt;
In both cases it is important that you search through the elements already in Moodle and see if there are any that meet your needs.&amp;lt;br /&amp;gt;&lt;br /&gt;
If there is something close in Moodle core already then perhaps you need to adjust your design to make use of the existing element rather than introducing something similar but slightly different.&amp;lt;br /&amp;gt;&lt;br /&gt;
If you find an element you could use in a core plugin then you should create an issue in our Tracker and request that the element be moved from the plugin to core.&amp;lt;br /&amp;gt;&lt;br /&gt;
Then for the time being copy the element from the plugin you found it in, into your plugin. This way it will look consistent, you can use it and if it does get accepted into core you don&#039;t have to change anything about how you use it.&lt;br /&gt;
&lt;br /&gt;
===Step 2: Define the element===&lt;br /&gt;
&lt;br /&gt;
It very important to be sure of what you want to create.&lt;br /&gt;
&lt;br /&gt;
The first thing to do is to work out what is it going to be, is it an atom, a molecule, or an organism?&amp;lt;br /&amp;gt;&lt;br /&gt;
Remember the following, they describe each of those in a single sentence:&lt;br /&gt;
; Atom : A basic building block that severs no purpose or interaction.&lt;br /&gt;
; Molecule :  Serves just a single purpose OR interaction, not usually a part of an interface by itself, grouped with other molecules and atoms to form an organism. &lt;br /&gt;
; Organism : A part of the interface, it is constructed of molecules and atoms, it can facilitate several like purposes and interactions&lt;br /&gt;
&lt;br /&gt;
It should be possible to create a flow chart to aid this decisions, unfortunately one has not being created yet.&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve decided what type of element it is going to be you are ready to start designing what other elements (if any) will make it up.&lt;br /&gt;
&lt;br /&gt;
Now is a good time to be very clear about the purpose of your element, as well as any interactions that you want it facilitate.&lt;br /&gt;
Consider writing down a clear and concise description of your element and sharing what you are planning in the forums, with colleagues or just generally with other developers.&lt;br /&gt;
This output approach is still fresh and we are all still learning how it works in detail so the more exposure you can get now the easier it will be down the track.&lt;br /&gt;
&lt;br /&gt;
When thinking about your element try to think about it is a blueprint to what you want to display. When displaying an actual something it is populated by data and that data is then used by a render method of a renderer to produce HTML.&lt;br /&gt;
Think about where that data is coming from, think about the renderer best practices, think about the style guide, and think about what others may and will do when overriding a renderer to override your render method.&lt;br /&gt;
&lt;br /&gt;
There are two additional important concepts to consider at this point as well, attributes and properties. Important enough to have their own heading so as to be easily found.&lt;br /&gt;
&lt;br /&gt;
====Attributes====&lt;br /&gt;
These are HTML attributes. It may be very very tempting to set attributes like classes and ID&#039;s within an element. But please do not.&amp;lt;br /&amp;gt;&lt;br /&gt;
Attributes should only be added to an element by the renderer. They may be added by any one of the three types of render methods you&#039;ll read about later.&lt;br /&gt;
&lt;br /&gt;
The reason for this is that we want the renderer to be solely responsible for translating an element to HTML. An instance of an element is simply a catalyst for the data contained within.&lt;br /&gt;
&lt;br /&gt;
Within a renderer attributes can be interacted with as follows:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// A publicly accessable array of attributes. Key =&amp;gt; Value.&lt;br /&gt;
$element-&amp;gt;attributes;&lt;br /&gt;
&lt;br /&gt;
// Set an attribute on the element.&lt;br /&gt;
$element-&amp;gt;set_attribute($key, $value);&lt;br /&gt;
&lt;br /&gt;
// Set an array of attributes on the element;&lt;br /&gt;
$element-&amp;gt;set_attributes(array(key1 =&amp;gt; value, key2 =&amp;gt; value));&lt;br /&gt;
&lt;br /&gt;
// Addes a CSS class to the attributes&lt;br /&gt;
$element-&amp;gt;add_class(&#039;some-class&#039;);&lt;br /&gt;
&lt;br /&gt;
// Returns the attributes as a string suitable for use in HTML output.&lt;br /&gt;
$element-&amp;gt;get_attributes();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Properties====&lt;br /&gt;
Talking about properties here I am not talking about class properties of the element that are used to contain data.&amp;lt;br /&amp;gt;&lt;br /&gt;
I am talking about the properties that describe the instance of the element. To get your head around this consider a menu that has several items within it. There are three common properties added by default to all elements that are applicable here:&lt;br /&gt;
&lt;br /&gt;
; active : A boolean property, set this to true if this item points to the current page. The active item.&lt;br /&gt;
; enabled : A boolean property again, set to true this says that the item is enabled and the user can perform the associated action. Set to false is like saying the user cannot interact with this menu item.&lt;br /&gt;
; dimmed : A Moodle-esq property. Set to true if the item is visible to the current user but not to every other user. Think of it like viewing a hidden course because you have the capability to.&lt;br /&gt;
&lt;br /&gt;
Properties can be added, and set by either a parent element, or a renderer if need be. They are used to convey properties that are applicable only in certain situations.&amp;lt;br /&amp;gt;&lt;br /&gt;
The ability for an element to add properties to its subelements allows us more re-use of elements within renderers so that we don&#039;t need dedicated objects in situations where it is simply a property or two that differs from an available element.&lt;br /&gt;
&lt;br /&gt;
Properties can be interacted with the following methods and properties:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// Publicly accessable array of properties. Key =&amp;gt; Value.&lt;br /&gt;
$element-&amp;gt;properties;&lt;br /&gt;
&lt;br /&gt;
// Add a property to this element.&lt;br /&gt;
$element-&amp;gt;add_property(name, value);&lt;br /&gt;
&lt;br /&gt;
// Add an array of properties to this element.&lt;br /&gt;
$element-&amp;gt;add_properties(array(n1 =&amp;gt; value, n2 =&amp;gt; value));&lt;br /&gt;
&lt;br /&gt;
// Sets the value of a property.&lt;br /&gt;
$element-&amp;gt;set(name, value);&lt;br /&gt;
&lt;br /&gt;
// Gets the value of a property.&lt;br /&gt;
$element-&amp;gt;get(name);&lt;br /&gt;
&lt;br /&gt;
// Returns true is a property is set and is not empty.&lt;br /&gt;
$element-&amp;gt;is(name);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Step 3: Create the element class===&lt;br /&gt;
&lt;br /&gt;
Creating an element is really quite simple, the following headings explain what you need to know.&lt;br /&gt;
Remember if in doubt there are a lot of examples that can be easily found in Moodle core (within lib/output).&lt;br /&gt;
&lt;br /&gt;
====Element location====&lt;br /&gt;
All elements belong to the Output API and should be namespaced within it for autoloading and consistency with Moodle core elements.&lt;br /&gt;
This makes locating elements very easy, core elements will be located within an output subdirectory of the classes directory as shown below:&lt;br /&gt;
&lt;br /&gt;
: lib/classes/output/&#039;&#039;&#039;myelement.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Plugin elements will be located in a similar fashion within an output subdirectory of the classes directory. e.g.&lt;br /&gt;
&lt;br /&gt;
: mod/&#039;&#039;myplugin&#039;&#039;/classes/&#039;&#039;&#039;myelement.php&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Class name and inheritance====&lt;br /&gt;
Classes are namespaced for the output API and located in the file above. Because classes are namespaced the actual class name is simply the element name. The same name as was used for the file.&lt;br /&gt;
They must however extend the appropriate element type, if you are creating a molecule it must extend &#039;&#039;\core\output\molecule&#039;&#039;, if its an organism it must extend &#039;&#039;\core\output\organism&#039;&#039;.&lt;br /&gt;
For following is an example of how this would look for a core element:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
namespace core\output;&lt;br /&gt;
defined(&#039;MOODLE_INTERNAL&#039;) || die();&lt;br /&gt;
&lt;br /&gt;
class myelement extends organism {&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And for an element you are creating within a module plugin:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
namespace mod_myplugin\output;&lt;br /&gt;
defined(&#039;MOODLE_INTERNAL&#039;) || die();&lt;br /&gt;
&lt;br /&gt;
class myelement extends \core\output\organism {&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Class properties====&lt;br /&gt;
&lt;br /&gt;
We like to keep elements simple to interact with. For that reason we encourage people to store data and subelements that will be used during rendering as public class properties.&lt;br /&gt;
This is done so that data is accessed in a consistent fashion when interacting with an element. For this reason we would rather &#039;&#039;&#039;not&#039;&#039;&#039; see developers adding methods to an element unless truly required.&lt;br /&gt;
&lt;br /&gt;
Subelements are a good example. If you were writing a navigation bar organism for example you may have a title molecule, a menu molecule, and a search molecule. The title, menu and search molecules are the elements.&amp;lt;br /&amp;gt;&lt;br /&gt;
These will become public class properties of your element.&lt;br /&gt;
&lt;br /&gt;
====Class methods====&lt;br /&gt;
&lt;br /&gt;
Elements should only have methods to support their own construction. As expressed above all information useful to a renderer should be stored in publicly accessible properties, none of it should have to be accessed via method calls.&lt;br /&gt;
This is done so that interaction with elements is consistent across all elements. Methods to aid the construction of the element are encouraged so that information can be easily added to the element.&lt;br /&gt;
&lt;br /&gt;
====Your constructor====&lt;br /&gt;
The constructor for your element should allow the developer to pass in the required data and subelements.&lt;br /&gt;
Consider when writing the constructor how developers will pass information into the element. In many cases there are going to be two types of data that will commonly be passed in:&lt;br /&gt;
# Elements (or arrays of) that make up parts of your element.&lt;br /&gt;
# Scalars (or arrays of) e.g. strings, integers, floats and booleans.&lt;br /&gt;
&lt;br /&gt;
Make the data that is absolutely required part of the constructor and simply have publicly accessible properties for the optional data that can be set by calling code if required.&lt;br /&gt;
&lt;br /&gt;
Its also worth considering if you are creating a molecule that perhaps data handling for the atoms that make it up may be worth including in your constructor.&amp;lt;br /&amp;gt;&lt;br /&gt;
For instance a dropdown consists of a trigger element (button, link, image) and a menu, the menu is a molecule that consists of items. The constructor of the dropdown could aid construction by accepting two arguments, the first a way to pass in a trigger, and the second either an already build menu element OR an array of items that get used to construct a menu element within the dropdown constructor.&lt;br /&gt;
&lt;br /&gt;
Some points to remember:&lt;br /&gt;
* Don&#039;t forget all properties should default to null if they do not have data set.&lt;br /&gt;
* If you have a collection of something as a property consider adding add_xxx() and add_xxxs() methods to aid the construction of elements.&lt;br /&gt;
&lt;br /&gt;
===Step 4: Write the render methods===&lt;br /&gt;
&lt;br /&gt;
There are 3 categories of render methods that will exist within every renderer and depending upon the type of your element you will be creating one or more of these methods for it.&lt;br /&gt;
&lt;br /&gt;
Why the three types of render method? There are two key reasons to take the above apporach.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Re-use&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
By ensuring we call the render method to produce elements and subelements when ever possible we will hopefully be making it easier to style Moodle as it won&#039;t be necessary to style absolutely everything individually. Instead if render has being used consistently to produce a button for example styling the HTML produced by &#039;&#039;render_button()&#039;&#039; should style all buttons throughout Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make overriding renderers in themes more controlable&#039;&#039;&#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
The three types of render methods are designed to separate the logic and display that is permissable in renderers.&amp;lt;br /&amp;gt;&lt;br /&gt;
Render method should contain as little logic and PHP as possible, however in many situations a bit of PHP and perhaps a bit of logic is going to be required in order to take data from one form and make it ready to present.&amp;lt;br /&amp;gt;&lt;br /&gt;
If overriding a renderer within a theme the theme developer can look at what they want to achieve and choose the suitable method to override.&amp;lt;br /&amp;gt;&lt;br /&gt;
If they are looking to change the markup for an element then they can override the render method, they will not need to know anything about how the element was constructed or what information went into it. They can focus on the data the element has and produce the HTML they desire.&amp;lt;br /&amp;gt;&lt;br /&gt;
If they choose to change data, or want to display something different to what is there by default then they can override the translator method and continue to hack away to their hearts content.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hopefully as you read about the render methods below the advantages to this approach will become clear.&lt;br /&gt;
&lt;br /&gt;
====Render method====&lt;br /&gt;
&lt;br /&gt;
This is the easiest to understand and no matter what type of element you have created you will need to write a render method.&lt;br /&gt;
The render method takes an element and returns HTML to display it.&lt;br /&gt;
&lt;br /&gt;
The render method takes a strict format:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Produce HTML to display myelement.&lt;br /&gt;
 *&lt;br /&gt;
 * @param \core\output\myelement $myelement The element to display.&lt;br /&gt;
 * @return string An HTML version of the element.&lt;br /&gt;
 */&lt;br /&gt;
protected function render_myelement(\core\output\myelement $myelement) {&lt;br /&gt;
    // Generate HTML for the element.&lt;br /&gt;
    return $html;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following are rules to follow when creating a render method.&lt;br /&gt;
&lt;br /&gt;
* It display the element, nothing else.&lt;br /&gt;
* It is a protected method.&lt;br /&gt;
* The name of the method is always &amp;quot;render_&amp;quot; followed by the &#039;&#039;&#039;non-namespaced&#039;&#039;&#039; name of your element.&lt;br /&gt;
* There is only ever &#039;&#039;&#039;one&#039;&#039;&#039; argument, the element to render and it should be typehinted.&lt;br /&gt;
* It will contain no logic.&lt;br /&gt;
* It uses the public properties of the element for data.&lt;br /&gt;
* It supplments this by using the available methods &#039;&#039;&#039;ONLY IF ABSOLUTELY REQUIRED&#039;&#039;&#039;&lt;br /&gt;
* It returns a string, the HTML to display the element.&lt;br /&gt;
&lt;br /&gt;
This method is very simple to understand, and providing you have properly researched and proposed your element it should be even easier to write.&lt;br /&gt;
&lt;br /&gt;
If you are writing a render method for molecule or organism then you likely will have subelements that have being used within your element.&lt;br /&gt;
Where possible you should call &#039;&#039;&#039;$this-&amp;gt;render()&#039;&#039;&#039; on the subelements to produce HTML for them that can then be included in the HTML that you are producing for your element.&lt;br /&gt;
Only if you absolutely must should you handle the generation of HTML for subelements directly within the render method for your element.&amp;lt;br /&amp;gt;&lt;br /&gt;
If you do produce the HTML for a subelement without calling render than &#039;&#039;&#039;you must&#039;&#039;&#039; manually call the subelements &#039;&#039;prerender&#039;&#039; method to ensure that it has an opertunity to complete and requisits it has before rendering.&lt;br /&gt;
&lt;br /&gt;
This is done to ensure that where possible we re-use the HTML for an element. By doing it we reduce the number of elements that a theme must style if all it is doing is styling.&amp;lt;br /&amp;gt;&lt;br /&gt;
If a theme overrides a render method it is not obligated to take this same approach. Theme overridden renderers can do as they please, any duplication of structure they introduce is their own business.&lt;br /&gt;
&lt;br /&gt;
====Convenience method====&lt;br /&gt;
&lt;br /&gt;
The name for this type of method provide a big hint as to what it is, it is a method to conveniently construct and render an instance of your element.&lt;br /&gt;
This method also takes a very simple, predicatable form.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create and render a new myelement.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mixed $arg1&lt;br /&gt;
 * @param mixed $arg2&lt;br /&gt;
 * @param mixed $arg3&lt;br /&gt;
 * @return string HTML for myelement.&lt;br /&gt;
 */&lt;br /&gt;
public function myelement($arg1, $arg2, $arg3 = null) {&lt;br /&gt;
    $obj = new \core\output\myelement($arg1, $arg2, $arg3);&lt;br /&gt;
    return $this-&amp;gt;render($obj);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This type of method always does three things:&lt;br /&gt;
# It takes the arguments necessary to create a new instance of myelement.&lt;br /&gt;
# It creates a new instance of myelement given the arguments it is given and sets it up as required.&lt;br /&gt;
# It calls &#039;&#039;&#039;$this-&amp;gt;render()&#039;&#039;&#039; and gives it the object, returning the outcome.&lt;br /&gt;
&lt;br /&gt;
There are a few things to observe when writing a convenience method:&lt;br /&gt;
# It is always public.&lt;br /&gt;
# Its arguments should be complete.&lt;br /&gt;
#* Meaning that they should be arguments that can be immediately to the element &lt;br /&gt;
#* OR can be checked in conditions to alter the element.&lt;br /&gt;
#* They should not be objects to support the generation of data. The data should be complete.&lt;br /&gt;
# It should &#039;&#039;&#039;not&#039;&#039;&#039; produce any HTML itself, the render method is responsible for this.&lt;br /&gt;
# It returns a string, the HTML to display for the given element.&lt;br /&gt;
&lt;br /&gt;
In the case of molecules and organisms it is permissable for the convencience method to take actual subelements OR the arguments required to create necessary subelements. This is at the discretion of the developer and may be determinent on the number of arguments required to construct the element.&amp;lt;br /&amp;gt;&lt;br /&gt;
Complex elements that require a lot of data to set up are probably not ideal candidates to create convenience methods for.&lt;br /&gt;
&lt;br /&gt;
====Translator method====&lt;br /&gt;
&lt;br /&gt;
These methods take complex arguments such as data and objects from outside of the Output scope and manipulate/smooth the data into a complex organism or molecule.&amp;lt;br /&amp;gt;&lt;br /&gt;
They should be used to pass in the information the current element requires as well as any information that may be used by an overriding renderer to access additional data that may be desired.&lt;br /&gt;
&lt;br /&gt;
These are likely to be rare for core elements, however just about essential for elements being introduced by plugins for example where having retrieving data from plugin objects for use in an element or subelements is going to be required.&amp;lt;br /&amp;gt;&lt;br /&gt;
If for example you consider how your would render a forum discussion the translator method would likely take a forum discussion object and use a method of it to retrieve a nested array of forum posts that can then be used to create a discussion element, and its post subselements.&lt;br /&gt;
&lt;br /&gt;
Just like the above convenience method the translator method should not produce HTML itself, instead it should create the necessary element and any required subelements before calling &#039;&#039;&#039;$this-&amp;gt;render()&#039;&#039;&#039; on the subelement.&lt;br /&gt;
&lt;br /&gt;
Its important to note the pupose of having these methods as renderer methods and not having them abstracted to another layer of your code.&amp;lt;br /&amp;gt;&lt;br /&gt;
Because these methods exist within the renderer they can overridden by the theme in order to change the information that is used to construct the elements. This is also why translator methods should be given arguments that not just relate to what you immediately require for your idea of output, but also closely related things that may be required for others who wish to change the output.&lt;br /&gt;
&lt;br /&gt;
===Step 5: Enhance your output with JavaScript===&lt;br /&gt;
If you&#039;ve planned to add JavaScript to your project then now is the time to look at achieving this.&lt;br /&gt;
&lt;br /&gt;
This section needs a lot more work, there is a tracker issue [https://tracker.moodle.org/browse/MDL-45854 MDL-45854 Define and document JavaScript output guide] which once complete should make writing this section easy.&lt;br /&gt;
&lt;br /&gt;
Some notes for the time being:&lt;br /&gt;
* JavaScript should be initialised by the renderer within the render method.&lt;br /&gt;
* Simple element_actions can be attached to elements by calling &#039;&#039;$element-&amp;gt;add_js_action()&#039;&#039;.&lt;br /&gt;
* When attaching events to an element it should be done by ID.&lt;br /&gt;
* When delegating events to an element it should be done using a data attribute &#039;&#039;&#039;data-enhance=&amp;quot;action&amp;quot;&#039;&#039;&#039; which requires the JS selector &#039;&#039;[data-enhance=&amp;quot;action&amp;quot;]&#039;&#039;&lt;br /&gt;
* If you need an ID on your element for JS call &#039;&#039;&#039;$element-&amp;gt;require_id()&#039;&#039;&#039; which will generate an ID if one is not present (remember you are enhancing you can&#039;t assume one has or has not been set already)&lt;br /&gt;
* JS should follow our [[JavaScript guidelines]]&lt;br /&gt;
&lt;br /&gt;
===Step 6: Write generator samples===&lt;br /&gt;
More to come here as the [[Element_Library]] evolves.&lt;br /&gt;
&lt;br /&gt;
===Step 7: Style those samples in bootstrapbase and base===&lt;br /&gt;
&lt;br /&gt;
Hopefully when designing your element you have already considered how it is going to look, and had taken into consideration what is available in at least bootstrap base.&amp;lt;br /&amp;gt;&lt;br /&gt;
Because you have already written the element generator in the steps above you can easily refer to the element library when styling your element and testing.&lt;br /&gt;
&lt;br /&gt;
Its recommended to start with bootstrapbase as this is the scaffolding theme that our default theme &#039;&#039;clean&#039;&#039; is build upon.&lt;br /&gt;
All CSS for your element within the bootstrapbase theme should be added to &#039;&#039;&#039;theme/bootstrapbase/less/output_elements.less&#039;&#039;&#039; and be written in hierarchical less so that it is clear which styles apply to your element.&amp;lt;br /&amp;gt;&lt;br /&gt;
The CSS should be preceeded by a clear heading that identifies which element the styles belong to as well.&lt;br /&gt;
&lt;br /&gt;
It is also necessary to style the element in the base theme.&amp;lt;br /&amp;gt;&lt;br /&gt;
All CSS for your element within the base theme should be added to &#039;&#039;&#039;theme/base/style/element.css&#039;&#039;&#039; and like above should preceeded by a clear heading that identifies which element the styles belong to.&lt;br /&gt;
&lt;br /&gt;
The actual Less/CSS should be styled according to our [[User:Sam Hemelryk/CSS style guidelines|CSS style guidelines]]&lt;br /&gt;
&lt;br /&gt;
===Step 8: Write tests===&lt;br /&gt;
&lt;br /&gt;
Both acceptance and unit tests may be applicable to your element depending upon what you&#039;ve done, and just like all of new code arriving for Moodle tests are now an expectation.&lt;br /&gt;
You can not of course create tests to automatically check the display of your element, however the element library facilitates a user manually doing that.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PHPUnit tests&#039;&#039;&#039;&lt;br /&gt;
If your constructor contains any logic for smooth data into its properties then this should certainly be tested.&amp;lt;br /&amp;gt;&lt;br /&gt;
Likewise if you&#039;ve added any methods to aid the construction of your element they should be tested as well.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Acceptance tests&#039;&#039;&#039;&lt;br /&gt;
These are particularly applicable if your element facilitates any kind of interaction. If so then it is worthwhile creating a test scenario for this interaction.&amp;lt;br /&amp;gt;&lt;br /&gt;
If the interaction triggers a visual response, like clicking a button and a dropdown appears then this can be easily tested within the element library.&amp;lt;br /&amp;gt;&lt;br /&gt;
If a more complex interaction is taking place then you should consider writing a test that belongs to a code that makes use of your element.&lt;br /&gt;
For instance if your element is a search form and it is used within the forum consider writing an acceptance test for the forum testing your element if there is not already one there.&lt;br /&gt;
&lt;br /&gt;
===Step 7: Use your element===&lt;br /&gt;
Congratulations! At this point you have written your element, you&#039;ve written the required renderer methods and supporting generators and tests.&amp;lt;br /&amp;gt;&lt;br /&gt;
You are now ready to use your element within your code.&lt;br /&gt;
&lt;br /&gt;
==Peer-review checklist==&lt;br /&gt;
The following is a checklist guide of what to look for when reviewing an element and/or element render methods.&lt;br /&gt;
Items already on the peer-review checklist have being excluded.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;The element class&#039;&#039;&#039;&lt;br /&gt;
 [ ] The file is located in classes/output/elementname.php&lt;br /&gt;
 [ ] Autoloading is used, the file has not being included anywhere.&lt;br /&gt;
 [ ] The element is correctly namespaced to the Output API (namespace core\output OR mod_plugin\output).&lt;br /&gt;
 [ ] The element name is accurate to its function and concise.&lt;br /&gt;
 [ ] It is a unique element and not a duplicate of another element.&lt;br /&gt;
 [ ] It extends either atom, molecule or organism&lt;br /&gt;
 [ ] All data used during rendering is accessed through public properties.&lt;br /&gt;
 [ ] All public properties of the class are data that can be used during rendering.&lt;br /&gt;
 [ ] All optional public properties (not set within the constructor) default to null.&lt;br /&gt;
 [ ] All/any methods the class has aid in its construction (importantly they don&#039;t return data)&lt;br /&gt;
 &#039;&#039;&#039;Styles for a core element&#039;&#039;&#039;&lt;br /&gt;
 [ ] The element has being styled in at least the bootstrapbase and base themes.&lt;br /&gt;
 [ ] The styles in bootstrap base have being added to theme/bootstrapbase/less/output_elements.less&lt;br /&gt;
 [ ] Bootstrapbase styles have been written in less format and are preceeded by a clear heading of the element they belong to.&lt;br /&gt;
 &#039;&#039;&#039;Styles for a plugin element&#039;&#039;&#039;&lt;br /&gt;
 [ ] The element has being styled in at least the bootstrapbase and base themes.&lt;br /&gt;
 &#039;&#039;&#039;Renderer&#039;&#039;&#039;&lt;br /&gt;
 [ ] Does the renderer conform to the [[User:Sam Hemelryk/Renderer best practices|Renderer best practices]]?&lt;br /&gt;
 &#039;&#039;&#039;Renderer - render method (required)&#039;&#039;&#039;&lt;br /&gt;
 [ ] A method has being written.&lt;br /&gt;
 [ ] The method is protected.&lt;br /&gt;
 [ ] The method takes a single argument, an element and and adequate typehint is in place.&lt;br /&gt;
 [ ] The method contains no logic, no globals.&lt;br /&gt;
 [ ] The method returns HTML.&lt;br /&gt;
 &#039;&#039;&#039;Renderer - convenience method (optional)&#039;&#039;&#039;&lt;br /&gt;
 [ ] The method is public.&lt;br /&gt;
 [ ] All arguments are complete arguments (see above docs for details)&lt;br /&gt;
 [ ] Contains no logic other than data smoothing if absolutely required.&lt;br /&gt;
 [ ] Does not produce any HTML itself.&lt;br /&gt;
 [ ] Call &#039;&#039;&#039;$this-&amp;gt;render($element);&#039;&#039;&#039; and returns the output.&lt;br /&gt;
 &#039;&#039;&#039;Renderer - translator method (optional)&#039;&#039;&#039;&lt;br /&gt;
 [ ] The method is public.&lt;br /&gt;
 [ ] Logic is minimal and the related to smoothing data from arguments into elements.&lt;br /&gt;
 [ ] Produces a single element only/&lt;br /&gt;
 [ ] Produces no HTML itself.&lt;br /&gt;
 [ ] Call &#039;&#039;&#039;$this-&amp;gt;render($element);&#039;&#039;&#039; and returns the output.&lt;br /&gt;
&lt;br /&gt;
==Tracker issues==&lt;br /&gt;
The following tracker issues relate in one way or another to the development and continued work on Output.&lt;br /&gt;
&lt;br /&gt;
* MDL-45885 Decide how output elements (the issue that saw this document created)&lt;br /&gt;
* MDL-45770 Implement stage 1 tasks from the Render Library specification&lt;br /&gt;
* MDL-41663 Allow renderers and renderables in a namespace to be auto loaded.&lt;br /&gt;
* MDL-45828 Create the element library admin tool.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Render library specification]] - The original output specification for Moodle 2.8&lt;br /&gt;
* [[Output element planning]] - Thoughts on initial elements that should be created.&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Render_library_specification&amp;diff=45913</id>
		<title>Render library specification</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Render_library_specification&amp;diff=45913"/>
		<updated>2014-07-22T11:39:30Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Documents created as part of this spec */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45770&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
== Project Goals ==&lt;br /&gt;
* Add an element library to Moodle (A page in Moodle listing all of the renderables and how they look in the current theme)&lt;br /&gt;
* Add a complete set of core renderables that should be capable of completely rendering every new user interface&lt;br /&gt;
* Update the Output API documentation&lt;br /&gt;
* Create a output guide documentation including best practices.&lt;br /&gt;
&lt;br /&gt;
== Benefits ==&lt;br /&gt;
* Make it easier to create user interfaces.&lt;br /&gt;
* Make it easier to style the user interface.&lt;br /&gt;
* Make it easier for themers to customise the user interface.&lt;br /&gt;
* Better facilitate frontend frameworks in Themes.&lt;br /&gt;
* Better facilitate usable and accessible design.&lt;br /&gt;
* Give Moodle a more consistent look and feel.&lt;br /&gt;
* Improve site performance by reducing the CSS footprint.&lt;br /&gt;
&lt;br /&gt;
==Understanding renderers in Moodle==&lt;br /&gt;
&lt;br /&gt;
Renderers have been around since Moodle 2.0 and are now the requirement when writing any code that produces output.&lt;br /&gt;
Renderers come in many shapes and forms depending upon the developers take on how output should be produced.&lt;br /&gt;
&lt;br /&gt;
When renderables were introduced - the API was designed to make it easy for existing code to be updated to make use of renderers and renderables. A renderable is an interface with no methods, so any existing class could be made to implement renderable. This means that the renderable class can be a mixture of data and methods that perform logic associated with the module. This also means that the renderer can call those methods on the renderable class - effectively using the API of the module. The problem with this - is that it complicates the renderer and makes it harder to override in a theme - the themer requires knowledge about the API for the module. Some renderables in core are built as separate classes - only used for the purpose of supplying data to the renderer - here there is a clear separation of the logic - and the properties of the renderable are made up of only simple types that can be checked for in the renderer - e.g. access checks are done in advance and the result is put into a boolean in the renderable. The current renderers / renderables in Moodle are a mixture of these styles.&lt;br /&gt;
&lt;br /&gt;
Because there is no mandated organisation, nor has there ever been, there is immense variation in what constitutes content to a renderer. &lt;br /&gt;
&lt;br /&gt;
One of the upsides to our current render system is that you are not limited to having a single renderer for a component, you can make use of language capabilities and the output framework and create layers of renderers to cut back code duplication and to aid in preparing a base for consistent structuring and output.&lt;br /&gt;
&lt;br /&gt;
Into the equation we add targets and subtypes. Targets allow us to create both standard renderers and renderers specific to the needs of the output method. Standard being HTML, without output methods including CLI, AJAX, HTML email and plain text email.&lt;br /&gt;
&lt;br /&gt;
People have never being constrained as to how they implement a renderer. We&#039;ve being happy enough to simply guide them towards using renderers because of the benefits they provide and while there are numerous benefits there are two fundamental benefits:&lt;br /&gt;
&lt;br /&gt;
; A change in thinking : It requires developers to think about their code organisation. Renderers were introduced in a time before Object Orientation was used in Moodle, and logic and output were tightly intermingled in most code. Renderers were about separating logic and design and while what was created was not always perfect it was always an improvement.&lt;br /&gt;
&lt;br /&gt;
; An extensible approach to output : The render system allows for the overriding of renderers to occur. Theme designers can overwrite any renderer in their theme. The more that renderers that get implement the more of Moodle you can customise.&lt;br /&gt;
&lt;br /&gt;
==Understanding themes==&lt;br /&gt;
&lt;br /&gt;
Themes are without a doubt the most widely customised plugin provided by Moodle. But we are currently struggling with several problems with renderers and themes as they are being implemented currently.&lt;br /&gt;
&lt;br /&gt;
1. There is no strict relationship between the HTML generated by a renderable, and the accompanying CSS that is required to make it display properly. The HTML is coded in the renderer - and then the CSS is added, either directly to the styles.css for the plugin in an unorganised way - or directly in the CSS in the theme - again in a loosely organised way. There is no systematic way to determine if any line of CSS is still in use - and there is no simple way to find the CSS that requires updating when the HTML is updated. &lt;br /&gt;
&lt;br /&gt;
2. The CSS framework (bootstrap 2, bootstrap 3, zurb, pureio) specific attributes for renderables are currently being hardcoded in the HTML generated by the renderables. This prevents themers from using a different framework without creating an impossible amount of work to overwrite every renderer in Moodle.&lt;br /&gt;
&lt;br /&gt;
==So what is the problem==&lt;br /&gt;
&lt;br /&gt;
There are several. Lets be blunt about this. This specification is not a single task. It is about improving the state of output in Moodle and there are going to be several steps in achieving this. On a positive note these steps can in many cases be broken down into granular tasks that can be worked on asynchronously.&lt;br /&gt;
First lets understand some of the major problems:&lt;br /&gt;
* We have no established best practices, nor even documentation on what constitutes a good renderer, or considerations that should be paid mind in planning and designing of code.&lt;br /&gt;
* We have no established style guide, nor pattern library, nor element library, nor anything that could be referenced when someone starts building a new user interface - or creating a new theme.&lt;br /&gt;
* Inconsistency - because of a lack of best practice documentation and examples, there is huge variation in the design of our different modules. Different modules exhibit different problems such as a mixing of logic and output and code duplication.&lt;br /&gt;
* Developers are encouraged to push functionality boundaries in order to take it places observed in other projects or to challenge oneself. While consistency is often talked about it is rarely observed when designing output. We end up with numerous &amp;quot;similar&amp;quot; looking widgets all functioning slightly differently and consequently there is a feeling that this is the way to achieve a new fresh look. (E.g. we have multiple implementations of a &amp;quot;toolbar&amp;quot; - one in Atto and one in EditPDF).&lt;br /&gt;
* Existing renderer implementations vary widely and in many cases contain logic they should not. Access checks, database queries, object manipulations. All of which should not be present as it introduces muddling of concepts and logic that must be duplicated and then maintained for anyone overriding renderers.&lt;br /&gt;
* Themers have a mammoth task at present in applying a consistent style to Moodle, or in choosing to implement a new frontend framework (bootstrap, foundation, pureio etc). Our lack of organisation in the output leaves a lot to be desired. Having the theme responsible for choosing a frontend framework is the right way to handle this, however backend Moodle doesn&#039;t support themeing as well as it should be/could be.&lt;br /&gt;
* On top of the above it introduces a need to override several renderers should you want to create a consistent style and because of inconsistent renderer implementations this can easily lead to a maintenance nightmare. E.g. the user_picture renderable is not used in mod_forum - so there is no way to override it there.&lt;br /&gt;
* JavaScript introduces problems of its own. We are doing more and more with JavaScript these days. However there is a heavy dependence on the output that gets produced and the JavaScript enhancing it. In a lot of cases the relationship is ill defined and due to the complexity and structure of the JavaScript overriding the output structure of the rendered component is completely impossible for all but the most experienced developers.&lt;br /&gt;
* Inline with the above we lack good examples and documentation on how to deliver output templates for JavaScript User Interfaces as well as the creation, and manipulation of HTML structures that are enhanced by JavaScript.&lt;br /&gt;
&lt;br /&gt;
== Identified issues==&lt;br /&gt;
There is a general trend in the problems noted, when looking at output we lack organisation, documentation, and consistency across the board. However the actual issues we are focusing on in this spec can be identified as below:&lt;br /&gt;
&lt;br /&gt;
* Lack of a style guide / element library / pattern library.&lt;br /&gt;
** Leading to inconsistent output and style.&lt;br /&gt;
** Increased workload due to usability and accessibility thinking and testing needing to occur repetitively.&lt;br /&gt;
** Increased workload due to multilang (rtl) support usually coming after the designs of new output.&lt;br /&gt;
* Inconsistent renderer implementations.&lt;br /&gt;
** Lack of best practices.&lt;br /&gt;
** Lacking plus outdated documentation.&lt;br /&gt;
** Logic-full renderers greatly hinder theming.&lt;br /&gt;
** An unnecessarily increased requirement to understand both PHP and Moodle code as each renderer differs and are usually poorly documented.&lt;br /&gt;
* No abstraction from CSS framework.&lt;br /&gt;
** Without organised structure classes are applied in a chaotic fashion leading to the requirement to duplicate core styles.&lt;br /&gt;
** As there is no core styles newly created output widgets need to be styled in all base themes leaving chance of design regressions occurring in predominantly major upgrades but occasionally minor releases as well.&lt;br /&gt;
** Inconsistent output structure ensures CSS quickly balloons as styles need to be both created and copied to several areas.&lt;br /&gt;
* Poor linking between UI components and the JavaScript.&lt;br /&gt;
** Ill-defined link between output and the JavaScript enhancing it.&lt;br /&gt;
** No common technique to template UIs generated by javascript&lt;br /&gt;
&lt;br /&gt;
==Manageable Tasks==&lt;br /&gt;
The following are the major tasks we have identified so far. These tasks can be though of as Epic&#039;s, or tasks for which we will create subtasks (if this output specification itself becomes an Epic).&lt;br /&gt;
Within this section will include notes and implementation ideas on the major tasks we&#039;ve identified.&lt;br /&gt;
&lt;br /&gt;
* [[#Define the elements that make up Moodle|Choose an output methodology and begin defining core elements]]&lt;br /&gt;
* [[#Element library and style guide|Create an element library and accompanying style guide]]&lt;br /&gt;
* [[#Style guide|Create a style guide document]]&lt;br /&gt;
* [[#Define and document renderer best practices|Define and document renderer best practices]]&lt;br /&gt;
* [[#Define and update the JS documentation|Update the JavaScript documentation]]&lt;br /&gt;
* [[#Update renderer documentation|Update renderer documentation]]&lt;br /&gt;
* [[#Update theme documentation and theme tutorials|Update theme documentation and theme tutorials]]&lt;br /&gt;
* [[#Progressively convert renderers|Progressively convert renderers]]&lt;br /&gt;
&lt;br /&gt;
===Define the elements that make up Moodle===&lt;br /&gt;
There are several tasks that will go into this, but the first and most important will be deciding upon an organisational methodology. Some way to compartmentalise the Moodle output.&lt;br /&gt;
At present a reducing granularity system is looking the most appealing. Go and read [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic Design] written by Brad Frost - it describes very well the type of compartmentalisation we are proposing.&lt;br /&gt;
&lt;br /&gt;
Once a system has being chosen the following tasks can be tackled:&lt;br /&gt;
* Identify the layers we require.&lt;br /&gt;
* Define the boundaries and responsibilities of those layers.&lt;br /&gt;
* Identify the initial set of elements, likely the finest granularity first as I imagine starting at the bottom and working up will be the best way to proceed.&lt;br /&gt;
&lt;br /&gt;
Further elements (those relating to Moodle will be defined as part of the element library work).&lt;br /&gt;
&lt;br /&gt;
===Element library and style guide===&lt;br /&gt;
Draft docs for element library tool: [[Element_Library]]&lt;br /&gt;
&lt;br /&gt;
Add an admin tool that can show a categorised list of renderable objects for each plugin/and core - filled with test data. The goal of this tool is to:&lt;br /&gt;
&lt;br /&gt;
* Provide a page for themers to check that their new theme correctly displays all the renderables&lt;br /&gt;
* Provide a page for developers to see all the reusable renderables (in a well defined structure) they can use when building their own pages&lt;br /&gt;
&lt;br /&gt;
The tasks here will be:&lt;br /&gt;
* Spec the element library tool with regard to our chosen element methodology.&lt;br /&gt;
* Create the element library tool.&lt;br /&gt;
* Establish a definition method of elements, and compositions of elements as renderables.&lt;br /&gt;
* Define the core elements from the task above in code somehow and verify the element library tool reveals them.&lt;br /&gt;
* Finally define a comprehensive list of low level widgets we can add to core as renderables. This is a library of components that should be used by other renderers (by compositing them). E.g. list, table, warning, grid. These renderables should be structured into layers, starting from renderables that cannot be broken into smaller parts, up to widgets made of smaller renderables, up to layouts (and possibly up to entire pages).  Sources for this list should come from:&lt;br /&gt;
** Existing CSS Frameworks (bootstrap, pureio) (but must be framework agnostic)&lt;br /&gt;
** Existing renderables in Moodle that we see as “perfect” already (maybe there are some)&lt;br /&gt;
** Existing patterns in Moodle that we do over and over but don’t have a renderable for yet&lt;br /&gt;
&lt;br /&gt;
On top of this there is functionality that would be great to add to it:&lt;br /&gt;
&lt;br /&gt;
* Validate that the renderer/renderable follows best practice (no DB queries, complex types, complex logic)&lt;br /&gt;
* Provide responsive testing immediately within the tool. Adjusting the viewing area on queue to allow both developers and designers to experience how the individual renderables respond in varying presentation medias.&lt;br /&gt;
* Provide language direction testing immediately within the tool. Like the above allow designers and developers to quickly experience a renderable in a different language directions.&lt;br /&gt;
* Renderable linear reporting. So that you can see which other renderables make use of this renderable and which renderables get used by this renderable. This will be hugely helpful in judging impact when themeing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Thoughts on naming===&lt;br /&gt;
&lt;br /&gt;
We will need to define useful names for the different categories of renderables so that we can effectively organise them and provide guidelines for writing each type - the names are a small part of this solution but will possibly be a point for contention. Different frameworks have different names for these things and people will prefer something that sounds like something they are already using.&lt;br /&gt;
&lt;br /&gt;
(draft!) Categories for renderables - taken straight from Atomic design&lt;br /&gt;
&lt;br /&gt;
http://bradfrostweb.com/blog/post/atomic-web-design/&lt;br /&gt;
&lt;br /&gt;
* Atoms == Tiny reusable elements that cannot be broken down into smaller elements&lt;br /&gt;
* Molecules == Relatively simple combinations of atoms built for reuse&lt;br /&gt;
* Organisms == Organisms are groups of molecules joined together to form a relatively complex, distinct section of an interface.&lt;br /&gt;
* Templates == Layout files in a theme&lt;br /&gt;
* Pages == The actual pages in Moodle&lt;br /&gt;
&lt;br /&gt;
Refs for categorizing patterns&lt;br /&gt;
* http://bradfrostweb.com/blog/post/atomic-web-design/&lt;br /&gt;
* http://oocss.org/&lt;br /&gt;
* http://alistapart.com/blog/post/getting-started-with-pattern-libraries&lt;br /&gt;
* http://style.codeforamerica.org/&lt;br /&gt;
&lt;br /&gt;
===Style guide===&lt;br /&gt;
This has two real advantages.&lt;br /&gt;
&lt;br /&gt;
# First assuming this will be developed initially while defining the elements that will make up Moodle output and will aid us in verifying what we are doing. If it can be easily documented then we are on the right track. If we start encountering to many conditions and or too much variation then we are drifting off track.&lt;br /&gt;
# When defining new elements we are able to use our style guide to do so and it&#039;ll provide us measure of how Moodle output evolves.&lt;br /&gt;
&lt;br /&gt;
===Define and document renderer best practices===&lt;br /&gt;
&lt;br /&gt;
This will be tricky and no doubt how we decide to define a best practice will have to have regard for the output methodology we choose.&lt;br /&gt;
&lt;br /&gt;
===Update the JavaScript documentation===&lt;br /&gt;
&lt;br /&gt;
Discuss and agree on a best practice for writing JS that depends on HTML structures in the DOM (e.g. progressive enhancement - or just ids for action listeners) (perhaps a specific renderable for a JS region)&lt;br /&gt;
&lt;br /&gt;
===Update renderer documentation===&lt;br /&gt;
This will of course need to be done after the element library and renderer best practices but should be pretty simple at that point.&lt;br /&gt;
* Read and rate each of the existing docs pages (see related links below)&lt;br /&gt;
* Write new complete docs for everyone (at [[Output API]])&lt;br /&gt;
* Cross link old docs to the new ones&lt;br /&gt;
&lt;br /&gt;
===Update theme documentation and theme tutorials===&lt;br /&gt;
There are likely the most well documented plugin type within Moodle. There are good specification docs, good 2.0 conversion docs and good tutorials on many aspects of theming.&lt;br /&gt;
Many of these pages will need to be updated to reflect best practices and such after we start ticking off some of the other tasks.&lt;br /&gt;
&lt;br /&gt;
===Progressively convert renderers===&lt;br /&gt;
This is the very last task really - but we will start work on it in parallel with creating the new set of core renderables (to prove the design is usable). There is no deadline for this to be complete - and it will take a long time to convert all the existing renderers (and code not using renderers).&lt;br /&gt;
&lt;br /&gt;
== Notes on renderers / renderables ==&lt;br /&gt;
Proposed improvements to the docs on renderers / renderables.&lt;br /&gt;
First - the docs need an overhaul to more clearly explain how renderers / renderables work for core devs, plugin devs and themers. There needs to be clearer guidelines for the things that can be done in a renderable, and in a renderer.&lt;br /&gt;
&lt;br /&gt;
Goals for renderers - should be devoid of logic for these reasons:&lt;br /&gt;
* Theme overridden renderers do not need to be updated when logic is changed&lt;br /&gt;
* Themers can override renderers without understanding all the logic&lt;br /&gt;
* Renderables can be filled with mock data for display in the element library&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;good renderer&amp;quot; is:&lt;br /&gt;
* Receives some “data” through a renderable&lt;br /&gt;
* Produces some “output”&lt;br /&gt;
* Where “output” is some HTML and any javascript init calls&lt;br /&gt;
* Can use basic PHP functions/loops, like for(), foreach(), count()&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;good renderer&amp;quot; is not:&lt;br /&gt;
* nasty php logic (or even non-nasty php logic)&lt;br /&gt;
* access checks&lt;br /&gt;
* non-trivial function calls&lt;br /&gt;
* using any Moodle functions not related to output&lt;br /&gt;
* calling the database&lt;br /&gt;
&lt;br /&gt;
A “renderable” is:&lt;br /&gt;
* All the data required to generate the output.&lt;br /&gt;
* Properties should be simple data types only, or renderables, or array of those&lt;br /&gt;
&lt;br /&gt;
== Evaluations of some existing renderers / renderables ==&lt;br /&gt;
Existing renderer styles - because there are few rules/guidelines for how renderers should be written - there are differing examples of renderers in core. Looking at the 3 of the better maintained modules to see how they are implemented will be useful in evaluating the benefits of any stricter rules for renderers.&lt;br /&gt;
=== Assign ===&lt;br /&gt;
Contains a list of renderables (in renderables.php) and a single renderer. The logic is mostly out of the renderer methods (pre-calculated and added as data to the renderer). There are some cases when renderables could be broken down further - e.g. the expand/collapse on the submission history (mod/assign/yui/src/history/js/history.js). Also the assignment sub-plugins do not use renderers (and they should).&lt;br /&gt;
&lt;br /&gt;
=== Quiz ===&lt;br /&gt;
Uses a lot of renderers - but not renderables. The renderer methods directly call methods of the business logic to determine what to display. e.g. &amp;quot;attemptobj-&amp;gt;get_access_manager(time())-&amp;gt;attempt_must_be_in_popup()&amp;quot;. This is not terrible for a themer trying to override a renderer method because the calls are mostly simple - but it is a grey area for when this becomes business logic in the renderer (and would e.g. need updating to fix bugs etc). If we want to add these renderer methods to the element library - it would require a way to pass mock business logic classes to the renderer methods (and a way for the generator to return a renderer and a method - instead of only a renderable).&lt;br /&gt;
&lt;br /&gt;
=== Workshop ===&lt;br /&gt;
Very nice renderers and renderables in workshop. Would only need updating to re-use core renderables instead of using html_writer directly - and adding the existing renderables to the element library.&lt;br /&gt;
&lt;br /&gt;
=== Badges ===&lt;br /&gt;
Mix of renderer methods and renderables. This is similar to quiz where the renderer is calling lots of methods of the business model in the renderer methods and has the same effect (harder to override, maintain etc). To add these renderer methods to the element library would require the same sort of changes as mentioned in quiz.&lt;br /&gt;
&lt;br /&gt;
== Example of forum post renderer using composition ==&lt;br /&gt;
This is not a real example (yet), it&#039;s just a demonstration of the type of renderers we should be aiming for (using composition etc). This structure would be created in the render_form_post method of the forum renderer. This method would receive a forum_post renderable containing only data - and build up this structure of smaller renderable components, then return the result of calling render(x) on each of the smaller renderables. &lt;br /&gt;
&lt;br /&gt;
[[Image:forumpost-renderer-breakdown.png|center|500px|Example forum renderer]]&lt;br /&gt;
&lt;br /&gt;
== Initial thoughts on renderables and what we should provide (Draft) ==&lt;br /&gt;
This list is not intended to be the final list - it is more of a scoping exercise. One of the tasks from this project is to decide on the full set of required renderables. &lt;br /&gt;
There are several renderables within Moodle that have being included in this table and we will need to look closely at how they fit within our chosen model and whether they are still required.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name&lt;br /&gt;
! Description&lt;br /&gt;
! Source (links)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu&lt;br /&gt;
| UI component for a drop down edit menu&lt;br /&gt;
| Existing renderable (should be renamed &amp;quot;menu&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link&lt;br /&gt;
| UI component for a menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_filler&lt;br /&gt;
| UI component for a filler menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_primary&lt;br /&gt;
| UI component for a primary menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_secondary&lt;br /&gt;
| UI component for a secondary menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_link&lt;br /&gt;
| Link with alt text, and an icon&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| single_button&lt;br /&gt;
| A form with a single button&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| confirm&lt;br /&gt;
| A form with a message and cancel/confirm buttons&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| single_select&lt;br /&gt;
| A form with a single drop down list that submits on change&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| url_select&lt;br /&gt;
| A navigation element consisting of a single drop down list of urls that navigates on change&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| doc_link&lt;br /&gt;
| A link to the Moodle docs&lt;br /&gt;
| Existing renderer method&lt;br /&gt;
|-&lt;br /&gt;
| pix_icon&lt;br /&gt;
| A small icon&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| emoticon_icon&lt;br /&gt;
| A small emoticon&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| heading_with_help&lt;br /&gt;
| A page heading with a link to help docs&lt;br /&gt;
| Existing renderer method&lt;br /&gt;
|-&lt;br /&gt;
| help_icon&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| help_icon_scale&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| user_picture&lt;br /&gt;
| A user profile picture which links to their profile&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| container&lt;br /&gt;
| A block level element used to surround something. Can have a class to allow specific targeting with CSS.&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| error_text&lt;br /&gt;
| An error to show to the user.&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| notification&lt;br /&gt;
| A message for the user&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| continue_button&lt;br /&gt;
| A message and a button to continue to the next page&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| paging_bar&lt;br /&gt;
| A list of next previous and specific page links&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| skip_link_to&lt;br /&gt;
| A link to a section on the page&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| skip_link_target&lt;br /&gt;
| A target for a matching skip_link_to call&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| heading&lt;br /&gt;
| A page heading&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| box&lt;br /&gt;
| A page section with a border&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| rarrow&lt;br /&gt;
| A right arrow&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| larrow&lt;br /&gt;
| A left arrow&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| tabtree&lt;br /&gt;
| A list of tabs&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| tabobject&lt;br /&gt;
| A single tab panel&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| toolbar *new&lt;br /&gt;
| A container for toolbar button groups&lt;br /&gt;
| Bootstrap equiv btn-toolbar (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| toolbar-group *new&lt;br /&gt;
| A group of toolbar buttons&lt;br /&gt;
| Bootstrap equiv btn-group (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| toolbar-button *new&lt;br /&gt;
| A toolbar button&lt;br /&gt;
| Bootstrap equiv btn (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| toolbar-menu *new&lt;br /&gt;
| A toolbar button that opens a drop down menu&lt;br /&gt;
| Bootstrap equiv nested btn-groups (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| navbar *new&lt;br /&gt;
| The navigation bar that shows at the top of the page&lt;br /&gt;
| Bootstrap equiv navbar - There is an existing renderer method that needs converting into renderables&lt;br /&gt;
|-&lt;br /&gt;
| navbar_item *new&lt;br /&gt;
| Items in the navigation bar that shows at the top of the page&lt;br /&gt;
| Bootstrap equiv list item in a navbar - There is an existing renderer method that needs converting into renderables&lt;br /&gt;
|-&lt;br /&gt;
| navbar_item *new&lt;br /&gt;
| Items in the navigation bar that shows at the top of the page&lt;br /&gt;
| Bootstrap equiv list item in a navbar - There is an existing renderer method that needs converting into renderables&lt;br /&gt;
|-&lt;br /&gt;
| progress_bar *new&lt;br /&gt;
| A bar showing progress of something&lt;br /&gt;
| Bootstrap equiv progress_bar - There is an existing moodle class that needs converting to use renderables&lt;br /&gt;
|-&lt;br /&gt;
| progress_bar *new&lt;br /&gt;
| A bar showing progress of something&lt;br /&gt;
| Bootstrap equiv progress_bar - There is an existing moodle class that needs converting to use renderables&lt;br /&gt;
|-&lt;br /&gt;
| panel *new&lt;br /&gt;
| A container with a heading and borders&lt;br /&gt;
| Bootstrap equiv panel, panel-heading, panel-body, panel-footer&lt;br /&gt;
|-&lt;br /&gt;
| vertical-list *new&lt;br /&gt;
| A vertical list of items&lt;br /&gt;
| Bootstrap equiv - list-group&lt;br /&gt;
|-&lt;br /&gt;
| horizontal-list *new&lt;br /&gt;
| A horizontal list of items&lt;br /&gt;
| Bootstrap equiv - list-inline&lt;br /&gt;
|-&lt;br /&gt;
| Two column list *new&lt;br /&gt;
| Short cut for a list of pairs with the left column fixed-width and right aligned&lt;br /&gt;
| Similar to our current moodle forms&lt;br /&gt;
|-&lt;br /&gt;
| table (and cells headings etc) * new&lt;br /&gt;
| We need to convert tablelib to use renderers to output all table elements&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| forms (and labels, inputs etc) * new&lt;br /&gt;
| We need to convert formslib to use renderers to output all form elements&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| grids *new&lt;br /&gt;
| We need to support renderables for a simple responsive grid system&lt;br /&gt;
| Everything has grids...&lt;br /&gt;
|-&lt;br /&gt;
| floats *new&lt;br /&gt;
| We need to support floating elements left and right&lt;br /&gt;
| Bootstrap - pull-left, pull-right&lt;br /&gt;
|-&lt;br /&gt;
| clearfix *new&lt;br /&gt;
| If we have this simple thing as a renderable we can avoid repeating the CSS&lt;br /&gt;
| Bootstrap - clearfix&lt;br /&gt;
|-&lt;br /&gt;
| expandable *new&lt;br /&gt;
| Initially shows only a summary with an expand button to show more details&lt;br /&gt;
| mod_assign&lt;br /&gt;
|-&lt;br /&gt;
| dialog *new&lt;br /&gt;
| Tie into M.core.dialogue so it can be adjusted in a renderer&lt;br /&gt;
| aria&lt;br /&gt;
|-&lt;br /&gt;
| timer *new&lt;br /&gt;
| There is an aria role for this - so we should make sure it is used correctly if required.&lt;br /&gt;
| aria&lt;br /&gt;
|-&lt;br /&gt;
| tree *new&lt;br /&gt;
| Reusable version of the nav tree&lt;br /&gt;
| aria tree, tree-item, tree-grid etc&lt;br /&gt;
|-&lt;br /&gt;
| indent *new&lt;br /&gt;
| (eg threaded forum post)&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| media block *new&lt;br /&gt;
| large media element side by side with some text&lt;br /&gt;
| http://demo.patternlab.io/&lt;br /&gt;
|-&lt;br /&gt;
| hero *new&lt;br /&gt;
| content section with borders/oversized text etc designed to be a landing point&lt;br /&gt;
| Bootstrap jumbotron&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Prototyping ==&lt;br /&gt;
Because there are several ways to implement a renderer/renderable - we have spent some time exploring an example renderer/renderable implementation. What we intended to achieve with these dev branches is an implementation of a &amp;quot;menu&amp;quot; and a &amp;quot;list&amp;quot; renderable in several themes, using several CSS frameworks. The frameworks chosen are: Bootstrap 2 (clean), Bootstrap 3, Zurb Foundation and YUI Pure IO. The prototypes both produce exactly the same output (and only a little effort was made to get nice output) - it&#039;s just the implementations we are interested in at this stage. Each prototype branch adds a local plugin with a test page that can be viewed at &amp;quot;/local/output/index.php&amp;quot; and viewed in several themes (clean, output_bs3, output_pureio, output_zurb). &lt;br /&gt;
&lt;br /&gt;
Some different approaches were explored here:&lt;br /&gt;
&lt;br /&gt;
=== Approach A ===&lt;br /&gt;
This design takes a strong objected oriented view of renderables and introduces some concepts of the HTML DOM to the renderables. There is an abstract class core_ui_element which implements renderable, that all the new renderables inherit from. Each core_ui_element has additional properties including a type, a chain of parent types, a list of attributes to be mixed into the html and a generic list of name/value properties. The type variable can influence which renderer method renders this core_ui_element (this requires a core change). The renderer method can adjust the output based on the chain of parent types of the current node, and the properties of the immediate parent. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The concepts applied in this approach:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
; Everything is an element : Everything that forms a part of output will be represented by a class and can be interacted with in a consistent fashion.&lt;br /&gt;
; All elements are renderables : All elements and components inherit from a common core_ui_element class that implements the renderable interface.&lt;br /&gt;
; All elements are also core_ui_elements : The core_ui_element class allows for common functionality across every element and component. It facilitates ownership of one element to another (building complex elements aka components) as well as adding attributes and properties.&lt;br /&gt;
; Attributes : Element objects have attributes, these are of direct relation to HTML attributes, they are managed as a public array and can easily added to and worked with. There is also a helper method on the renderer that turns them into an HTML attribute string that can be put immediately within a tag for ease of use.&lt;br /&gt;
; Properties : These are used for non-renderable attributes of the element. For instance when producing a menu with items that are disabled, and where one item is active. Properties get assigned by the parent element allowing for properties to appear with specific relation to the context the element is appearing in. For example a link can be a menu item, when it is a menu item it has &amp;quot;active&amp;quot; as a property. When it is used elsewhere it does not have that property.&lt;br /&gt;
; Chained render methods : When render is called on a link that is by itself &#039;&#039;render_link&#039;&#039; gets called. When render is called on a link within a menu &#039;&#039;render_menu_link&#039;&#039; gets called, and if it doesn&#039;t exist &#039;&#039;render_link&#039;&#039; gets called. When render is called on a link that is within a menu that is within a dropdown &#039;&#039;render_dropdown_menu_link&#039;&#039; gets called, if that doesn&#039;t exist then &#039;&#039;render_menu_link&#039;&#039; gets called and so on and so forth. Through this chaining you can override the individual elements within a complex component using predictable means.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Pros&#039;&#039;&#039;&lt;br /&gt;
* All elements take on a predictable, consistent structure through the core_ui_element.&lt;br /&gt;
* The magic gets rolled into the core_ui_element class so that elements need only publish the public properties that they consist of, any any helper methods used in the construction of the object or in setting its properties. There is no need to add any more logic than that.&lt;br /&gt;
* Absolutely all logic not associated with producing output to the needs of the theme gets rolled into the element objects. When rendering an element in most cases you should only need to render the structure for the element and then call render on its properties in the order you want.&lt;br /&gt;
* It will be very easy to deem good interfaces from bad as anything that is not consisting of core_ui_elements will not be an ideal interface.&lt;br /&gt;
* It will be very easy to see in code when writing a renderer what elements are available as each will be a class.&lt;br /&gt;
* Its a clean approach - we will be able to do things as we believe is correct without concern of getting in the way of existing practises.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cons&#039;&#039;&#039;&lt;br /&gt;
* There is going to be a lot of classes. I don&#039;t mean hundreds, but we may end up with over a hundred easily enough.&lt;br /&gt;
* Complexity of knowing PHP. In order to override a renderer you will need to know enough about PHP to understand what an object is.&lt;br /&gt;
* This is a completely new approach, while it provides clean separation from current practices it is yet another learning curve.&lt;br /&gt;
* There is a potential limitation if you have multiple elements of the same time occurring within a component each that needs to be rendered differently. I&#039;ve not actually thought of a use case for this yet, but am mentioning it as something to be investigated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Branch details&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To view this branch at github:&lt;br /&gt;
    https://github.com/samhemelryk/moodle/tree/output_prototype&lt;br /&gt;
&lt;br /&gt;
To get a copy of this code into your own local repository run the following commands:&lt;br /&gt;
    git checkout -b output_prototype&lt;br /&gt;
    git fetch &amp;lt;nowiki&amp;gt;http://github.com/samhemelryk/moodle.git&amp;lt;/nowiki&amp;gt; output_prototype&lt;br /&gt;
    git reset --hard FETCH_HEAD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Viewing it in your browser&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# First get a copy of the code into your local repository.&lt;br /&gt;
# Browse to your site and turn on allowthemechangeonurl (Settings &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme settings)&lt;br /&gt;
# To view in clean: browse to /local/output/index.php?theme=clean&lt;br /&gt;
# To view with Bootstrap 3: browse to /local/output/index.php?theme=output_bs3&lt;br /&gt;
# To view with YUI Pureio: browse to /local/output/index.php?theme=output_pureio&lt;br /&gt;
# To view with Zurb foundation: browse to /local/output/index.php?theme=output_zurb&lt;br /&gt;
&lt;br /&gt;
=== Approach B ===&lt;br /&gt;
This design requires as little change to the existing code/implementations as possible. The idea, is simply to add a new list of renderables / renderer methods that implement the new things. There is no abstract class for renderables with no additional properties etc. Additionally, there are no restrictions on what can be put in a list/menu etc - it really is a just a list of renderables/strings. There is an edge case here, which is &amp;quot;How can a renderer method for a container modify the HTML for the elements it contains?&amp;quot;. An example of this is that the Bootstrap 3 theme wants to put the role=&amp;quot;menuitem&amp;quot; on the first link in each of the elements in it&#039;s &amp;quot;items&amp;quot; list. There are several possible approaches here - and this is one of the points of difference of this branch. One approach (too nasty) is to perform a str_replace on the first &amp;quot;&amp;lt;a&amp;quot; in the rendered html from the item - the downside of this approach is that it doesn&#039;t allow for differences in syntax for links, or merging with existing attributes on a link - it is doomed to fail. The approach chosen for this branch, is to parse the rendered html from the item into a DOMDocument - and use Dom manipulation to amend to the link before rendering it back to a string. There is a util method that takes this complexity out of the renderer method (and we can add more util methods as needed). &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$attributes = array(&#039;role&#039;=&amp;gt;&#039;menuitem&#039;, &#039;tabindex&#039;=&amp;gt;&#039;-1&#039;);&lt;br /&gt;
$newitemhtml = dom_utils::add_attributes_to_first_node_of_type(&#039;a&#039;, $attributes, $itemhtml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Branch details: git pull http://github.com/damyon/moodle.git MENU_RENDERABLE&lt;br /&gt;
&lt;br /&gt;
==Documents created as part of this spec==&lt;br /&gt;
* [[Output element planning]] - Thoughts on initial elements that should be created.&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Output API]]&lt;br /&gt;
* [[Migrating your code to the 2.0 rendering API#Outputting HTML specific to your module]]&lt;br /&gt;
* [[Output_renderers]]&lt;br /&gt;
* [[Overriding_a_renderer]]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=177535 Forum discussion on renderers]&lt;br /&gt;
* [[Renderer]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Output_element_planning&amp;diff=45912</id>
		<title>Output element planning</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Output_element_planning&amp;diff=45912"/>
		<updated>2014-07-22T11:38:55Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45829&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
This page documents the proposed core elements, variations of them, what we expect they will contain, and the core_renderer block.&lt;br /&gt;
&lt;br /&gt;
==The user action==&lt;br /&gt;
&lt;br /&gt;
An action in this sense is a collection of data that all pertains to one action that can be taken by the user.&lt;br /&gt;
The action, once populated with data can be rendered as is required for the job it is going to fulfil, usually with some relation to the frontend framework in use.&lt;br /&gt;
In this way the action could be a link, or a button; it could even be interpreted into a more complex structure.&lt;br /&gt;
&lt;br /&gt;
An action has the following properties:&lt;br /&gt;
; content [string]: text content for the link or button.&lt;br /&gt;
; url [moodle_url] : the url for the action to take when the user interacts with this action.&lt;br /&gt;
; description : a description of the action. Typically used within a title or alt attribute.&lt;br /&gt;
; active : True if this is the action the user is current performing.&lt;br /&gt;
; enabled : True if the action is possible, false if it is not possible and should be shown as disabled.&lt;br /&gt;
; dimmed : True if the action should be shown as dimmed, usually used to the action is hidden to other users.&lt;br /&gt;
; method : The preferred method of submitting this action, typically GET but can be set to POST.&lt;br /&gt;
&lt;br /&gt;
It is also possible to add JavaScript actions (component_action objects) to an action. These attach a JS listener to the action that gets executed when the user interacts with the action.&lt;br /&gt;
Attached JavaScript actions get initialised when the properties for the action are retrieved so any events must be attached BEFORE the action is rendered, and all renderers must ensure they use the get_attributes() call. &lt;br /&gt;
&lt;br /&gt;
==Grids==&lt;br /&gt;
&lt;br /&gt;
We need to come up with some way to include grids in core, it is desirable to keep it framework agnostic so perhaps a grid object that allows for items to be added and a &amp;quot;width&amp;quot; specified when that occurs. The width would be either a fixed number or a percentage. Steps of 12 seems pretty common.&lt;br /&gt;
&lt;br /&gt;
==Design requirements==&lt;br /&gt;
The following concepts need to be accounted for in core, or decisions made on how we choose to support these and where.&lt;br /&gt;
&lt;br /&gt;
===Clearfix===&lt;br /&gt;
We have this in core already, bootstrap has it, pretty much every front end framework has it.&lt;br /&gt;
Clearfix is more of a design decision, should only be used when require, and only ever applied by a renderer.&lt;br /&gt;
This gets special mention as being important, support is already 100%.&lt;br /&gt;
&lt;br /&gt;
===Floats===&lt;br /&gt;
Pull left, pull right etc. These are a design decisions and should be implemented by the renderer. Bootstrap caters for these and as such they will be easily catered for in bootstrapbase, however work may be required to get them operational in base.&lt;br /&gt;
&lt;br /&gt;
==Discarded ideas==&lt;br /&gt;
The following things are ideas that came up during discussions on what elements are, and what elements we want in core that have being discarded.&lt;br /&gt;
&lt;br /&gt;
==Core atoms, molecules, and organisms==&lt;br /&gt;
&lt;br /&gt;
The following is the atoms, molecules and organisms we believe should be created initially. Of course there will be many more that are required - however this should give us a good grounding of elements to work with for the first conversions.&lt;br /&gt;
&lt;br /&gt;
===Action {atom}===&lt;br /&gt;
See the section above about [[#The user action]]&lt;br /&gt;
&lt;br /&gt;
Actions are special atoms the represent an action the user can make.&lt;br /&gt;
They can be rendered by a theme as a link, a button or I suppose anything else.&lt;br /&gt;
There should be a default for when it is not specified and the renderer in change of producing the current thing can decide whether to use the default and just call &#039;&#039;render&#039;&#039; or if it requires something specific &#039;&#039;render_link&#039;&#039; or &#039;&#039;render_button&#039;&#039; as required.&lt;br /&gt;
&lt;br /&gt;
===Action group {molecule}===&lt;br /&gt;
A group of actions, to be rendered to reflect a relation. I suppose the easiest way to think about this is how buttons in the atto editor are grouped together. It is a requirement that may seem a tad absrtracted and irrelevant at first but I think will pop up in several places throughout Moodle when we start converting.&lt;br /&gt;
&lt;br /&gt;
It is basically a collection of actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#buttonGroups Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/components/#btn-groups Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/button_groups.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
===Block {atom}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle. This represents a block on the page, and is displayed within a [[#Block region]].&lt;br /&gt;
It accepts two arguments, the first is a &#039;&#039;block_contents&#039;&#039; object instance, and the second is the region name the block instance is being shown within.&lt;br /&gt;
&lt;br /&gt;
At present a block is rendered using the &#039;&#039;&#039;&#039;&#039;core_render::block&#039;&#039;&#039;&#039;&#039; method. Internally this calls several renderer methods to produce the different parts of a block.&lt;br /&gt;
* core_renderer::block_header - Produces a header&lt;br /&gt;
** core_renderer::block_controls - Produces controls to display within the header.&lt;br /&gt;
* core_renderer::block_content - Produces the actual content of the block.&lt;br /&gt;
** core_renderer::block_controls - Used to check if block controls were rendered. PUKE!!!&lt;br /&gt;
** core_renderer::block_footer - Produces a footer that actually resides within the content.&lt;br /&gt;
* core_renderer::block_annotation - Produces an annotation, used VERY rarely.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output when called for a navigation block with a bit of extra added to show how a footer is displayed and an annotation.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#sb-1&amp;quot; class=&amp;quot;skip-block&amp;quot;&amp;gt;Skip Navigation&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;inst4&amp;quot; class=&amp;quot;block_navigation  block&amp;quot; role=&amp;quot;navigation&amp;quot; data-block=&amp;quot;navigation&amp;quot; data-instanceid=&amp;quot;4&amp;quot; aria-labelledby=&amp;quot;instance-4-header&amp;quot; data-dockable=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;block_action&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;!-- Block actions go here, they are images with JS or anchors--&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;h2 id=&amp;quot;instance-4-header&amp;quot;&amp;gt;Navigation&amp;lt;/h2&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;content&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;!-- Block content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;div class=&amp;quot;footer&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;!-- Block footer content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;blockannotation&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Block annotation content goes here --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;sb-1&amp;quot; class=&amp;quot;skip-block-to&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Block region {molecule}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle, the block region is a contain for all of the blocks in one location.&lt;br /&gt;
We currently have two methods that produce a block region within Moodle, the first is &#039;&#039;&#039;&#039;&#039;core_renderer::blocks_for_region&#039;&#039;&#039;&#039;&#039; which adds no surrounding content.&lt;br /&gt;
The preferred method &#039;&#039;&#039;&#039;&#039;core_renderer::blocks&#039;&#039;&#039;&#039;&#039; adds some embedded information to a common structure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the structure of the &#039;&#039;core_renderer::blocks()&#039;&#039; method.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function blocks($region, $classes = array(), $tag = &#039;aside&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following is the html output is $region was &#039;&#039;pre&#039;&#039; and the default tag and classes were used.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot; data-blockregion=&amp;quot;pre&amp;quot; data-droptarget=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Thoughts on this&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The blocks method is a convenience method and serves an important purpose. However it should not take classes and tag as arguments.&amp;lt;br /&amp;gt;&lt;br /&gt;
These should certainly only settable within the renderer itself, and if themes wish to change this without wrapping the call they should override the renderer.&lt;br /&gt;
&lt;br /&gt;
Both the data attributes relate to servicing JavaScript functionality. Perhaps they should be moved to a component_action or somehow else integrated with JS rather than with the renderer directly.&lt;br /&gt;
&lt;br /&gt;
Internally it is calling blocks for region, however this should change it should request a array of blocks, convert the array to [[#Block]] elements and call render on each.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Proposed HTML structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Much like the current structure but with the data attributes coming through a JS mechanism.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Breadcrumb {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently called the navbar within Moodle, controlled by the &#039;&#039;&#039;&#039;&#039;navbar&#039;&#039;&#039;&#039;&#039; class located in lib/navigationlib.php and rendered by &#039;&#039;&#039;&#039;&#039;core_renderer::navbar()&#039;&#039;&#039;&#039;&#039;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Internally it calls moodle_page-&amp;gt;navbar-&amp;gt;get_items() to get an array containing navigation node items to display in the navigation bar.&amp;lt;br /&amp;gt;&lt;br /&gt;
It produces a bit of surrounding structure before calling render on each item.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following shows the structure for two items in the navigation bar presently within Moodle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;Page path&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;nav class=&amp;quot;breadcrumb-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/nav&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the excessive amount of markup to make the separator accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#breadcrumbs Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#breadcrumbs Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/breadcrumbs.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The currently active page should be marked with a class.&lt;br /&gt;
* The current item should probably not be a link MDL-46037&lt;br /&gt;
* [http://www.w3.org/TR/2007/WD-aria-role-20070601/#breadcrumbs wia-aria breadcrumb role]&lt;br /&gt;
* The divider perhaps could come through CSS with these changes to avoid markup necessary to make it accessible (in combination with the above).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation thoughts&#039;&#039;&#039;&lt;br /&gt;
* Owns an array of [#Action {atoms}]&lt;br /&gt;
&lt;br /&gt;
===Buttons {atom}===&lt;br /&gt;
&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&amp;lt;br /&amp;gt;&lt;br /&gt;
Obviously buttons can serve different purposes and roles so have several easily reachable customisations is probably a wise idea.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
None, presently you produce a button when you need it so there are several throughout Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/base-css.html#buttons Bootstrap 2.3.2] and [http://getbootstrap.com/css/#buttons Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;btn btn-default&amp;quot;&amp;gt;Default&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;btn btn-default btn-lg active&amp;quot; role=&amp;quot;button&amp;quot;&amp;gt;Link&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;input class=&amp;quot;btn btn-default&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Input&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Bootstrap:&lt;br /&gt;
* Purposes: default, primary, success, info, warning, danger, link&lt;br /&gt;
* Sizes: large, default, small, extra-small&lt;br /&gt;
* Block level (wider)&lt;br /&gt;
* States: Active, disabled.&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/buttons.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;button&amp;quot;&amp;gt;Default Button&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Zurb Foundation:&lt;br /&gt;
* Purposes: default, secondary, success, alert&lt;br /&gt;
* Sizes: large, default, small, tiny&lt;br /&gt;
* Corner style: radius, round&lt;br /&gt;
* Expanded (wider)&lt;br /&gt;
* States: disabled&lt;br /&gt;
&lt;br /&gt;
===Calendar {organism}===&lt;br /&gt;
&lt;br /&gt;
A simple idea really, apparently not already covered by the frontend frameworks being referenced during the creation of the doc.&lt;br /&gt;
The display of the calendar is fixed, but it can contain content for each day shown.&lt;br /&gt;
&lt;br /&gt;
The calendar should have several views, perhaps these are separate organisms, perhaps not.&lt;br /&gt;
&lt;br /&gt;
* Compact month&lt;br /&gt;
* Month&lt;br /&gt;
* Week&lt;br /&gt;
* Day&lt;br /&gt;
&lt;br /&gt;
Each day could:&lt;br /&gt;
* Contain an action with an icon for events, and link to the fullday display.&lt;br /&gt;
* Have an associated action to load and display the events in a tooltip.&lt;br /&gt;
&lt;br /&gt;
===Collapsible region {molecule}===&lt;br /&gt;
&lt;br /&gt;
We use these in several places within Moodle. I could not find a reference to this concept in any of the frontend frameworks I looked at.&lt;br /&gt;
The concept is simple - you have a heading and an icon with content. By default the content is hidden, when the user clicks the heading and/or the icon the content is revealed.&lt;br /&gt;
&lt;br /&gt;
As noted we do this in several places within Moodle, it would be good to have a single way of displaying this idea of a collapsible region.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
* It should support an optional collapse/expand all trigger action.&lt;br /&gt;
* We want to be able to use it both inside and outside of forms.&lt;br /&gt;
* It should be usable in situations like the combo list frontpage component as well.&lt;br /&gt;
* Will obviously have a JS component as without JS it would not work.&lt;br /&gt;
&lt;br /&gt;
===Confirmation {molecule}===&lt;br /&gt;
&lt;br /&gt;
A simple concept used regularly in Moodle to confirm a users intention to perform an actions. Most commonly seeing when deleting content.&lt;br /&gt;
The structure is relatively basic in Moodle at present.&lt;br /&gt;
* A message&lt;br /&gt;
* A forwards button&lt;br /&gt;
* A back button&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The method &#039;&#039;&#039;&#039;&#039;core_renderer::confirm&#039;&#039;&#039;&#039;&#039; does the rendering at present. Its signature is as follows:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function confirm($message, $continue, $cancel);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output it produces is like:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;generalbox&amp;quot; id=&amp;quot;notice&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;The message goes here&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Two buttons produced by core_renderer::render_single_button() --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design throughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This component does not have a title. I believe at present some pages use &#039;&#039;core_renderer::heading&#039;&#039; to produce a title if they wish. Obviously we want consistency of style so I believe it would be wise to add a title property that can be optionally set and then in our documentation for this element recommend that a title is always provided.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will mean re-factoring our uses to set a title and if a heading is being manually added remove it.&lt;br /&gt;
&lt;br /&gt;
===Continue {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is much like the confirmation molecule but with a single button.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present we have &#039;&#039;&#039;&#039;&#039;core_renderer::continue_button&#039;&#039;&#039;&#039;&#039; that produces a single button. However this design is very poor as more often than not a message is included in the page to describe the purpose of the continue button. This is really an integral part of the continue button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Currently we have &#039;&#039;core_renderer::continue_button&#039;&#039; to render a single continue button.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function continue_button($url);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally it creates a single_button component and then calls render on that.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
Our element should have a message and a button. To make it easy to migrate the constructor should accept a URL instead of a button and do the same conversion as the current method is doing.&lt;br /&gt;
&lt;br /&gt;
===Choice {molecule}===&lt;br /&gt;
Not sure about this one quite yet.&lt;br /&gt;
A description with 2 or more actions allowing the user to select the next step.&lt;br /&gt;
Think of it like when editing a module you get: Cancel, Save and return to course, Save and display&lt;br /&gt;
&lt;br /&gt;
Perhaps both [#Confirmation {molecule}] and [#Continue {molecule}] should be just instances of this.&lt;br /&gt;
&lt;br /&gt;
Hmm perhaps that would not be as clear as this and we should have this separate choice molecule.&lt;br /&gt;
&lt;br /&gt;
===Divider {atom}===&lt;br /&gt;
Think horizontal rule.&lt;br /&gt;
&lt;br /&gt;
===Dropdowns {molecule}===&lt;br /&gt;
&lt;br /&gt;
So this is a pretty simple concept, but you&#039;ve got to think of it as a separate entity. A dropdown is a menu that appears when the user interacts with an action.&lt;br /&gt;
 &lt;br /&gt;
The action could take one of three forms:&lt;br /&gt;
* From button&lt;br /&gt;
* From link&lt;br /&gt;
* From icon&lt;br /&gt;
&lt;br /&gt;
Of course that is handled by the [#Action {atom}] noted above. Worth noting is that we will need some way to toggle these actions as dropdowns. Perhaps it is worth making that a property of the action atom.&lt;br /&gt;
&lt;br /&gt;
The dropdown itself will likely contain more actions, and I suppose additional dropdowns to form sub menus. Sub-menus in my mind are required. We don&#039;t use them in core, but they are functionally possible through things like the custom menu and I know for a fact that many sites have sub menus.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#dropdowns Bootstrap 2.3.2]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Link or button to toggle dropdown --&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dLabel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#dropdowns Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;button class=&amp;quot;btn dropdown-toggle sr-only&amp;quot; type=&amp;quot;button&amp;quot; id=&amp;quot;dropdownMenu1&amp;quot; data-toggle=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
        Dropdown&lt;br /&gt;
        &amp;lt;span class=&amp;quot;caret&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/button&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dropdownMenu1&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot; class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/dropdown.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; data-dropdown=&amp;quot;drop1&amp;quot;&amp;gt;Has Dropdown&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;ul id=&amp;quot;drop1&amp;quot; class=&amp;quot;f-dropdown&amp;quot; data-dropdown-content&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is a link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Yet another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forms {organism}===&lt;br /&gt;
&lt;br /&gt;
This is an advanced  organism and would be quite a bit of work to create in Moodle as we&#039;d need to translate from QuickForms to elements for rendering.&lt;br /&gt;
It would be worthwhile doing this however, and would be a good way of quickly showing our new work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework structures&#039;&#039;&#039;&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/base-css.html#forms Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/css/#forms Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/forms.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
All of those are quite in-depth and offer a range of configurations.&lt;br /&gt;
We should carefully consider these when analysing our work here.&lt;br /&gt;
&lt;br /&gt;
===Headings {atom}===&lt;br /&gt;
&lt;br /&gt;
Currently handled by &#039;&#039;&#039;core_renderer::heading&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* h1 - h6&lt;br /&gt;
* Optional icon&lt;br /&gt;
* Optional help icon&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method is currently:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function heading($text, $level = 2, $classes = null, $id = null);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output generated by this is, assuming we use the default level, classes, and id.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;I am a heading&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Whats worth noting is that the render method should not accept level and classes as arguments.&lt;br /&gt;
These should only be set by the render method and should not be directly influenced.&lt;br /&gt;
&lt;br /&gt;
===Image {atom}===&lt;br /&gt;
&lt;br /&gt;
There are really two types of images to focus on here, or really two ways to display an image to focus on here.&amp;lt;br /&amp;gt;&lt;br /&gt;
# Standard images&lt;br /&gt;
# Thumbnail images&lt;br /&gt;
&lt;br /&gt;
Each of these would share some common properties:&lt;br /&gt;
* Image&lt;br /&gt;
* Description (alt/title)&lt;br /&gt;
* Size&lt;br /&gt;
* Action (making it a link) - This would actually make it a molecule, we would have to consider this and either have a new element, drop the ability to wrap in an action, or simply ignore this inconsistency.&lt;br /&gt;
&lt;br /&gt;
===Image - Icon {atom}===&lt;br /&gt;
&lt;br /&gt;
This covers the display of an icon. Should be a separate element from image as really they should be treated individually.&lt;br /&gt;
Within Moodle there are a few classifications of icons to consider:&lt;br /&gt;
* Standard icons&lt;br /&gt;
* Help icon (popup, tooltip)&lt;br /&gt;
* Loading icon (really regular icon but worth showing separately as its only seen when required)&lt;br /&gt;
&lt;br /&gt;
===Image - Logo {molecule}===&lt;br /&gt;
&lt;br /&gt;
We don&#039;t have this within core Moodle at present, however just about every theme I have seen uses a logo. I think it is about time we considered having a logo element.&lt;br /&gt;
I imagine it would become a sort of hero element, likely with an associated action (back home by default).&lt;br /&gt;
&lt;br /&gt;
===Image - Profile picture {molecule}===&lt;br /&gt;
&lt;br /&gt;
We already have a user_picture component within Moodle. It can be found in lib/outputcomponents.php.&amp;lt;br /&amp;gt;&lt;br /&gt;
It has two render methods, &#039;&#039;&#039;&#039;&#039;core_renderer::user_picture&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;core_renderer::render_user_picture&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output structure for the user picture:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; id=&amp;quot;userpicture_randomid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;img src=&amp;quot;#&amp;quot; alt=&amp;quot;Picture of Joe&amp;quot; title=&amp;quot;Picture of Joe&amp;quot; class=&amp;quot;userpicture&amp;quot; width=&amp;quot;[35, 100, XX]&amp;quot; height=&amp;quot;[35, 100, XX]&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What you&#039;ll notice about this is that the link has no attributes marking it as a user picture link.&lt;br /&gt;
&lt;br /&gt;
The PHP code for the user_picture object itself is really quite in depth and complex. The component serves the user profile fields required to render a user picture. This is good in the scope of the component but would be bad within the scope of an element.&amp;lt;br /&amp;gt;&lt;br /&gt;
Don&#039;t you wish we had a proper user object!&lt;br /&gt;
&lt;br /&gt;
===Link {atom}===&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&lt;br /&gt;
&lt;br /&gt;
Theres not too much more to explain about links, they don&#039;t tend to take states other than the default active, enabled and dimmed.&amp;lt;br /&amp;gt;&lt;br /&gt;
It is worth mentioning that devs will be encouraged to use actions and not links unless absolutely necessary.&amp;lt;br /&amp;gt;&lt;br /&gt;
The render method for this atom must typehint an action rather than a link.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prototype example&#039;&#039;&#039;&lt;br /&gt;
* The atom: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/link.php&lt;br /&gt;
* The convenience method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L149&lt;br /&gt;
* The render method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L211&lt;br /&gt;
&lt;br /&gt;
===List {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is a pretty simple example and something I am sure you are all familiar with. A list is simply a collection of items. Usually represented using a UL or OL tag in markup although worth noting can be styled completely differently to the default.&lt;br /&gt;
There are three main types of lists used within Moodle:&lt;br /&gt;
* Ordered list&lt;br /&gt;
* Unordered list&lt;br /&gt;
* Presentation list (currently our unlist)&lt;br /&gt;
&lt;br /&gt;
The list is a molecule because it should be able to accept other elements as items. E.g. it should be content independent.&lt;br /&gt;
&lt;br /&gt;
===Menu {molecule}===&lt;br /&gt;
&lt;br /&gt;
A menu is a familiar concept for any site. Probably the first thing that pops to mind for many is the navbar, but I want to consider that a separate component as a navbar can consist of more than just menu items.&lt;br /&gt;
I think a menu should be a collection of actions the user can perform. Perhaps with some form of hierarchy.&lt;br /&gt;
&lt;br /&gt;
We have different types of menus within Moodle:&lt;br /&gt;
* The custom menu is one users can directly create, with dropdown downs and sub dropdowns.&lt;br /&gt;
* The action_menu component we have in core uses icons as actions and can have a dropdown.&lt;br /&gt;
&lt;br /&gt;
These should be combined into a single menu element that takes items as an argument, likely actions + dropdowns + dividers to start with would be perfect.&lt;br /&gt;
&lt;br /&gt;
We would likely need to deal with the display of the menu with properties to allow constructing code to &#039;&#039;request&#039;&#039; a particular style of menu. The renderer should be what actually gets to decide, but for the purposes of re-use having properties and a single render_method is better than having multiple render methods.&amp;lt;br /&amp;gt;&lt;br /&gt;
The following is my initial thoughts on menu structure:&lt;br /&gt;
* Direction: Horizontal, Vertical&lt;br /&gt;
* Design: Default, Tabs, &lt;br /&gt;
* Style: Default, Links, Buttons, Icons&lt;br /&gt;
&lt;br /&gt;
===Notification {atom}===&lt;br /&gt;
* Info&lt;br /&gt;
* Success&lt;br /&gt;
* Warning&lt;br /&gt;
* Danger&lt;br /&gt;
&lt;br /&gt;
===Navigation bar {organism}===&lt;br /&gt;
Formerly navbar, can&#039;t be called that because the render method would conflict.&lt;br /&gt;
&lt;br /&gt;
The navigation bar is just that, it is becoming increasingly common on the web and usually contains a title or logo, a menu, and information pertaining to the user state (login, language etc).&lt;br /&gt;
&lt;br /&gt;
===Page header {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently being produced by &#039;&#039;&#039;core_renderer::page_heading&#039;&#039;&#039; this is simply a header for the page, by default the only h1 element on the page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method has the following signature:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function page_heading($tag = &#039;h1&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output from the above method is:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;The page heading (from moodle_page::heading)&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The core_renderer method should not allow the tag to be set. The page heading should always be H1.&lt;br /&gt;
If its not an H1 then page header should not be used.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework examples&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#typography Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;hero-unit&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Heading&amp;lt;/h1&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;Tagline&amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
    &amp;lt;a class=&amp;quot;btn btn-primary btn-large&amp;quot;&amp;gt;&lt;br /&gt;
      Learn more&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#page-header Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Example page header &amp;lt;small&amp;gt;Subtext for header&amp;lt;/small&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Foundation doesn&#039;t appear to have a page header component.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* In Moodle all page headings are set as a single string, we won&#039;t be changing this.&lt;br /&gt;
* Usually just a plain string sometimes an icon is used, and sometimes a help icon is used.&lt;br /&gt;
&lt;br /&gt;
===Pagination {molecule}===&lt;br /&gt;
&lt;br /&gt;
I like the idea of this being separate to a menu, and to other navigation oriented elements because it should be something that can easily be constructed with a few basic parameters and allow us to achieve consistent pagination throughout Moodle.&amp;lt;br /&amp;gt;&lt;br /&gt;
It also appeals because this is something that people may want to style differently to their navigation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#pagination Bootstrap 2.3.2 pagination]&lt;br /&gt;
* [http://getbootstrap.com/components/#pagination Bootstrap 3 pagination]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/pagination.html Zurb foundation pagination]&lt;br /&gt;
&lt;br /&gt;
===Progress bars {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty simple concept, we already have a couple of ways of producing progress bars within Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#progress Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;bar&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 2.3.2:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#progress Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- With label --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60% Complete&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Label is hidden but accessible --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60%&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 3:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/progress_bars.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;span class=&amp;quot;meter&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Zurb foundation:&lt;br /&gt;
* Width &lt;br /&gt;
* Colours: default (blue), secondary (grey), success (green), alert (red)&lt;br /&gt;
* Corner style: default (square), radius (slight rounding), round&lt;br /&gt;
&lt;br /&gt;
===Search {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty common interface molecule, and in fact used as an example in the atomic design blog post we keep referencing.&amp;lt;br /&amp;gt;&lt;br /&gt;
We don&#039;t have a component for searching yet, however we&#039;ve several search boxes throughout Moodle. The admin setting search box is the first to come to mind for me, followed by the forum search box and course search box.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Constructed of the following items:&lt;br /&gt;
* Text input&lt;br /&gt;
* Action (must be a button for submit I imagine)&lt;br /&gt;
* Label or short description (optional)&lt;br /&gt;
* Collapsible region containing settings etc (optional)&lt;br /&gt;
&lt;br /&gt;
===Table {organism}===&lt;br /&gt;
&lt;br /&gt;
We&#039;ve two primary table components within Moodle presently &#039;&#039;&#039;html_table&#039;&#039;&#039; and &#039;&#039;&#039;flexible_table&#039;&#039;&#039; both of which offer different advantages and disadvantages. This will be a challenge and will really require some proper research and community interaction.&lt;br /&gt;
&lt;br /&gt;
===Timer {atom|molecule}===&lt;br /&gt;
&lt;br /&gt;
... not sure about this one, but we do use it in a couple of places, and we use it on all core sites that have hourly resets so in a way it makes sense to support it and allow it to be styled nicely and easily.&lt;br /&gt;
&lt;br /&gt;
===Tree {organism}===&lt;br /&gt;
&lt;br /&gt;
===User content {organism}===&lt;br /&gt;
&lt;br /&gt;
Think of this like the forum post. We need a common structure in which to display content entered by the user along with information on the user. The users name, picture, date perhaps, title, content, footer (attachments, badges, what ever).&lt;br /&gt;
It could be applied to things like forum posts, calendar events etc.&lt;br /&gt;
&lt;br /&gt;
At present we have no abstraction for this.&lt;br /&gt;
&lt;br /&gt;
==Existing renderables and what they will become==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Existing renderable&lt;br /&gt;
! Description&lt;br /&gt;
! Future renderable&lt;br /&gt;
! Convenience method (if different)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu&lt;br /&gt;
| UI component for a drop down edit menu&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link&lt;br /&gt;
| UI component for a menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_filler&lt;br /&gt;
| UI component for a filler menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_primary&lt;br /&gt;
| UI component for a primary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_secondary&lt;br /&gt;
| UI component for a secondary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_link&lt;br /&gt;
| Link with alt text, and an icon&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_button&lt;br /&gt;
| A form with a single button&lt;br /&gt;
| button (action with post method)&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| confirm&lt;br /&gt;
| A form with a message and cancel/confirm buttons&lt;br /&gt;
| confirmation&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_select&lt;br /&gt;
| A form with a single drop down list that submits on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| url_select&lt;br /&gt;
| A navigation element consisting of a single drop down list of urls that navigates on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| doc_link&lt;br /&gt;
| A link to the Moodle docs&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pix_icon&lt;br /&gt;
| A small icon&lt;br /&gt;
| icon&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| emoticon_icon&lt;br /&gt;
| A small emoticon&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading_with_help&lt;br /&gt;
| A page heading with a link to help docs&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| icon_help&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon_scale&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_picture&lt;br /&gt;
| A user profile picture which links to their profile&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| container&lt;br /&gt;
| A block level element used to surround something. Can have a class to allow specific targeting with CSS.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| error_text&lt;br /&gt;
| An error to show to the user.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| notification&lt;br /&gt;
| A message for the user&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| continue_button&lt;br /&gt;
| A message and a button to continue to the next page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| paging_bar&lt;br /&gt;
| A list of next previous and specific page links&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_to&lt;br /&gt;
| A link to a section on the page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_target&lt;br /&gt;
| A target for a matching skip_link_to call&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading&lt;br /&gt;
| A page heading&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| box&lt;br /&gt;
| A page section with a border&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rarrow&lt;br /&gt;
| A right arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| larrow&lt;br /&gt;
| A left arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| tabtree&lt;br /&gt;
| A list of tabs&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| tabobject&lt;br /&gt;
| A single tab panel&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Render library specification]] - The original output specification for Moodle 2.8&lt;br /&gt;
* [[Output element planning]] - Thoughts on initial elements that should be created.&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Render_library_element_planning&amp;diff=45911</id>
		<title>User:Sam Hemelryk/Render library element planning</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Render_library_element_planning&amp;diff=45911"/>
		<updated>2014-07-22T11:36:33Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: Page has been published&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page has now been published as [[Output element planning]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Output_element_planning&amp;diff=45910</id>
		<title>Output element planning</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Output_element_planning&amp;diff=45910"/>
		<updated>2014-07-22T11:36:00Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: Copy the page from my personal space.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45829&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
This page documents the proposed core elements, variations of them, what we expect they will contain, and the core_renderer block.&lt;br /&gt;
&lt;br /&gt;
==The user action==&lt;br /&gt;
&lt;br /&gt;
An action in this sense is a collection of data that all pertains to one action that can be taken by the user.&lt;br /&gt;
The action, once populated with data can be rendered as is required for the job it is going to fulfil, usually with some relation to the frontend framework in use.&lt;br /&gt;
In this way the action could be a link, or a button; it could even be interpreted into a more complex structure.&lt;br /&gt;
&lt;br /&gt;
An action has the following properties:&lt;br /&gt;
; content [string]: text content for the link or button.&lt;br /&gt;
; url [moodle_url] : the url for the action to take when the user interacts with this action.&lt;br /&gt;
; description : a description of the action. Typically used within a title or alt attribute.&lt;br /&gt;
; active : True if this is the action the user is current performing.&lt;br /&gt;
; enabled : True if the action is possible, false if it is not possible and should be shown as disabled.&lt;br /&gt;
; dimmed : True if the action should be shown as dimmed, usually used to the action is hidden to other users.&lt;br /&gt;
; method : The preferred method of submitting this action, typically GET but can be set to POST.&lt;br /&gt;
&lt;br /&gt;
It is also possible to add JavaScript actions (component_action objects) to an action. These attach a JS listener to the action that gets executed when the user interacts with the action.&lt;br /&gt;
Attached JavaScript actions get initialised when the properties for the action are retrieved so any events must be attached BEFORE the action is rendered, and all renderers must ensure they use the get_attributes() call. &lt;br /&gt;
&lt;br /&gt;
==Grids==&lt;br /&gt;
&lt;br /&gt;
We need to come up with some way to include grids in core, it is desirable to keep it framework agnostic so perhaps a grid object that allows for items to be added and a &amp;quot;width&amp;quot; specified when that occurs. The width would be either a fixed number or a percentage. Steps of 12 seems pretty common.&lt;br /&gt;
&lt;br /&gt;
==Design requirements==&lt;br /&gt;
The following concepts need to be accounted for in core, or decisions made on how we choose to support these and where.&lt;br /&gt;
&lt;br /&gt;
===Clearfix===&lt;br /&gt;
We have this in core already, bootstrap has it, pretty much every front end framework has it.&lt;br /&gt;
Clearfix is more of a design decision, should only be used when require, and only ever applied by a renderer.&lt;br /&gt;
This gets special mention as being important, support is already 100%.&lt;br /&gt;
&lt;br /&gt;
===Floats===&lt;br /&gt;
Pull left, pull right etc. These are a design decisions and should be implemented by the renderer. Bootstrap caters for these and as such they will be easily catered for in bootstrapbase, however work may be required to get them operational in base.&lt;br /&gt;
&lt;br /&gt;
==Discarded ideas==&lt;br /&gt;
The following things are ideas that came up during discussions on what elements are, and what elements we want in core that have being discarded.&lt;br /&gt;
&lt;br /&gt;
==Core atoms, molecules, and organisms==&lt;br /&gt;
&lt;br /&gt;
The following is the atoms, molecules and organisms we believe should be created initially. Of course there will be many more that are required - however this should give us a good grounding of elements to work with for the first conversions.&lt;br /&gt;
&lt;br /&gt;
===Action {atom}===&lt;br /&gt;
See the section above about [[#The user action]]&lt;br /&gt;
&lt;br /&gt;
Actions are special atoms the represent an action the user can make.&lt;br /&gt;
They can be rendered by a theme as a link, a button or I suppose anything else.&lt;br /&gt;
There should be a default for when it is not specified and the renderer in change of producing the current thing can decide whether to use the default and just call &#039;&#039;render&#039;&#039; or if it requires something specific &#039;&#039;render_link&#039;&#039; or &#039;&#039;render_button&#039;&#039; as required.&lt;br /&gt;
&lt;br /&gt;
===Action group {molecule}===&lt;br /&gt;
A group of actions, to be rendered to reflect a relation. I suppose the easiest way to think about this is how buttons in the atto editor are grouped together. It is a requirement that may seem a tad absrtracted and irrelevant at first but I think will pop up in several places throughout Moodle when we start converting.&lt;br /&gt;
&lt;br /&gt;
It is basically a collection of actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#buttonGroups Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/components/#btn-groups Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/button_groups.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
===Block {atom}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle. This represents a block on the page, and is displayed within a [[#Block region]].&lt;br /&gt;
It accepts two arguments, the first is a &#039;&#039;block_contents&#039;&#039; object instance, and the second is the region name the block instance is being shown within.&lt;br /&gt;
&lt;br /&gt;
At present a block is rendered using the &#039;&#039;&#039;&#039;&#039;core_render::block&#039;&#039;&#039;&#039;&#039; method. Internally this calls several renderer methods to produce the different parts of a block.&lt;br /&gt;
* core_renderer::block_header - Produces a header&lt;br /&gt;
** core_renderer::block_controls - Produces controls to display within the header.&lt;br /&gt;
* core_renderer::block_content - Produces the actual content of the block.&lt;br /&gt;
** core_renderer::block_controls - Used to check if block controls were rendered. PUKE!!!&lt;br /&gt;
** core_renderer::block_footer - Produces a footer that actually resides within the content.&lt;br /&gt;
* core_renderer::block_annotation - Produces an annotation, used VERY rarely.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output when called for a navigation block with a bit of extra added to show how a footer is displayed and an annotation.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#sb-1&amp;quot; class=&amp;quot;skip-block&amp;quot;&amp;gt;Skip Navigation&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;inst4&amp;quot; class=&amp;quot;block_navigation  block&amp;quot; role=&amp;quot;navigation&amp;quot; data-block=&amp;quot;navigation&amp;quot; data-instanceid=&amp;quot;4&amp;quot; aria-labelledby=&amp;quot;instance-4-header&amp;quot; data-dockable=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;block_action&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;!-- Block actions go here, they are images with JS or anchors--&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;h2 id=&amp;quot;instance-4-header&amp;quot;&amp;gt;Navigation&amp;lt;/h2&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;content&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;!-- Block content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;div class=&amp;quot;footer&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;!-- Block footer content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;blockannotation&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Block annotation content goes here --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;sb-1&amp;quot; class=&amp;quot;skip-block-to&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Block region {molecule}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle, the block region is a contain for all of the blocks in one location.&lt;br /&gt;
We currently have two methods that produce a block region within Moodle, the first is &#039;&#039;&#039;&#039;&#039;core_renderer::blocks_for_region&#039;&#039;&#039;&#039;&#039; which adds no surrounding content.&lt;br /&gt;
The preferred method &#039;&#039;&#039;&#039;&#039;core_renderer::blocks&#039;&#039;&#039;&#039;&#039; adds some embedded information to a common structure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the structure of the &#039;&#039;core_renderer::blocks()&#039;&#039; method.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function blocks($region, $classes = array(), $tag = &#039;aside&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following is the html output is $region was &#039;&#039;pre&#039;&#039; and the default tag and classes were used.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot; data-blockregion=&amp;quot;pre&amp;quot; data-droptarget=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Thoughts on this&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The blocks method is a convenience method and serves an important purpose. However it should not take classes and tag as arguments.&amp;lt;br /&amp;gt;&lt;br /&gt;
These should certainly only settable within the renderer itself, and if themes wish to change this without wrapping the call they should override the renderer.&lt;br /&gt;
&lt;br /&gt;
Both the data attributes relate to servicing JavaScript functionality. Perhaps they should be moved to a component_action or somehow else integrated with JS rather than with the renderer directly.&lt;br /&gt;
&lt;br /&gt;
Internally it is calling blocks for region, however this should change it should request a array of blocks, convert the array to [[#Block]] elements and call render on each.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Proposed HTML structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Much like the current structure but with the data attributes coming through a JS mechanism.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Breadcrumb {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently called the navbar within Moodle, controlled by the &#039;&#039;&#039;&#039;&#039;navbar&#039;&#039;&#039;&#039;&#039; class located in lib/navigationlib.php and rendered by &#039;&#039;&#039;&#039;&#039;core_renderer::navbar()&#039;&#039;&#039;&#039;&#039;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Internally it calls moodle_page-&amp;gt;navbar-&amp;gt;get_items() to get an array containing navigation node items to display in the navigation bar.&amp;lt;br /&amp;gt;&lt;br /&gt;
It produces a bit of surrounding structure before calling render on each item.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following shows the structure for two items in the navigation bar presently within Moodle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;Page path&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;nav class=&amp;quot;breadcrumb-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/nav&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the excessive amount of markup to make the separator accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#breadcrumbs Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#breadcrumbs Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/breadcrumbs.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The currently active page should be marked with a class.&lt;br /&gt;
* The current item should probably not be a link MDL-46037&lt;br /&gt;
* [http://www.w3.org/TR/2007/WD-aria-role-20070601/#breadcrumbs wia-aria breadcrumb role]&lt;br /&gt;
* The divider perhaps could come through CSS with these changes to avoid markup necessary to make it accessible (in combination with the above).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation thoughts&#039;&#039;&#039;&lt;br /&gt;
* Owns an array of [#Action {atoms}]&lt;br /&gt;
&lt;br /&gt;
===Buttons {atom}===&lt;br /&gt;
&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&amp;lt;br /&amp;gt;&lt;br /&gt;
Obviously buttons can serve different purposes and roles so have several easily reachable customisations is probably a wise idea.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
None, presently you produce a button when you need it so there are several throughout Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/base-css.html#buttons Bootstrap 2.3.2] and [http://getbootstrap.com/css/#buttons Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;btn btn-default&amp;quot;&amp;gt;Default&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;btn btn-default btn-lg active&amp;quot; role=&amp;quot;button&amp;quot;&amp;gt;Link&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;input class=&amp;quot;btn btn-default&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Input&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Bootstrap:&lt;br /&gt;
* Purposes: default, primary, success, info, warning, danger, link&lt;br /&gt;
* Sizes: large, default, small, extra-small&lt;br /&gt;
* Block level (wider)&lt;br /&gt;
* States: Active, disabled.&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/buttons.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;button&amp;quot;&amp;gt;Default Button&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Zurb Foundation:&lt;br /&gt;
* Purposes: default, secondary, success, alert&lt;br /&gt;
* Sizes: large, default, small, tiny&lt;br /&gt;
* Corner style: radius, round&lt;br /&gt;
* Expanded (wider)&lt;br /&gt;
* States: disabled&lt;br /&gt;
&lt;br /&gt;
===Calendar {organism}===&lt;br /&gt;
&lt;br /&gt;
A simple idea really, apparently not already covered by the frontend frameworks being referenced during the creation of the doc.&lt;br /&gt;
The display of the calendar is fixed, but it can contain content for each day shown.&lt;br /&gt;
&lt;br /&gt;
The calendar should have several views, perhaps these are separate organisms, perhaps not.&lt;br /&gt;
&lt;br /&gt;
* Compact month&lt;br /&gt;
* Month&lt;br /&gt;
* Week&lt;br /&gt;
* Day&lt;br /&gt;
&lt;br /&gt;
Each day could:&lt;br /&gt;
* Contain an action with an icon for events, and link to the fullday display.&lt;br /&gt;
* Have an associated action to load and display the events in a tooltip.&lt;br /&gt;
&lt;br /&gt;
===Collapsible region {molecule}===&lt;br /&gt;
&lt;br /&gt;
We use these in several places within Moodle. I could not find a reference to this concept in any of the frontend frameworks I looked at.&lt;br /&gt;
The concept is simple - you have a heading and an icon with content. By default the content is hidden, when the user clicks the heading and/or the icon the content is revealed.&lt;br /&gt;
&lt;br /&gt;
As noted we do this in several places within Moodle, it would be good to have a single way of displaying this idea of a collapsible region.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
* It should support an optional collapse/expand all trigger action.&lt;br /&gt;
* We want to be able to use it both inside and outside of forms.&lt;br /&gt;
* It should be usable in situations like the combo list frontpage component as well.&lt;br /&gt;
* Will obviously have a JS component as without JS it would not work.&lt;br /&gt;
&lt;br /&gt;
===Confirmation {molecule}===&lt;br /&gt;
&lt;br /&gt;
A simple concept used regularly in Moodle to confirm a users intention to perform an actions. Most commonly seeing when deleting content.&lt;br /&gt;
The structure is relatively basic in Moodle at present.&lt;br /&gt;
* A message&lt;br /&gt;
* A forwards button&lt;br /&gt;
* A back button&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The method &#039;&#039;&#039;&#039;&#039;core_renderer::confirm&#039;&#039;&#039;&#039;&#039; does the rendering at present. Its signature is as follows:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function confirm($message, $continue, $cancel);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output it produces is like:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;generalbox&amp;quot; id=&amp;quot;notice&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;The message goes here&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Two buttons produced by core_renderer::render_single_button() --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design throughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This component does not have a title. I believe at present some pages use &#039;&#039;core_renderer::heading&#039;&#039; to produce a title if they wish. Obviously we want consistency of style so I believe it would be wise to add a title property that can be optionally set and then in our documentation for this element recommend that a title is always provided.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will mean re-factoring our uses to set a title and if a heading is being manually added remove it.&lt;br /&gt;
&lt;br /&gt;
===Continue {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is much like the confirmation molecule but with a single button.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present we have &#039;&#039;&#039;&#039;&#039;core_renderer::continue_button&#039;&#039;&#039;&#039;&#039; that produces a single button. However this design is very poor as more often than not a message is included in the page to describe the purpose of the continue button. This is really an integral part of the continue button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Currently we have &#039;&#039;core_renderer::continue_button&#039;&#039; to render a single continue button.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function continue_button($url);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally it creates a single_button component and then calls render on that.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
Our element should have a message and a button. To make it easy to migrate the constructor should accept a URL instead of a button and do the same conversion as the current method is doing.&lt;br /&gt;
&lt;br /&gt;
===Choice {molecule}===&lt;br /&gt;
Not sure about this one quite yet.&lt;br /&gt;
A description with 2 or more actions allowing the user to select the next step.&lt;br /&gt;
Think of it like when editing a module you get: Cancel, Save and return to course, Save and display&lt;br /&gt;
&lt;br /&gt;
Perhaps both [#Confirmation {molecule}] and [#Continue {molecule}] should be just instances of this.&lt;br /&gt;
&lt;br /&gt;
Hmm perhaps that would not be as clear as this and we should have this separate choice molecule.&lt;br /&gt;
&lt;br /&gt;
===Divider {atom}===&lt;br /&gt;
Think horizontal rule.&lt;br /&gt;
&lt;br /&gt;
===Dropdowns {molecule}===&lt;br /&gt;
&lt;br /&gt;
So this is a pretty simple concept, but you&#039;ve got to think of it as a separate entity. A dropdown is a menu that appears when the user interacts with an action.&lt;br /&gt;
 &lt;br /&gt;
The action could take one of three forms:&lt;br /&gt;
* From button&lt;br /&gt;
* From link&lt;br /&gt;
* From icon&lt;br /&gt;
&lt;br /&gt;
Of course that is handled by the [#Action {atom}] noted above. Worth noting is that we will need some way to toggle these actions as dropdowns. Perhaps it is worth making that a property of the action atom.&lt;br /&gt;
&lt;br /&gt;
The dropdown itself will likely contain more actions, and I suppose additional dropdowns to form sub menus. Sub-menus in my mind are required. We don&#039;t use them in core, but they are functionally possible through things like the custom menu and I know for a fact that many sites have sub menus.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#dropdowns Bootstrap 2.3.2]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Link or button to toggle dropdown --&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dLabel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#dropdowns Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;button class=&amp;quot;btn dropdown-toggle sr-only&amp;quot; type=&amp;quot;button&amp;quot; id=&amp;quot;dropdownMenu1&amp;quot; data-toggle=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
        Dropdown&lt;br /&gt;
        &amp;lt;span class=&amp;quot;caret&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/button&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dropdownMenu1&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot; class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/dropdown.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; data-dropdown=&amp;quot;drop1&amp;quot;&amp;gt;Has Dropdown&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;ul id=&amp;quot;drop1&amp;quot; class=&amp;quot;f-dropdown&amp;quot; data-dropdown-content&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is a link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Yet another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forms {organism}===&lt;br /&gt;
&lt;br /&gt;
This is an advanced  organism and would be quite a bit of work to create in Moodle as we&#039;d need to translate from QuickForms to elements for rendering.&lt;br /&gt;
It would be worthwhile doing this however, and would be a good way of quickly showing our new work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework structures&#039;&#039;&#039;&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/base-css.html#forms Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/css/#forms Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/forms.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
All of those are quite in-depth and offer a range of configurations.&lt;br /&gt;
We should carefully consider these when analysing our work here.&lt;br /&gt;
&lt;br /&gt;
===Headings {atom}===&lt;br /&gt;
&lt;br /&gt;
Currently handled by &#039;&#039;&#039;core_renderer::heading&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* h1 - h6&lt;br /&gt;
* Optional icon&lt;br /&gt;
* Optional help icon&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method is currently:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function heading($text, $level = 2, $classes = null, $id = null);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output generated by this is, assuming we use the default level, classes, and id.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;I am a heading&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Whats worth noting is that the render method should not accept level and classes as arguments.&lt;br /&gt;
These should only be set by the render method and should not be directly influenced.&lt;br /&gt;
&lt;br /&gt;
===Image {atom}===&lt;br /&gt;
&lt;br /&gt;
There are really two types of images to focus on here, or really two ways to display an image to focus on here.&amp;lt;br /&amp;gt;&lt;br /&gt;
# Standard images&lt;br /&gt;
# Thumbnail images&lt;br /&gt;
&lt;br /&gt;
Each of these would share some common properties:&lt;br /&gt;
* Image&lt;br /&gt;
* Description (alt/title)&lt;br /&gt;
* Size&lt;br /&gt;
* Action (making it a link) - This would actually make it a molecule, we would have to consider this and either have a new element, drop the ability to wrap in an action, or simply ignore this inconsistency.&lt;br /&gt;
&lt;br /&gt;
===Image - Icon {atom}===&lt;br /&gt;
&lt;br /&gt;
This covers the display of an icon. Should be a separate element from image as really they should be treated individually.&lt;br /&gt;
Within Moodle there are a few classifications of icons to consider:&lt;br /&gt;
* Standard icons&lt;br /&gt;
* Help icon (popup, tooltip)&lt;br /&gt;
* Loading icon (really regular icon but worth showing separately as its only seen when required)&lt;br /&gt;
&lt;br /&gt;
===Image - Logo {molecule}===&lt;br /&gt;
&lt;br /&gt;
We don&#039;t have this within core Moodle at present, however just about every theme I have seen uses a logo. I think it is about time we considered having a logo element.&lt;br /&gt;
I imagine it would become a sort of hero element, likely with an associated action (back home by default).&lt;br /&gt;
&lt;br /&gt;
===Image - Profile picture {molecule}===&lt;br /&gt;
&lt;br /&gt;
We already have a user_picture component within Moodle. It can be found in lib/outputcomponents.php.&amp;lt;br /&amp;gt;&lt;br /&gt;
It has two render methods, &#039;&#039;&#039;&#039;&#039;core_renderer::user_picture&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;core_renderer::render_user_picture&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output structure for the user picture:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; id=&amp;quot;userpicture_randomid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;img src=&amp;quot;#&amp;quot; alt=&amp;quot;Picture of Joe&amp;quot; title=&amp;quot;Picture of Joe&amp;quot; class=&amp;quot;userpicture&amp;quot; width=&amp;quot;[35, 100, XX]&amp;quot; height=&amp;quot;[35, 100, XX]&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What you&#039;ll notice about this is that the link has no attributes marking it as a user picture link.&lt;br /&gt;
&lt;br /&gt;
The PHP code for the user_picture object itself is really quite in depth and complex. The component serves the user profile fields required to render a user picture. This is good in the scope of the component but would be bad within the scope of an element.&amp;lt;br /&amp;gt;&lt;br /&gt;
Don&#039;t you wish we had a proper user object!&lt;br /&gt;
&lt;br /&gt;
===Link {atom}===&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&lt;br /&gt;
&lt;br /&gt;
Theres not too much more to explain about links, they don&#039;t tend to take states other than the default active, enabled and dimmed.&amp;lt;br /&amp;gt;&lt;br /&gt;
It is worth mentioning that devs will be encouraged to use actions and not links unless absolutely necessary.&amp;lt;br /&amp;gt;&lt;br /&gt;
The render method for this atom must typehint an action rather than a link.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prototype example&#039;&#039;&#039;&lt;br /&gt;
* The atom: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/link.php&lt;br /&gt;
* The convenience method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L149&lt;br /&gt;
* The render method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L211&lt;br /&gt;
&lt;br /&gt;
===List {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is a pretty simple example and something I am sure you are all familiar with. A list is simply a collection of items. Usually represented using a UL or OL tag in markup although worth noting can be styled completely differently to the default.&lt;br /&gt;
There are three main types of lists used within Moodle:&lt;br /&gt;
* Ordered list&lt;br /&gt;
* Unordered list&lt;br /&gt;
* Presentation list (currently our unlist)&lt;br /&gt;
&lt;br /&gt;
The list is a molecule because it should be able to accept other elements as items. E.g. it should be content independent.&lt;br /&gt;
&lt;br /&gt;
===Menu {molecule}===&lt;br /&gt;
&lt;br /&gt;
A menu is a familiar concept for any site. Probably the first thing that pops to mind for many is the navbar, but I want to consider that a separate component as a navbar can consist of more than just menu items.&lt;br /&gt;
I think a menu should be a collection of actions the user can perform. Perhaps with some form of hierarchy.&lt;br /&gt;
&lt;br /&gt;
We have different types of menus within Moodle:&lt;br /&gt;
* The custom menu is one users can directly create, with dropdown downs and sub dropdowns.&lt;br /&gt;
* The action_menu component we have in core uses icons as actions and can have a dropdown.&lt;br /&gt;
&lt;br /&gt;
These should be combined into a single menu element that takes items as an argument, likely actions + dropdowns + dividers to start with would be perfect.&lt;br /&gt;
&lt;br /&gt;
We would likely need to deal with the display of the menu with properties to allow constructing code to &#039;&#039;request&#039;&#039; a particular style of menu. The renderer should be what actually gets to decide, but for the purposes of re-use having properties and a single render_method is better than having multiple render methods.&amp;lt;br /&amp;gt;&lt;br /&gt;
The following is my initial thoughts on menu structure:&lt;br /&gt;
* Direction: Horizontal, Vertical&lt;br /&gt;
* Design: Default, Tabs, &lt;br /&gt;
* Style: Default, Links, Buttons, Icons&lt;br /&gt;
&lt;br /&gt;
===Notification {atom}===&lt;br /&gt;
* Info&lt;br /&gt;
* Success&lt;br /&gt;
* Warning&lt;br /&gt;
* Danger&lt;br /&gt;
&lt;br /&gt;
===Navigation bar {organism}===&lt;br /&gt;
Formerly navbar, can&#039;t be called that because the render method would conflict.&lt;br /&gt;
&lt;br /&gt;
The navigation bar is just that, it is becoming increasingly common on the web and usually contains a title or logo, a menu, and information pertaining to the user state (login, language etc).&lt;br /&gt;
&lt;br /&gt;
===Page header {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently being produced by &#039;&#039;&#039;core_renderer::page_heading&#039;&#039;&#039; this is simply a header for the page, by default the only h1 element on the page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method has the following signature:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function page_heading($tag = &#039;h1&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output from the above method is:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;The page heading (from moodle_page::heading)&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The core_renderer method should not allow the tag to be set. The page heading should always be H1.&lt;br /&gt;
If its not an H1 then page header should not be used.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework examples&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#typography Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;hero-unit&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Heading&amp;lt;/h1&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;Tagline&amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
    &amp;lt;a class=&amp;quot;btn btn-primary btn-large&amp;quot;&amp;gt;&lt;br /&gt;
      Learn more&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#page-header Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Example page header &amp;lt;small&amp;gt;Subtext for header&amp;lt;/small&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Foundation doesn&#039;t appear to have a page header component.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* In Moodle all page headings are set as a single string, we won&#039;t be changing this.&lt;br /&gt;
* Usually just a plain string sometimes an icon is used, and sometimes a help icon is used.&lt;br /&gt;
&lt;br /&gt;
===Pagination {molecule}===&lt;br /&gt;
&lt;br /&gt;
I like the idea of this being separate to a menu, and to other navigation oriented elements because it should be something that can easily be constructed with a few basic parameters and allow us to achieve consistent pagination throughout Moodle.&amp;lt;br /&amp;gt;&lt;br /&gt;
It also appeals because this is something that people may want to style differently to their navigation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#pagination Bootstrap 2.3.2 pagination]&lt;br /&gt;
* [http://getbootstrap.com/components/#pagination Bootstrap 3 pagination]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/pagination.html Zurb foundation pagination]&lt;br /&gt;
&lt;br /&gt;
===Progress bars {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty simple concept, we already have a couple of ways of producing progress bars within Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#progress Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;bar&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 2.3.2:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#progress Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- With label --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60% Complete&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Label is hidden but accessible --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60%&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 3:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/progress_bars.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;span class=&amp;quot;meter&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Zurb foundation:&lt;br /&gt;
* Width &lt;br /&gt;
* Colours: default (blue), secondary (grey), success (green), alert (red)&lt;br /&gt;
* Corner style: default (square), radius (slight rounding), round&lt;br /&gt;
&lt;br /&gt;
===Search {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty common interface molecule, and in fact used as an example in the atomic design blog post we keep referencing.&amp;lt;br /&amp;gt;&lt;br /&gt;
We don&#039;t have a component for searching yet, however we&#039;ve several search boxes throughout Moodle. The admin setting search box is the first to come to mind for me, followed by the forum search box and course search box.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Constructed of the following items:&lt;br /&gt;
* Text input&lt;br /&gt;
* Action (must be a button for submit I imagine)&lt;br /&gt;
* Label or short description (optional)&lt;br /&gt;
* Collapsible region containing settings etc (optional)&lt;br /&gt;
&lt;br /&gt;
===Table {organism}===&lt;br /&gt;
&lt;br /&gt;
We&#039;ve two primary table components within Moodle presently &#039;&#039;&#039;html_table&#039;&#039;&#039; and &#039;&#039;&#039;flexible_table&#039;&#039;&#039; both of which offer different advantages and disadvantages. This will be a challenge and will really require some proper research and community interaction.&lt;br /&gt;
&lt;br /&gt;
===Timer {atom|molecule}===&lt;br /&gt;
&lt;br /&gt;
... not sure about this one, but we do use it in a couple of places, and we use it on all core sites that have hourly resets so in a way it makes sense to support it and allow it to be styled nicely and easily.&lt;br /&gt;
&lt;br /&gt;
===Tree {organism}===&lt;br /&gt;
&lt;br /&gt;
===User content {organism}===&lt;br /&gt;
&lt;br /&gt;
Think of this like the forum post. We need a common structure in which to display content entered by the user along with information on the user. The users name, picture, date perhaps, title, content, footer (attachments, badges, what ever).&lt;br /&gt;
It could be applied to things like forum posts, calendar events etc.&lt;br /&gt;
&lt;br /&gt;
At present we have no abstraction for this.&lt;br /&gt;
&lt;br /&gt;
==Existing renderables and what they will become==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Existing renderable&lt;br /&gt;
! Description&lt;br /&gt;
! Future renderable&lt;br /&gt;
! Convenience method (if different)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu&lt;br /&gt;
| UI component for a drop down edit menu&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link&lt;br /&gt;
| UI component for a menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_filler&lt;br /&gt;
| UI component for a filler menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_primary&lt;br /&gt;
| UI component for a primary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_secondary&lt;br /&gt;
| UI component for a secondary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_link&lt;br /&gt;
| Link with alt text, and an icon&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_button&lt;br /&gt;
| A form with a single button&lt;br /&gt;
| button (action with post method)&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| confirm&lt;br /&gt;
| A form with a message and cancel/confirm buttons&lt;br /&gt;
| confirmation&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_select&lt;br /&gt;
| A form with a single drop down list that submits on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| url_select&lt;br /&gt;
| A navigation element consisting of a single drop down list of urls that navigates on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| doc_link&lt;br /&gt;
| A link to the Moodle docs&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pix_icon&lt;br /&gt;
| A small icon&lt;br /&gt;
| icon&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| emoticon_icon&lt;br /&gt;
| A small emoticon&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading_with_help&lt;br /&gt;
| A page heading with a link to help docs&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| icon_help&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon_scale&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_picture&lt;br /&gt;
| A user profile picture which links to their profile&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| container&lt;br /&gt;
| A block level element used to surround something. Can have a class to allow specific targeting with CSS.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| error_text&lt;br /&gt;
| An error to show to the user.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| notification&lt;br /&gt;
| A message for the user&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| continue_button&lt;br /&gt;
| A message and a button to continue to the next page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| paging_bar&lt;br /&gt;
| A list of next previous and specific page links&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_to&lt;br /&gt;
| A link to a section on the page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_target&lt;br /&gt;
| A target for a matching skip_link_to call&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading&lt;br /&gt;
| A page heading&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| box&lt;br /&gt;
| A page section with a border&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rarrow&lt;br /&gt;
| A right arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| larrow&lt;br /&gt;
| A left arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| tabtree&lt;br /&gt;
| A list of tabs&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| tabobject&lt;br /&gt;
| A single tab panel&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Render_library_specification&amp;diff=45909</id>
		<title>Render library specification</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Render_library_specification&amp;diff=45909"/>
		<updated>2014-07-22T11:24:47Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Related links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45770&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
== Project Goals ==&lt;br /&gt;
* Add an element library to Moodle (A page in Moodle listing all of the renderables and how they look in the current theme)&lt;br /&gt;
* Add a complete set of core renderables that should be capable of completely rendering every new user interface&lt;br /&gt;
* Update the Output API documentation&lt;br /&gt;
* Create a output guide documentation including best practices.&lt;br /&gt;
&lt;br /&gt;
== Benefits ==&lt;br /&gt;
* Make it easier to create user interfaces.&lt;br /&gt;
* Make it easier to style the user interface.&lt;br /&gt;
* Make it easier for themers to customise the user interface.&lt;br /&gt;
* Better facilitate frontend frameworks in Themes.&lt;br /&gt;
* Better facilitate usable and accessible design.&lt;br /&gt;
* Give Moodle a more consistent look and feel.&lt;br /&gt;
* Improve site performance by reducing the CSS footprint.&lt;br /&gt;
&lt;br /&gt;
==Understanding renderers in Moodle==&lt;br /&gt;
&lt;br /&gt;
Renderers have been around since Moodle 2.0 and are now the requirement when writing any code that produces output.&lt;br /&gt;
Renderers come in many shapes and forms depending upon the developers take on how output should be produced.&lt;br /&gt;
&lt;br /&gt;
When renderables were introduced - the API was designed to make it easy for existing code to be updated to make use of renderers and renderables. A renderable is an interface with no methods, so any existing class could be made to implement renderable. This means that the renderable class can be a mixture of data and methods that perform logic associated with the module. This also means that the renderer can call those methods on the renderable class - effectively using the API of the module. The problem with this - is that it complicates the renderer and makes it harder to override in a theme - the themer requires knowledge about the API for the module. Some renderables in core are built as separate classes - only used for the purpose of supplying data to the renderer - here there is a clear separation of the logic - and the properties of the renderable are made up of only simple types that can be checked for in the renderer - e.g. access checks are done in advance and the result is put into a boolean in the renderable. The current renderers / renderables in Moodle are a mixture of these styles.&lt;br /&gt;
&lt;br /&gt;
Because there is no mandated organisation, nor has there ever been, there is immense variation in what constitutes content to a renderer. &lt;br /&gt;
&lt;br /&gt;
One of the upsides to our current render system is that you are not limited to having a single renderer for a component, you can make use of language capabilities and the output framework and create layers of renderers to cut back code duplication and to aid in preparing a base for consistent structuring and output.&lt;br /&gt;
&lt;br /&gt;
Into the equation we add targets and subtypes. Targets allow us to create both standard renderers and renderers specific to the needs of the output method. Standard being HTML, without output methods including CLI, AJAX, HTML email and plain text email.&lt;br /&gt;
&lt;br /&gt;
People have never being constrained as to how they implement a renderer. We&#039;ve being happy enough to simply guide them towards using renderers because of the benefits they provide and while there are numerous benefits there are two fundamental benefits:&lt;br /&gt;
&lt;br /&gt;
; A change in thinking : It requires developers to think about their code organisation. Renderers were introduced in a time before Object Orientation was used in Moodle, and logic and output were tightly intermingled in most code. Renderers were about separating logic and design and while what was created was not always perfect it was always an improvement.&lt;br /&gt;
&lt;br /&gt;
; An extensible approach to output : The render system allows for the overriding of renderers to occur. Theme designers can overwrite any renderer in their theme. The more that renderers that get implement the more of Moodle you can customise.&lt;br /&gt;
&lt;br /&gt;
==Understanding themes==&lt;br /&gt;
&lt;br /&gt;
Themes are without a doubt the most widely customised plugin provided by Moodle. But we are currently struggling with several problems with renderers and themes as they are being implemented currently.&lt;br /&gt;
&lt;br /&gt;
1. There is no strict relationship between the HTML generated by a renderable, and the accompanying CSS that is required to make it display properly. The HTML is coded in the renderer - and then the CSS is added, either directly to the styles.css for the plugin in an unorganised way - or directly in the CSS in the theme - again in a loosely organised way. There is no systematic way to determine if any line of CSS is still in use - and there is no simple way to find the CSS that requires updating when the HTML is updated. &lt;br /&gt;
&lt;br /&gt;
2. The CSS framework (bootstrap 2, bootstrap 3, zurb, pureio) specific attributes for renderables are currently being hardcoded in the HTML generated by the renderables. This prevents themers from using a different framework without creating an impossible amount of work to overwrite every renderer in Moodle.&lt;br /&gt;
&lt;br /&gt;
==So what is the problem==&lt;br /&gt;
&lt;br /&gt;
There are several. Lets be blunt about this. This specification is not a single task. It is about improving the state of output in Moodle and there are going to be several steps in achieving this. On a positive note these steps can in many cases be broken down into granular tasks that can be worked on asynchronously.&lt;br /&gt;
First lets understand some of the major problems:&lt;br /&gt;
* We have no established best practices, nor even documentation on what constitutes a good renderer, or considerations that should be paid mind in planning and designing of code.&lt;br /&gt;
* We have no established style guide, nor pattern library, nor element library, nor anything that could be referenced when someone starts building a new user interface - or creating a new theme.&lt;br /&gt;
* Inconsistency - because of a lack of best practice documentation and examples, there is huge variation in the design of our different modules. Different modules exhibit different problems such as a mixing of logic and output and code duplication.&lt;br /&gt;
* Developers are encouraged to push functionality boundaries in order to take it places observed in other projects or to challenge oneself. While consistency is often talked about it is rarely observed when designing output. We end up with numerous &amp;quot;similar&amp;quot; looking widgets all functioning slightly differently and consequently there is a feeling that this is the way to achieve a new fresh look. (E.g. we have multiple implementations of a &amp;quot;toolbar&amp;quot; - one in Atto and one in EditPDF).&lt;br /&gt;
* Existing renderer implementations vary widely and in many cases contain logic they should not. Access checks, database queries, object manipulations. All of which should not be present as it introduces muddling of concepts and logic that must be duplicated and then maintained for anyone overriding renderers.&lt;br /&gt;
* Themers have a mammoth task at present in applying a consistent style to Moodle, or in choosing to implement a new frontend framework (bootstrap, foundation, pureio etc). Our lack of organisation in the output leaves a lot to be desired. Having the theme responsible for choosing a frontend framework is the right way to handle this, however backend Moodle doesn&#039;t support themeing as well as it should be/could be.&lt;br /&gt;
* On top of the above it introduces a need to override several renderers should you want to create a consistent style and because of inconsistent renderer implementations this can easily lead to a maintenance nightmare. E.g. the user_picture renderable is not used in mod_forum - so there is no way to override it there.&lt;br /&gt;
* JavaScript introduces problems of its own. We are doing more and more with JavaScript these days. However there is a heavy dependence on the output that gets produced and the JavaScript enhancing it. In a lot of cases the relationship is ill defined and due to the complexity and structure of the JavaScript overriding the output structure of the rendered component is completely impossible for all but the most experienced developers.&lt;br /&gt;
* Inline with the above we lack good examples and documentation on how to deliver output templates for JavaScript User Interfaces as well as the creation, and manipulation of HTML structures that are enhanced by JavaScript.&lt;br /&gt;
&lt;br /&gt;
== Identified issues==&lt;br /&gt;
There is a general trend in the problems noted, when looking at output we lack organisation, documentation, and consistency across the board. However the actual issues we are focusing on in this spec can be identified as below:&lt;br /&gt;
&lt;br /&gt;
* Lack of a style guide / element library / pattern library.&lt;br /&gt;
** Leading to inconsistent output and style.&lt;br /&gt;
** Increased workload due to usability and accessibility thinking and testing needing to occur repetitively.&lt;br /&gt;
** Increased workload due to multilang (rtl) support usually coming after the designs of new output.&lt;br /&gt;
* Inconsistent renderer implementations.&lt;br /&gt;
** Lack of best practices.&lt;br /&gt;
** Lacking plus outdated documentation.&lt;br /&gt;
** Logic-full renderers greatly hinder theming.&lt;br /&gt;
** An unnecessarily increased requirement to understand both PHP and Moodle code as each renderer differs and are usually poorly documented.&lt;br /&gt;
* No abstraction from CSS framework.&lt;br /&gt;
** Without organised structure classes are applied in a chaotic fashion leading to the requirement to duplicate core styles.&lt;br /&gt;
** As there is no core styles newly created output widgets need to be styled in all base themes leaving chance of design regressions occurring in predominantly major upgrades but occasionally minor releases as well.&lt;br /&gt;
** Inconsistent output structure ensures CSS quickly balloons as styles need to be both created and copied to several areas.&lt;br /&gt;
* Poor linking between UI components and the JavaScript.&lt;br /&gt;
** Ill-defined link between output and the JavaScript enhancing it.&lt;br /&gt;
** No common technique to template UIs generated by javascript&lt;br /&gt;
&lt;br /&gt;
==Manageable Tasks==&lt;br /&gt;
The following are the major tasks we have identified so far. These tasks can be though of as Epic&#039;s, or tasks for which we will create subtasks (if this output specification itself becomes an Epic).&lt;br /&gt;
Within this section will include notes and implementation ideas on the major tasks we&#039;ve identified.&lt;br /&gt;
&lt;br /&gt;
* [[#Define the elements that make up Moodle|Choose an output methodology and begin defining core elements]]&lt;br /&gt;
* [[#Element library and style guide|Create an element library and accompanying style guide]]&lt;br /&gt;
* [[#Style guide|Create a style guide document]]&lt;br /&gt;
* [[#Define and document renderer best practices|Define and document renderer best practices]]&lt;br /&gt;
* [[#Define and update the JS documentation|Update the JavaScript documentation]]&lt;br /&gt;
* [[#Update renderer documentation|Update renderer documentation]]&lt;br /&gt;
* [[#Update theme documentation and theme tutorials|Update theme documentation and theme tutorials]]&lt;br /&gt;
* [[#Progressively convert renderers|Progressively convert renderers]]&lt;br /&gt;
&lt;br /&gt;
===Define the elements that make up Moodle===&lt;br /&gt;
There are several tasks that will go into this, but the first and most important will be deciding upon an organisational methodology. Some way to compartmentalise the Moodle output.&lt;br /&gt;
At present a reducing granularity system is looking the most appealing. Go and read [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic Design] written by Brad Frost - it describes very well the type of compartmentalisation we are proposing.&lt;br /&gt;
&lt;br /&gt;
Once a system has being chosen the following tasks can be tackled:&lt;br /&gt;
* Identify the layers we require.&lt;br /&gt;
* Define the boundaries and responsibilities of those layers.&lt;br /&gt;
* Identify the initial set of elements, likely the finest granularity first as I imagine starting at the bottom and working up will be the best way to proceed.&lt;br /&gt;
&lt;br /&gt;
Further elements (those relating to Moodle will be defined as part of the element library work).&lt;br /&gt;
&lt;br /&gt;
===Element library and style guide===&lt;br /&gt;
Draft docs for element library tool: [[Element_Library]]&lt;br /&gt;
&lt;br /&gt;
Add an admin tool that can show a categorised list of renderable objects for each plugin/and core - filled with test data. The goal of this tool is to:&lt;br /&gt;
&lt;br /&gt;
* Provide a page for themers to check that their new theme correctly displays all the renderables&lt;br /&gt;
* Provide a page for developers to see all the reusable renderables (in a well defined structure) they can use when building their own pages&lt;br /&gt;
&lt;br /&gt;
The tasks here will be:&lt;br /&gt;
* Spec the element library tool with regard to our chosen element methodology.&lt;br /&gt;
* Create the element library tool.&lt;br /&gt;
* Establish a definition method of elements, and compositions of elements as renderables.&lt;br /&gt;
* Define the core elements from the task above in code somehow and verify the element library tool reveals them.&lt;br /&gt;
* Finally define a comprehensive list of low level widgets we can add to core as renderables. This is a library of components that should be used by other renderers (by compositing them). E.g. list, table, warning, grid. These renderables should be structured into layers, starting from renderables that cannot be broken into smaller parts, up to widgets made of smaller renderables, up to layouts (and possibly up to entire pages).  Sources for this list should come from:&lt;br /&gt;
** Existing CSS Frameworks (bootstrap, pureio) (but must be framework agnostic)&lt;br /&gt;
** Existing renderables in Moodle that we see as “perfect” already (maybe there are some)&lt;br /&gt;
** Existing patterns in Moodle that we do over and over but don’t have a renderable for yet&lt;br /&gt;
&lt;br /&gt;
On top of this there is functionality that would be great to add to it:&lt;br /&gt;
&lt;br /&gt;
* Validate that the renderer/renderable follows best practice (no DB queries, complex types, complex logic)&lt;br /&gt;
* Provide responsive testing immediately within the tool. Adjusting the viewing area on queue to allow both developers and designers to experience how the individual renderables respond in varying presentation medias.&lt;br /&gt;
* Provide language direction testing immediately within the tool. Like the above allow designers and developers to quickly experience a renderable in a different language directions.&lt;br /&gt;
* Renderable linear reporting. So that you can see which other renderables make use of this renderable and which renderables get used by this renderable. This will be hugely helpful in judging impact when themeing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Thoughts on naming===&lt;br /&gt;
&lt;br /&gt;
We will need to define useful names for the different categories of renderables so that we can effectively organise them and provide guidelines for writing each type - the names are a small part of this solution but will possibly be a point for contention. Different frameworks have different names for these things and people will prefer something that sounds like something they are already using.&lt;br /&gt;
&lt;br /&gt;
(draft!) Categories for renderables - taken straight from Atomic design&lt;br /&gt;
&lt;br /&gt;
http://bradfrostweb.com/blog/post/atomic-web-design/&lt;br /&gt;
&lt;br /&gt;
* Atoms == Tiny reusable elements that cannot be broken down into smaller elements&lt;br /&gt;
* Molecules == Relatively simple combinations of atoms built for reuse&lt;br /&gt;
* Organisms == Organisms are groups of molecules joined together to form a relatively complex, distinct section of an interface.&lt;br /&gt;
* Templates == Layout files in a theme&lt;br /&gt;
* Pages == The actual pages in Moodle&lt;br /&gt;
&lt;br /&gt;
Refs for categorizing patterns&lt;br /&gt;
* http://bradfrostweb.com/blog/post/atomic-web-design/&lt;br /&gt;
* http://oocss.org/&lt;br /&gt;
* http://alistapart.com/blog/post/getting-started-with-pattern-libraries&lt;br /&gt;
* http://style.codeforamerica.org/&lt;br /&gt;
&lt;br /&gt;
===Style guide===&lt;br /&gt;
This has two real advantages.&lt;br /&gt;
&lt;br /&gt;
# First assuming this will be developed initially while defining the elements that will make up Moodle output and will aid us in verifying what we are doing. If it can be easily documented then we are on the right track. If we start encountering to many conditions and or too much variation then we are drifting off track.&lt;br /&gt;
# When defining new elements we are able to use our style guide to do so and it&#039;ll provide us measure of how Moodle output evolves.&lt;br /&gt;
&lt;br /&gt;
===Define and document renderer best practices===&lt;br /&gt;
&lt;br /&gt;
This will be tricky and no doubt how we decide to define a best practice will have to have regard for the output methodology we choose.&lt;br /&gt;
&lt;br /&gt;
===Update the JavaScript documentation===&lt;br /&gt;
&lt;br /&gt;
Discuss and agree on a best practice for writing JS that depends on HTML structures in the DOM (e.g. progressive enhancement - or just ids for action listeners) (perhaps a specific renderable for a JS region)&lt;br /&gt;
&lt;br /&gt;
===Update renderer documentation===&lt;br /&gt;
This will of course need to be done after the element library and renderer best practices but should be pretty simple at that point.&lt;br /&gt;
* Read and rate each of the existing docs pages (see related links below)&lt;br /&gt;
* Write new complete docs for everyone (at [[Output API]])&lt;br /&gt;
* Cross link old docs to the new ones&lt;br /&gt;
&lt;br /&gt;
===Update theme documentation and theme tutorials===&lt;br /&gt;
There are likely the most well documented plugin type within Moodle. There are good specification docs, good 2.0 conversion docs and good tutorials on many aspects of theming.&lt;br /&gt;
Many of these pages will need to be updated to reflect best practices and such after we start ticking off some of the other tasks.&lt;br /&gt;
&lt;br /&gt;
===Progressively convert renderers===&lt;br /&gt;
This is the very last task really - but we will start work on it in parallel with creating the new set of core renderables (to prove the design is usable). There is no deadline for this to be complete - and it will take a long time to convert all the existing renderers (and code not using renderers).&lt;br /&gt;
&lt;br /&gt;
== Notes on renderers / renderables ==&lt;br /&gt;
Proposed improvements to the docs on renderers / renderables.&lt;br /&gt;
First - the docs need an overhaul to more clearly explain how renderers / renderables work for core devs, plugin devs and themers. There needs to be clearer guidelines for the things that can be done in a renderable, and in a renderer.&lt;br /&gt;
&lt;br /&gt;
Goals for renderers - should be devoid of logic for these reasons:&lt;br /&gt;
* Theme overridden renderers do not need to be updated when logic is changed&lt;br /&gt;
* Themers can override renderers without understanding all the logic&lt;br /&gt;
* Renderables can be filled with mock data for display in the element library&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;good renderer&amp;quot; is:&lt;br /&gt;
* Receives some “data” through a renderable&lt;br /&gt;
* Produces some “output”&lt;br /&gt;
* Where “output” is some HTML and any javascript init calls&lt;br /&gt;
* Can use basic PHP functions/loops, like for(), foreach(), count()&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;good renderer&amp;quot; is not:&lt;br /&gt;
* nasty php logic (or even non-nasty php logic)&lt;br /&gt;
* access checks&lt;br /&gt;
* non-trivial function calls&lt;br /&gt;
* using any Moodle functions not related to output&lt;br /&gt;
* calling the database&lt;br /&gt;
&lt;br /&gt;
A “renderable” is:&lt;br /&gt;
* All the data required to generate the output.&lt;br /&gt;
* Properties should be simple data types only, or renderables, or array of those&lt;br /&gt;
&lt;br /&gt;
== Evaluations of some existing renderers / renderables ==&lt;br /&gt;
Existing renderer styles - because there are few rules/guidelines for how renderers should be written - there are differing examples of renderers in core. Looking at the 3 of the better maintained modules to see how they are implemented will be useful in evaluating the benefits of any stricter rules for renderers.&lt;br /&gt;
=== Assign ===&lt;br /&gt;
Contains a list of renderables (in renderables.php) and a single renderer. The logic is mostly out of the renderer methods (pre-calculated and added as data to the renderer). There are some cases when renderables could be broken down further - e.g. the expand/collapse on the submission history (mod/assign/yui/src/history/js/history.js). Also the assignment sub-plugins do not use renderers (and they should).&lt;br /&gt;
&lt;br /&gt;
=== Quiz ===&lt;br /&gt;
Uses a lot of renderers - but not renderables. The renderer methods directly call methods of the business logic to determine what to display. e.g. &amp;quot;attemptobj-&amp;gt;get_access_manager(time())-&amp;gt;attempt_must_be_in_popup()&amp;quot;. This is not terrible for a themer trying to override a renderer method because the calls are mostly simple - but it is a grey area for when this becomes business logic in the renderer (and would e.g. need updating to fix bugs etc). If we want to add these renderer methods to the element library - it would require a way to pass mock business logic classes to the renderer methods (and a way for the generator to return a renderer and a method - instead of only a renderable).&lt;br /&gt;
&lt;br /&gt;
=== Workshop ===&lt;br /&gt;
Very nice renderers and renderables in workshop. Would only need updating to re-use core renderables instead of using html_writer directly - and adding the existing renderables to the element library.&lt;br /&gt;
&lt;br /&gt;
=== Badges ===&lt;br /&gt;
Mix of renderer methods and renderables. This is similar to quiz where the renderer is calling lots of methods of the business model in the renderer methods and has the same effect (harder to override, maintain etc). To add these renderer methods to the element library would require the same sort of changes as mentioned in quiz.&lt;br /&gt;
&lt;br /&gt;
== Example of forum post renderer using composition ==&lt;br /&gt;
This is not a real example (yet), it&#039;s just a demonstration of the type of renderers we should be aiming for (using composition etc). This structure would be created in the render_form_post method of the forum renderer. This method would receive a forum_post renderable containing only data - and build up this structure of smaller renderable components, then return the result of calling render(x) on each of the smaller renderables. &lt;br /&gt;
&lt;br /&gt;
[[Image:forumpost-renderer-breakdown.png|center|500px|Example forum renderer]]&lt;br /&gt;
&lt;br /&gt;
== Initial thoughts on renderables and what we should provide (Draft) ==&lt;br /&gt;
This list is not intended to be the final list - it is more of a scoping exercise. One of the tasks from this project is to decide on the full set of required renderables. &lt;br /&gt;
There are several renderables within Moodle that have being included in this table and we will need to look closely at how they fit within our chosen model and whether they are still required.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name&lt;br /&gt;
! Description&lt;br /&gt;
! Source (links)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu&lt;br /&gt;
| UI component for a drop down edit menu&lt;br /&gt;
| Existing renderable (should be renamed &amp;quot;menu&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link&lt;br /&gt;
| UI component for a menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_filler&lt;br /&gt;
| UI component for a filler menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_primary&lt;br /&gt;
| UI component for a primary menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_secondary&lt;br /&gt;
| UI component for a secondary menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_link&lt;br /&gt;
| Link with alt text, and an icon&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| single_button&lt;br /&gt;
| A form with a single button&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| confirm&lt;br /&gt;
| A form with a message and cancel/confirm buttons&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| single_select&lt;br /&gt;
| A form with a single drop down list that submits on change&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| url_select&lt;br /&gt;
| A navigation element consisting of a single drop down list of urls that navigates on change&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| doc_link&lt;br /&gt;
| A link to the Moodle docs&lt;br /&gt;
| Existing renderer method&lt;br /&gt;
|-&lt;br /&gt;
| pix_icon&lt;br /&gt;
| A small icon&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| emoticon_icon&lt;br /&gt;
| A small emoticon&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| heading_with_help&lt;br /&gt;
| A page heading with a link to help docs&lt;br /&gt;
| Existing renderer method&lt;br /&gt;
|-&lt;br /&gt;
| help_icon&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| help_icon_scale&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| user_picture&lt;br /&gt;
| A user profile picture which links to their profile&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| container&lt;br /&gt;
| A block level element used to surround something. Can have a class to allow specific targeting with CSS.&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| error_text&lt;br /&gt;
| An error to show to the user.&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| notification&lt;br /&gt;
| A message for the user&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| continue_button&lt;br /&gt;
| A message and a button to continue to the next page&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| paging_bar&lt;br /&gt;
| A list of next previous and specific page links&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| skip_link_to&lt;br /&gt;
| A link to a section on the page&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| skip_link_target&lt;br /&gt;
| A target for a matching skip_link_to call&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| heading&lt;br /&gt;
| A page heading&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| box&lt;br /&gt;
| A page section with a border&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| rarrow&lt;br /&gt;
| A right arrow&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| larrow&lt;br /&gt;
| A left arrow&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| tabtree&lt;br /&gt;
| A list of tabs&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| tabobject&lt;br /&gt;
| A single tab panel&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| toolbar *new&lt;br /&gt;
| A container for toolbar button groups&lt;br /&gt;
| Bootstrap equiv btn-toolbar (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| toolbar-group *new&lt;br /&gt;
| A group of toolbar buttons&lt;br /&gt;
| Bootstrap equiv btn-group (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| toolbar-button *new&lt;br /&gt;
| A toolbar button&lt;br /&gt;
| Bootstrap equiv btn (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| toolbar-menu *new&lt;br /&gt;
| A toolbar button that opens a drop down menu&lt;br /&gt;
| Bootstrap equiv nested btn-groups (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| navbar *new&lt;br /&gt;
| The navigation bar that shows at the top of the page&lt;br /&gt;
| Bootstrap equiv navbar - There is an existing renderer method that needs converting into renderables&lt;br /&gt;
|-&lt;br /&gt;
| navbar_item *new&lt;br /&gt;
| Items in the navigation bar that shows at the top of the page&lt;br /&gt;
| Bootstrap equiv list item in a navbar - There is an existing renderer method that needs converting into renderables&lt;br /&gt;
|-&lt;br /&gt;
| navbar_item *new&lt;br /&gt;
| Items in the navigation bar that shows at the top of the page&lt;br /&gt;
| Bootstrap equiv list item in a navbar - There is an existing renderer method that needs converting into renderables&lt;br /&gt;
|-&lt;br /&gt;
| progress_bar *new&lt;br /&gt;
| A bar showing progress of something&lt;br /&gt;
| Bootstrap equiv progress_bar - There is an existing moodle class that needs converting to use renderables&lt;br /&gt;
|-&lt;br /&gt;
| progress_bar *new&lt;br /&gt;
| A bar showing progress of something&lt;br /&gt;
| Bootstrap equiv progress_bar - There is an existing moodle class that needs converting to use renderables&lt;br /&gt;
|-&lt;br /&gt;
| panel *new&lt;br /&gt;
| A container with a heading and borders&lt;br /&gt;
| Bootstrap equiv panel, panel-heading, panel-body, panel-footer&lt;br /&gt;
|-&lt;br /&gt;
| vertical-list *new&lt;br /&gt;
| A vertical list of items&lt;br /&gt;
| Bootstrap equiv - list-group&lt;br /&gt;
|-&lt;br /&gt;
| horizontal-list *new&lt;br /&gt;
| A horizontal list of items&lt;br /&gt;
| Bootstrap equiv - list-inline&lt;br /&gt;
|-&lt;br /&gt;
| Two column list *new&lt;br /&gt;
| Short cut for a list of pairs with the left column fixed-width and right aligned&lt;br /&gt;
| Similar to our current moodle forms&lt;br /&gt;
|-&lt;br /&gt;
| table (and cells headings etc) * new&lt;br /&gt;
| We need to convert tablelib to use renderers to output all table elements&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| forms (and labels, inputs etc) * new&lt;br /&gt;
| We need to convert formslib to use renderers to output all form elements&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| grids *new&lt;br /&gt;
| We need to support renderables for a simple responsive grid system&lt;br /&gt;
| Everything has grids...&lt;br /&gt;
|-&lt;br /&gt;
| floats *new&lt;br /&gt;
| We need to support floating elements left and right&lt;br /&gt;
| Bootstrap - pull-left, pull-right&lt;br /&gt;
|-&lt;br /&gt;
| clearfix *new&lt;br /&gt;
| If we have this simple thing as a renderable we can avoid repeating the CSS&lt;br /&gt;
| Bootstrap - clearfix&lt;br /&gt;
|-&lt;br /&gt;
| expandable *new&lt;br /&gt;
| Initially shows only a summary with an expand button to show more details&lt;br /&gt;
| mod_assign&lt;br /&gt;
|-&lt;br /&gt;
| dialog *new&lt;br /&gt;
| Tie into M.core.dialogue so it can be adjusted in a renderer&lt;br /&gt;
| aria&lt;br /&gt;
|-&lt;br /&gt;
| timer *new&lt;br /&gt;
| There is an aria role for this - so we should make sure it is used correctly if required.&lt;br /&gt;
| aria&lt;br /&gt;
|-&lt;br /&gt;
| tree *new&lt;br /&gt;
| Reusable version of the nav tree&lt;br /&gt;
| aria tree, tree-item, tree-grid etc&lt;br /&gt;
|-&lt;br /&gt;
| indent *new&lt;br /&gt;
| (eg threaded forum post)&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| media block *new&lt;br /&gt;
| large media element side by side with some text&lt;br /&gt;
| http://demo.patternlab.io/&lt;br /&gt;
|-&lt;br /&gt;
| hero *new&lt;br /&gt;
| content section with borders/oversized text etc designed to be a landing point&lt;br /&gt;
| Bootstrap jumbotron&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Prototyping ==&lt;br /&gt;
Because there are several ways to implement a renderer/renderable - we have spent some time exploring an example renderer/renderable implementation. What we intended to achieve with these dev branches is an implementation of a &amp;quot;menu&amp;quot; and a &amp;quot;list&amp;quot; renderable in several themes, using several CSS frameworks. The frameworks chosen are: Bootstrap 2 (clean), Bootstrap 3, Zurb Foundation and YUI Pure IO. The prototypes both produce exactly the same output (and only a little effort was made to get nice output) - it&#039;s just the implementations we are interested in at this stage. Each prototype branch adds a local plugin with a test page that can be viewed at &amp;quot;/local/output/index.php&amp;quot; and viewed in several themes (clean, output_bs3, output_pureio, output_zurb). &lt;br /&gt;
&lt;br /&gt;
Some different approaches were explored here:&lt;br /&gt;
&lt;br /&gt;
=== Approach A ===&lt;br /&gt;
This design takes a strong objected oriented view of renderables and introduces some concepts of the HTML DOM to the renderables. There is an abstract class core_ui_element which implements renderable, that all the new renderables inherit from. Each core_ui_element has additional properties including a type, a chain of parent types, a list of attributes to be mixed into the html and a generic list of name/value properties. The type variable can influence which renderer method renders this core_ui_element (this requires a core change). The renderer method can adjust the output based on the chain of parent types of the current node, and the properties of the immediate parent. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The concepts applied in this approach:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
; Everything is an element : Everything that forms a part of output will be represented by a class and can be interacted with in a consistent fashion.&lt;br /&gt;
; All elements are renderables : All elements and components inherit from a common core_ui_element class that implements the renderable interface.&lt;br /&gt;
; All elements are also core_ui_elements : The core_ui_element class allows for common functionality across every element and component. It facilitates ownership of one element to another (building complex elements aka components) as well as adding attributes and properties.&lt;br /&gt;
; Attributes : Element objects have attributes, these are of direct relation to HTML attributes, they are managed as a public array and can easily added to and worked with. There is also a helper method on the renderer that turns them into an HTML attribute string that can be put immediately within a tag for ease of use.&lt;br /&gt;
; Properties : These are used for non-renderable attributes of the element. For instance when producing a menu with items that are disabled, and where one item is active. Properties get assigned by the parent element allowing for properties to appear with specific relation to the context the element is appearing in. For example a link can be a menu item, when it is a menu item it has &amp;quot;active&amp;quot; as a property. When it is used elsewhere it does not have that property.&lt;br /&gt;
; Chained render methods : When render is called on a link that is by itself &#039;&#039;render_link&#039;&#039; gets called. When render is called on a link within a menu &#039;&#039;render_menu_link&#039;&#039; gets called, and if it doesn&#039;t exist &#039;&#039;render_link&#039;&#039; gets called. When render is called on a link that is within a menu that is within a dropdown &#039;&#039;render_dropdown_menu_link&#039;&#039; gets called, if that doesn&#039;t exist then &#039;&#039;render_menu_link&#039;&#039; gets called and so on and so forth. Through this chaining you can override the individual elements within a complex component using predictable means.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Pros&#039;&#039;&#039;&lt;br /&gt;
* All elements take on a predictable, consistent structure through the core_ui_element.&lt;br /&gt;
* The magic gets rolled into the core_ui_element class so that elements need only publish the public properties that they consist of, any any helper methods used in the construction of the object or in setting its properties. There is no need to add any more logic than that.&lt;br /&gt;
* Absolutely all logic not associated with producing output to the needs of the theme gets rolled into the element objects. When rendering an element in most cases you should only need to render the structure for the element and then call render on its properties in the order you want.&lt;br /&gt;
* It will be very easy to deem good interfaces from bad as anything that is not consisting of core_ui_elements will not be an ideal interface.&lt;br /&gt;
* It will be very easy to see in code when writing a renderer what elements are available as each will be a class.&lt;br /&gt;
* Its a clean approach - we will be able to do things as we believe is correct without concern of getting in the way of existing practises.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cons&#039;&#039;&#039;&lt;br /&gt;
* There is going to be a lot of classes. I don&#039;t mean hundreds, but we may end up with over a hundred easily enough.&lt;br /&gt;
* Complexity of knowing PHP. In order to override a renderer you will need to know enough about PHP to understand what an object is.&lt;br /&gt;
* This is a completely new approach, while it provides clean separation from current practices it is yet another learning curve.&lt;br /&gt;
* There is a potential limitation if you have multiple elements of the same time occurring within a component each that needs to be rendered differently. I&#039;ve not actually thought of a use case for this yet, but am mentioning it as something to be investigated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Branch details&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To view this branch at github:&lt;br /&gt;
    https://github.com/samhemelryk/moodle/tree/output_prototype&lt;br /&gt;
&lt;br /&gt;
To get a copy of this code into your own local repository run the following commands:&lt;br /&gt;
    git checkout -b output_prototype&lt;br /&gt;
    git fetch &amp;lt;nowiki&amp;gt;http://github.com/samhemelryk/moodle.git&amp;lt;/nowiki&amp;gt; output_prototype&lt;br /&gt;
    git reset --hard FETCH_HEAD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Viewing it in your browser&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# First get a copy of the code into your local repository.&lt;br /&gt;
# Browse to your site and turn on allowthemechangeonurl (Settings &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme settings)&lt;br /&gt;
# To view in clean: browse to /local/output/index.php?theme=clean&lt;br /&gt;
# To view with Bootstrap 3: browse to /local/output/index.php?theme=output_bs3&lt;br /&gt;
# To view with YUI Pureio: browse to /local/output/index.php?theme=output_pureio&lt;br /&gt;
# To view with Zurb foundation: browse to /local/output/index.php?theme=output_zurb&lt;br /&gt;
&lt;br /&gt;
=== Approach B ===&lt;br /&gt;
This design requires as little change to the existing code/implementations as possible. The idea, is simply to add a new list of renderables / renderer methods that implement the new things. There is no abstract class for renderables with no additional properties etc. Additionally, there are no restrictions on what can be put in a list/menu etc - it really is a just a list of renderables/strings. There is an edge case here, which is &amp;quot;How can a renderer method for a container modify the HTML for the elements it contains?&amp;quot;. An example of this is that the Bootstrap 3 theme wants to put the role=&amp;quot;menuitem&amp;quot; on the first link in each of the elements in it&#039;s &amp;quot;items&amp;quot; list. There are several possible approaches here - and this is one of the points of difference of this branch. One approach (too nasty) is to perform a str_replace on the first &amp;quot;&amp;lt;a&amp;quot; in the rendered html from the item - the downside of this approach is that it doesn&#039;t allow for differences in syntax for links, or merging with existing attributes on a link - it is doomed to fail. The approach chosen for this branch, is to parse the rendered html from the item into a DOMDocument - and use Dom manipulation to amend to the link before rendering it back to a string. There is a util method that takes this complexity out of the renderer method (and we can add more util methods as needed). &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$attributes = array(&#039;role&#039;=&amp;gt;&#039;menuitem&#039;, &#039;tabindex&#039;=&amp;gt;&#039;-1&#039;);&lt;br /&gt;
$newitemhtml = dom_utils::add_attributes_to_first_node_of_type(&#039;a&#039;, $attributes, $itemhtml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Branch details: git pull http://github.com/damyon/moodle.git MENU_RENDERABLE&lt;br /&gt;
&lt;br /&gt;
==Documents created as part of this spec==&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Output API]]&lt;br /&gt;
* [[Migrating your code to the 2.0 rendering API#Outputting HTML specific to your module]]&lt;br /&gt;
* [[Output_renderers]]&lt;br /&gt;
* [[Overriding_a_renderer]]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=177535 Forum discussion on renderers]&lt;br /&gt;
* [[Renderer]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Render_library_specification&amp;diff=45908</id>
		<title>Render library specification</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Render_library_specification&amp;diff=45908"/>
		<updated>2014-07-22T11:24:19Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Related links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45770&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
== Project Goals ==&lt;br /&gt;
* Add an element library to Moodle (A page in Moodle listing all of the renderables and how they look in the current theme)&lt;br /&gt;
* Add a complete set of core renderables that should be capable of completely rendering every new user interface&lt;br /&gt;
* Update the Output API documentation&lt;br /&gt;
* Create a output guide documentation including best practices.&lt;br /&gt;
&lt;br /&gt;
== Benefits ==&lt;br /&gt;
* Make it easier to create user interfaces.&lt;br /&gt;
* Make it easier to style the user interface.&lt;br /&gt;
* Make it easier for themers to customise the user interface.&lt;br /&gt;
* Better facilitate frontend frameworks in Themes.&lt;br /&gt;
* Better facilitate usable and accessible design.&lt;br /&gt;
* Give Moodle a more consistent look and feel.&lt;br /&gt;
* Improve site performance by reducing the CSS footprint.&lt;br /&gt;
&lt;br /&gt;
==Understanding renderers in Moodle==&lt;br /&gt;
&lt;br /&gt;
Renderers have been around since Moodle 2.0 and are now the requirement when writing any code that produces output.&lt;br /&gt;
Renderers come in many shapes and forms depending upon the developers take on how output should be produced.&lt;br /&gt;
&lt;br /&gt;
When renderables were introduced - the API was designed to make it easy for existing code to be updated to make use of renderers and renderables. A renderable is an interface with no methods, so any existing class could be made to implement renderable. This means that the renderable class can be a mixture of data and methods that perform logic associated with the module. This also means that the renderer can call those methods on the renderable class - effectively using the API of the module. The problem with this - is that it complicates the renderer and makes it harder to override in a theme - the themer requires knowledge about the API for the module. Some renderables in core are built as separate classes - only used for the purpose of supplying data to the renderer - here there is a clear separation of the logic - and the properties of the renderable are made up of only simple types that can be checked for in the renderer - e.g. access checks are done in advance and the result is put into a boolean in the renderable. The current renderers / renderables in Moodle are a mixture of these styles.&lt;br /&gt;
&lt;br /&gt;
Because there is no mandated organisation, nor has there ever been, there is immense variation in what constitutes content to a renderer. &lt;br /&gt;
&lt;br /&gt;
One of the upsides to our current render system is that you are not limited to having a single renderer for a component, you can make use of language capabilities and the output framework and create layers of renderers to cut back code duplication and to aid in preparing a base for consistent structuring and output.&lt;br /&gt;
&lt;br /&gt;
Into the equation we add targets and subtypes. Targets allow us to create both standard renderers and renderers specific to the needs of the output method. Standard being HTML, without output methods including CLI, AJAX, HTML email and plain text email.&lt;br /&gt;
&lt;br /&gt;
People have never being constrained as to how they implement a renderer. We&#039;ve being happy enough to simply guide them towards using renderers because of the benefits they provide and while there are numerous benefits there are two fundamental benefits:&lt;br /&gt;
&lt;br /&gt;
; A change in thinking : It requires developers to think about their code organisation. Renderers were introduced in a time before Object Orientation was used in Moodle, and logic and output were tightly intermingled in most code. Renderers were about separating logic and design and while what was created was not always perfect it was always an improvement.&lt;br /&gt;
&lt;br /&gt;
; An extensible approach to output : The render system allows for the overriding of renderers to occur. Theme designers can overwrite any renderer in their theme. The more that renderers that get implement the more of Moodle you can customise.&lt;br /&gt;
&lt;br /&gt;
==Understanding themes==&lt;br /&gt;
&lt;br /&gt;
Themes are without a doubt the most widely customised plugin provided by Moodle. But we are currently struggling with several problems with renderers and themes as they are being implemented currently.&lt;br /&gt;
&lt;br /&gt;
1. There is no strict relationship between the HTML generated by a renderable, and the accompanying CSS that is required to make it display properly. The HTML is coded in the renderer - and then the CSS is added, either directly to the styles.css for the plugin in an unorganised way - or directly in the CSS in the theme - again in a loosely organised way. There is no systematic way to determine if any line of CSS is still in use - and there is no simple way to find the CSS that requires updating when the HTML is updated. &lt;br /&gt;
&lt;br /&gt;
2. The CSS framework (bootstrap 2, bootstrap 3, zurb, pureio) specific attributes for renderables are currently being hardcoded in the HTML generated by the renderables. This prevents themers from using a different framework without creating an impossible amount of work to overwrite every renderer in Moodle.&lt;br /&gt;
&lt;br /&gt;
==So what is the problem==&lt;br /&gt;
&lt;br /&gt;
There are several. Lets be blunt about this. This specification is not a single task. It is about improving the state of output in Moodle and there are going to be several steps in achieving this. On a positive note these steps can in many cases be broken down into granular tasks that can be worked on asynchronously.&lt;br /&gt;
First lets understand some of the major problems:&lt;br /&gt;
* We have no established best practices, nor even documentation on what constitutes a good renderer, or considerations that should be paid mind in planning and designing of code.&lt;br /&gt;
* We have no established style guide, nor pattern library, nor element library, nor anything that could be referenced when someone starts building a new user interface - or creating a new theme.&lt;br /&gt;
* Inconsistency - because of a lack of best practice documentation and examples, there is huge variation in the design of our different modules. Different modules exhibit different problems such as a mixing of logic and output and code duplication.&lt;br /&gt;
* Developers are encouraged to push functionality boundaries in order to take it places observed in other projects or to challenge oneself. While consistency is often talked about it is rarely observed when designing output. We end up with numerous &amp;quot;similar&amp;quot; looking widgets all functioning slightly differently and consequently there is a feeling that this is the way to achieve a new fresh look. (E.g. we have multiple implementations of a &amp;quot;toolbar&amp;quot; - one in Atto and one in EditPDF).&lt;br /&gt;
* Existing renderer implementations vary widely and in many cases contain logic they should not. Access checks, database queries, object manipulations. All of which should not be present as it introduces muddling of concepts and logic that must be duplicated and then maintained for anyone overriding renderers.&lt;br /&gt;
* Themers have a mammoth task at present in applying a consistent style to Moodle, or in choosing to implement a new frontend framework (bootstrap, foundation, pureio etc). Our lack of organisation in the output leaves a lot to be desired. Having the theme responsible for choosing a frontend framework is the right way to handle this, however backend Moodle doesn&#039;t support themeing as well as it should be/could be.&lt;br /&gt;
* On top of the above it introduces a need to override several renderers should you want to create a consistent style and because of inconsistent renderer implementations this can easily lead to a maintenance nightmare. E.g. the user_picture renderable is not used in mod_forum - so there is no way to override it there.&lt;br /&gt;
* JavaScript introduces problems of its own. We are doing more and more with JavaScript these days. However there is a heavy dependence on the output that gets produced and the JavaScript enhancing it. In a lot of cases the relationship is ill defined and due to the complexity and structure of the JavaScript overriding the output structure of the rendered component is completely impossible for all but the most experienced developers.&lt;br /&gt;
* Inline with the above we lack good examples and documentation on how to deliver output templates for JavaScript User Interfaces as well as the creation, and manipulation of HTML structures that are enhanced by JavaScript.&lt;br /&gt;
&lt;br /&gt;
== Identified issues==&lt;br /&gt;
There is a general trend in the problems noted, when looking at output we lack organisation, documentation, and consistency across the board. However the actual issues we are focusing on in this spec can be identified as below:&lt;br /&gt;
&lt;br /&gt;
* Lack of a style guide / element library / pattern library.&lt;br /&gt;
** Leading to inconsistent output and style.&lt;br /&gt;
** Increased workload due to usability and accessibility thinking and testing needing to occur repetitively.&lt;br /&gt;
** Increased workload due to multilang (rtl) support usually coming after the designs of new output.&lt;br /&gt;
* Inconsistent renderer implementations.&lt;br /&gt;
** Lack of best practices.&lt;br /&gt;
** Lacking plus outdated documentation.&lt;br /&gt;
** Logic-full renderers greatly hinder theming.&lt;br /&gt;
** An unnecessarily increased requirement to understand both PHP and Moodle code as each renderer differs and are usually poorly documented.&lt;br /&gt;
* No abstraction from CSS framework.&lt;br /&gt;
** Without organised structure classes are applied in a chaotic fashion leading to the requirement to duplicate core styles.&lt;br /&gt;
** As there is no core styles newly created output widgets need to be styled in all base themes leaving chance of design regressions occurring in predominantly major upgrades but occasionally minor releases as well.&lt;br /&gt;
** Inconsistent output structure ensures CSS quickly balloons as styles need to be both created and copied to several areas.&lt;br /&gt;
* Poor linking between UI components and the JavaScript.&lt;br /&gt;
** Ill-defined link between output and the JavaScript enhancing it.&lt;br /&gt;
** No common technique to template UIs generated by javascript&lt;br /&gt;
&lt;br /&gt;
==Manageable Tasks==&lt;br /&gt;
The following are the major tasks we have identified so far. These tasks can be though of as Epic&#039;s, or tasks for which we will create subtasks (if this output specification itself becomes an Epic).&lt;br /&gt;
Within this section will include notes and implementation ideas on the major tasks we&#039;ve identified.&lt;br /&gt;
&lt;br /&gt;
* [[#Define the elements that make up Moodle|Choose an output methodology and begin defining core elements]]&lt;br /&gt;
* [[#Element library and style guide|Create an element library and accompanying style guide]]&lt;br /&gt;
* [[#Style guide|Create a style guide document]]&lt;br /&gt;
* [[#Define and document renderer best practices|Define and document renderer best practices]]&lt;br /&gt;
* [[#Define and update the JS documentation|Update the JavaScript documentation]]&lt;br /&gt;
* [[#Update renderer documentation|Update renderer documentation]]&lt;br /&gt;
* [[#Update theme documentation and theme tutorials|Update theme documentation and theme tutorials]]&lt;br /&gt;
* [[#Progressively convert renderers|Progressively convert renderers]]&lt;br /&gt;
&lt;br /&gt;
===Define the elements that make up Moodle===&lt;br /&gt;
There are several tasks that will go into this, but the first and most important will be deciding upon an organisational methodology. Some way to compartmentalise the Moodle output.&lt;br /&gt;
At present a reducing granularity system is looking the most appealing. Go and read [http://bradfrostweb.com/blog/post/atomic-web-design/ Atomic Design] written by Brad Frost - it describes very well the type of compartmentalisation we are proposing.&lt;br /&gt;
&lt;br /&gt;
Once a system has being chosen the following tasks can be tackled:&lt;br /&gt;
* Identify the layers we require.&lt;br /&gt;
* Define the boundaries and responsibilities of those layers.&lt;br /&gt;
* Identify the initial set of elements, likely the finest granularity first as I imagine starting at the bottom and working up will be the best way to proceed.&lt;br /&gt;
&lt;br /&gt;
Further elements (those relating to Moodle will be defined as part of the element library work).&lt;br /&gt;
&lt;br /&gt;
===Element library and style guide===&lt;br /&gt;
Draft docs for element library tool: [[Element_Library]]&lt;br /&gt;
&lt;br /&gt;
Add an admin tool that can show a categorised list of renderable objects for each plugin/and core - filled with test data. The goal of this tool is to:&lt;br /&gt;
&lt;br /&gt;
* Provide a page for themers to check that their new theme correctly displays all the renderables&lt;br /&gt;
* Provide a page for developers to see all the reusable renderables (in a well defined structure) they can use when building their own pages&lt;br /&gt;
&lt;br /&gt;
The tasks here will be:&lt;br /&gt;
* Spec the element library tool with regard to our chosen element methodology.&lt;br /&gt;
* Create the element library tool.&lt;br /&gt;
* Establish a definition method of elements, and compositions of elements as renderables.&lt;br /&gt;
* Define the core elements from the task above in code somehow and verify the element library tool reveals them.&lt;br /&gt;
* Finally define a comprehensive list of low level widgets we can add to core as renderables. This is a library of components that should be used by other renderers (by compositing them). E.g. list, table, warning, grid. These renderables should be structured into layers, starting from renderables that cannot be broken into smaller parts, up to widgets made of smaller renderables, up to layouts (and possibly up to entire pages).  Sources for this list should come from:&lt;br /&gt;
** Existing CSS Frameworks (bootstrap, pureio) (but must be framework agnostic)&lt;br /&gt;
** Existing renderables in Moodle that we see as “perfect” already (maybe there are some)&lt;br /&gt;
** Existing patterns in Moodle that we do over and over but don’t have a renderable for yet&lt;br /&gt;
&lt;br /&gt;
On top of this there is functionality that would be great to add to it:&lt;br /&gt;
&lt;br /&gt;
* Validate that the renderer/renderable follows best practice (no DB queries, complex types, complex logic)&lt;br /&gt;
* Provide responsive testing immediately within the tool. Adjusting the viewing area on queue to allow both developers and designers to experience how the individual renderables respond in varying presentation medias.&lt;br /&gt;
* Provide language direction testing immediately within the tool. Like the above allow designers and developers to quickly experience a renderable in a different language directions.&lt;br /&gt;
* Renderable linear reporting. So that you can see which other renderables make use of this renderable and which renderables get used by this renderable. This will be hugely helpful in judging impact when themeing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Thoughts on naming===&lt;br /&gt;
&lt;br /&gt;
We will need to define useful names for the different categories of renderables so that we can effectively organise them and provide guidelines for writing each type - the names are a small part of this solution but will possibly be a point for contention. Different frameworks have different names for these things and people will prefer something that sounds like something they are already using.&lt;br /&gt;
&lt;br /&gt;
(draft!) Categories for renderables - taken straight from Atomic design&lt;br /&gt;
&lt;br /&gt;
http://bradfrostweb.com/blog/post/atomic-web-design/&lt;br /&gt;
&lt;br /&gt;
* Atoms == Tiny reusable elements that cannot be broken down into smaller elements&lt;br /&gt;
* Molecules == Relatively simple combinations of atoms built for reuse&lt;br /&gt;
* Organisms == Organisms are groups of molecules joined together to form a relatively complex, distinct section of an interface.&lt;br /&gt;
* Templates == Layout files in a theme&lt;br /&gt;
* Pages == The actual pages in Moodle&lt;br /&gt;
&lt;br /&gt;
Refs for categorizing patterns&lt;br /&gt;
* http://bradfrostweb.com/blog/post/atomic-web-design/&lt;br /&gt;
* http://oocss.org/&lt;br /&gt;
* http://alistapart.com/blog/post/getting-started-with-pattern-libraries&lt;br /&gt;
* http://style.codeforamerica.org/&lt;br /&gt;
&lt;br /&gt;
===Style guide===&lt;br /&gt;
This has two real advantages.&lt;br /&gt;
&lt;br /&gt;
# First assuming this will be developed initially while defining the elements that will make up Moodle output and will aid us in verifying what we are doing. If it can be easily documented then we are on the right track. If we start encountering to many conditions and or too much variation then we are drifting off track.&lt;br /&gt;
# When defining new elements we are able to use our style guide to do so and it&#039;ll provide us measure of how Moodle output evolves.&lt;br /&gt;
&lt;br /&gt;
===Define and document renderer best practices===&lt;br /&gt;
&lt;br /&gt;
This will be tricky and no doubt how we decide to define a best practice will have to have regard for the output methodology we choose.&lt;br /&gt;
&lt;br /&gt;
===Update the JavaScript documentation===&lt;br /&gt;
&lt;br /&gt;
Discuss and agree on a best practice for writing JS that depends on HTML structures in the DOM (e.g. progressive enhancement - or just ids for action listeners) (perhaps a specific renderable for a JS region)&lt;br /&gt;
&lt;br /&gt;
===Update renderer documentation===&lt;br /&gt;
This will of course need to be done after the element library and renderer best practices but should be pretty simple at that point.&lt;br /&gt;
* Read and rate each of the existing docs pages (see related links below)&lt;br /&gt;
* Write new complete docs for everyone (at [[Output API]])&lt;br /&gt;
* Cross link old docs to the new ones&lt;br /&gt;
&lt;br /&gt;
===Update theme documentation and theme tutorials===&lt;br /&gt;
There are likely the most well documented plugin type within Moodle. There are good specification docs, good 2.0 conversion docs and good tutorials on many aspects of theming.&lt;br /&gt;
Many of these pages will need to be updated to reflect best practices and such after we start ticking off some of the other tasks.&lt;br /&gt;
&lt;br /&gt;
===Progressively convert renderers===&lt;br /&gt;
This is the very last task really - but we will start work on it in parallel with creating the new set of core renderables (to prove the design is usable). There is no deadline for this to be complete - and it will take a long time to convert all the existing renderers (and code not using renderers).&lt;br /&gt;
&lt;br /&gt;
== Notes on renderers / renderables ==&lt;br /&gt;
Proposed improvements to the docs on renderers / renderables.&lt;br /&gt;
First - the docs need an overhaul to more clearly explain how renderers / renderables work for core devs, plugin devs and themers. There needs to be clearer guidelines for the things that can be done in a renderable, and in a renderer.&lt;br /&gt;
&lt;br /&gt;
Goals for renderers - should be devoid of logic for these reasons:&lt;br /&gt;
* Theme overridden renderers do not need to be updated when logic is changed&lt;br /&gt;
* Themers can override renderers without understanding all the logic&lt;br /&gt;
* Renderables can be filled with mock data for display in the element library&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;good renderer&amp;quot; is:&lt;br /&gt;
* Receives some “data” through a renderable&lt;br /&gt;
* Produces some “output”&lt;br /&gt;
* Where “output” is some HTML and any javascript init calls&lt;br /&gt;
* Can use basic PHP functions/loops, like for(), foreach(), count()&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;good renderer&amp;quot; is not:&lt;br /&gt;
* nasty php logic (or even non-nasty php logic)&lt;br /&gt;
* access checks&lt;br /&gt;
* non-trivial function calls&lt;br /&gt;
* using any Moodle functions not related to output&lt;br /&gt;
* calling the database&lt;br /&gt;
&lt;br /&gt;
A “renderable” is:&lt;br /&gt;
* All the data required to generate the output.&lt;br /&gt;
* Properties should be simple data types only, or renderables, or array of those&lt;br /&gt;
&lt;br /&gt;
== Evaluations of some existing renderers / renderables ==&lt;br /&gt;
Existing renderer styles - because there are few rules/guidelines for how renderers should be written - there are differing examples of renderers in core. Looking at the 3 of the better maintained modules to see how they are implemented will be useful in evaluating the benefits of any stricter rules for renderers.&lt;br /&gt;
=== Assign ===&lt;br /&gt;
Contains a list of renderables (in renderables.php) and a single renderer. The logic is mostly out of the renderer methods (pre-calculated and added as data to the renderer). There are some cases when renderables could be broken down further - e.g. the expand/collapse on the submission history (mod/assign/yui/src/history/js/history.js). Also the assignment sub-plugins do not use renderers (and they should).&lt;br /&gt;
&lt;br /&gt;
=== Quiz ===&lt;br /&gt;
Uses a lot of renderers - but not renderables. The renderer methods directly call methods of the business logic to determine what to display. e.g. &amp;quot;attemptobj-&amp;gt;get_access_manager(time())-&amp;gt;attempt_must_be_in_popup()&amp;quot;. This is not terrible for a themer trying to override a renderer method because the calls are mostly simple - but it is a grey area for when this becomes business logic in the renderer (and would e.g. need updating to fix bugs etc). If we want to add these renderer methods to the element library - it would require a way to pass mock business logic classes to the renderer methods (and a way for the generator to return a renderer and a method - instead of only a renderable).&lt;br /&gt;
&lt;br /&gt;
=== Workshop ===&lt;br /&gt;
Very nice renderers and renderables in workshop. Would only need updating to re-use core renderables instead of using html_writer directly - and adding the existing renderables to the element library.&lt;br /&gt;
&lt;br /&gt;
=== Badges ===&lt;br /&gt;
Mix of renderer methods and renderables. This is similar to quiz where the renderer is calling lots of methods of the business model in the renderer methods and has the same effect (harder to override, maintain etc). To add these renderer methods to the element library would require the same sort of changes as mentioned in quiz.&lt;br /&gt;
&lt;br /&gt;
== Example of forum post renderer using composition ==&lt;br /&gt;
This is not a real example (yet), it&#039;s just a demonstration of the type of renderers we should be aiming for (using composition etc). This structure would be created in the render_form_post method of the forum renderer. This method would receive a forum_post renderable containing only data - and build up this structure of smaller renderable components, then return the result of calling render(x) on each of the smaller renderables. &lt;br /&gt;
&lt;br /&gt;
[[Image:forumpost-renderer-breakdown.png|center|500px|Example forum renderer]]&lt;br /&gt;
&lt;br /&gt;
== Initial thoughts on renderables and what we should provide (Draft) ==&lt;br /&gt;
This list is not intended to be the final list - it is more of a scoping exercise. One of the tasks from this project is to decide on the full set of required renderables. &lt;br /&gt;
There are several renderables within Moodle that have being included in this table and we will need to look closely at how they fit within our chosen model and whether they are still required.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name&lt;br /&gt;
! Description&lt;br /&gt;
! Source (links)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu&lt;br /&gt;
| UI component for a drop down edit menu&lt;br /&gt;
| Existing renderable (should be renamed &amp;quot;menu&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link&lt;br /&gt;
| UI component for a menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_filler&lt;br /&gt;
| UI component for a filler menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_primary&lt;br /&gt;
| UI component for a primary menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_secondary&lt;br /&gt;
| UI component for a secondary menu item in an action menu&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| action_link&lt;br /&gt;
| Link with alt text, and an icon&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| single_button&lt;br /&gt;
| A form with a single button&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| confirm&lt;br /&gt;
| A form with a message and cancel/confirm buttons&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| single_select&lt;br /&gt;
| A form with a single drop down list that submits on change&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| url_select&lt;br /&gt;
| A navigation element consisting of a single drop down list of urls that navigates on change&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| doc_link&lt;br /&gt;
| A link to the Moodle docs&lt;br /&gt;
| Existing renderer method&lt;br /&gt;
|-&lt;br /&gt;
| pix_icon&lt;br /&gt;
| A small icon&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| emoticon_icon&lt;br /&gt;
| A small emoticon&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| heading_with_help&lt;br /&gt;
| A page heading with a link to help docs&lt;br /&gt;
| Existing renderer method&lt;br /&gt;
|-&lt;br /&gt;
| help_icon&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| help_icon_scale&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| user_picture&lt;br /&gt;
| A user profile picture which links to their profile&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| container&lt;br /&gt;
| A block level element used to surround something. Can have a class to allow specific targeting with CSS.&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| error_text&lt;br /&gt;
| An error to show to the user.&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| notification&lt;br /&gt;
| A message for the user&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| continue_button&lt;br /&gt;
| A message and a button to continue to the next page&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| paging_bar&lt;br /&gt;
| A list of next previous and specific page links&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| skip_link_to&lt;br /&gt;
| A link to a section on the page&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| skip_link_target&lt;br /&gt;
| A target for a matching skip_link_to call&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| heading&lt;br /&gt;
| A page heading&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| box&lt;br /&gt;
| A page section with a border&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| rarrow&lt;br /&gt;
| A right arrow&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| larrow&lt;br /&gt;
| A left arrow&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| tabtree&lt;br /&gt;
| A list of tabs&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| tabobject&lt;br /&gt;
| A single tab panel&lt;br /&gt;
| Existing renderable&lt;br /&gt;
|-&lt;br /&gt;
| toolbar *new&lt;br /&gt;
| A container for toolbar button groups&lt;br /&gt;
| Bootstrap equiv btn-toolbar (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| toolbar-group *new&lt;br /&gt;
| A group of toolbar buttons&lt;br /&gt;
| Bootstrap equiv btn-group (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| toolbar-button *new&lt;br /&gt;
| A toolbar button&lt;br /&gt;
| Bootstrap equiv btn (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| toolbar-menu *new&lt;br /&gt;
| A toolbar button that opens a drop down menu&lt;br /&gt;
| Bootstrap equiv nested btn-groups (needs aria support)&lt;br /&gt;
|-&lt;br /&gt;
| navbar *new&lt;br /&gt;
| The navigation bar that shows at the top of the page&lt;br /&gt;
| Bootstrap equiv navbar - There is an existing renderer method that needs converting into renderables&lt;br /&gt;
|-&lt;br /&gt;
| navbar_item *new&lt;br /&gt;
| Items in the navigation bar that shows at the top of the page&lt;br /&gt;
| Bootstrap equiv list item in a navbar - There is an existing renderer method that needs converting into renderables&lt;br /&gt;
|-&lt;br /&gt;
| navbar_item *new&lt;br /&gt;
| Items in the navigation bar that shows at the top of the page&lt;br /&gt;
| Bootstrap equiv list item in a navbar - There is an existing renderer method that needs converting into renderables&lt;br /&gt;
|-&lt;br /&gt;
| progress_bar *new&lt;br /&gt;
| A bar showing progress of something&lt;br /&gt;
| Bootstrap equiv progress_bar - There is an existing moodle class that needs converting to use renderables&lt;br /&gt;
|-&lt;br /&gt;
| progress_bar *new&lt;br /&gt;
| A bar showing progress of something&lt;br /&gt;
| Bootstrap equiv progress_bar - There is an existing moodle class that needs converting to use renderables&lt;br /&gt;
|-&lt;br /&gt;
| panel *new&lt;br /&gt;
| A container with a heading and borders&lt;br /&gt;
| Bootstrap equiv panel, panel-heading, panel-body, panel-footer&lt;br /&gt;
|-&lt;br /&gt;
| vertical-list *new&lt;br /&gt;
| A vertical list of items&lt;br /&gt;
| Bootstrap equiv - list-group&lt;br /&gt;
|-&lt;br /&gt;
| horizontal-list *new&lt;br /&gt;
| A horizontal list of items&lt;br /&gt;
| Bootstrap equiv - list-inline&lt;br /&gt;
|-&lt;br /&gt;
| Two column list *new&lt;br /&gt;
| Short cut for a list of pairs with the left column fixed-width and right aligned&lt;br /&gt;
| Similar to our current moodle forms&lt;br /&gt;
|-&lt;br /&gt;
| table (and cells headings etc) * new&lt;br /&gt;
| We need to convert tablelib to use renderers to output all table elements&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| forms (and labels, inputs etc) * new&lt;br /&gt;
| We need to convert formslib to use renderers to output all form elements&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| grids *new&lt;br /&gt;
| We need to support renderables for a simple responsive grid system&lt;br /&gt;
| Everything has grids...&lt;br /&gt;
|-&lt;br /&gt;
| floats *new&lt;br /&gt;
| We need to support floating elements left and right&lt;br /&gt;
| Bootstrap - pull-left, pull-right&lt;br /&gt;
|-&lt;br /&gt;
| clearfix *new&lt;br /&gt;
| If we have this simple thing as a renderable we can avoid repeating the CSS&lt;br /&gt;
| Bootstrap - clearfix&lt;br /&gt;
|-&lt;br /&gt;
| expandable *new&lt;br /&gt;
| Initially shows only a summary with an expand button to show more details&lt;br /&gt;
| mod_assign&lt;br /&gt;
|-&lt;br /&gt;
| dialog *new&lt;br /&gt;
| Tie into M.core.dialogue so it can be adjusted in a renderer&lt;br /&gt;
| aria&lt;br /&gt;
|-&lt;br /&gt;
| timer *new&lt;br /&gt;
| There is an aria role for this - so we should make sure it is used correctly if required.&lt;br /&gt;
| aria&lt;br /&gt;
|-&lt;br /&gt;
| tree *new&lt;br /&gt;
| Reusable version of the nav tree&lt;br /&gt;
| aria tree, tree-item, tree-grid etc&lt;br /&gt;
|-&lt;br /&gt;
| indent *new&lt;br /&gt;
| (eg threaded forum post)&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| media block *new&lt;br /&gt;
| large media element side by side with some text&lt;br /&gt;
| http://demo.patternlab.io/&lt;br /&gt;
|-&lt;br /&gt;
| hero *new&lt;br /&gt;
| content section with borders/oversized text etc designed to be a landing point&lt;br /&gt;
| Bootstrap jumbotron&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Prototyping ==&lt;br /&gt;
Because there are several ways to implement a renderer/renderable - we have spent some time exploring an example renderer/renderable implementation. What we intended to achieve with these dev branches is an implementation of a &amp;quot;menu&amp;quot; and a &amp;quot;list&amp;quot; renderable in several themes, using several CSS frameworks. The frameworks chosen are: Bootstrap 2 (clean), Bootstrap 3, Zurb Foundation and YUI Pure IO. The prototypes both produce exactly the same output (and only a little effort was made to get nice output) - it&#039;s just the implementations we are interested in at this stage. Each prototype branch adds a local plugin with a test page that can be viewed at &amp;quot;/local/output/index.php&amp;quot; and viewed in several themes (clean, output_bs3, output_pureio, output_zurb). &lt;br /&gt;
&lt;br /&gt;
Some different approaches were explored here:&lt;br /&gt;
&lt;br /&gt;
=== Approach A ===&lt;br /&gt;
This design takes a strong objected oriented view of renderables and introduces some concepts of the HTML DOM to the renderables. There is an abstract class core_ui_element which implements renderable, that all the new renderables inherit from. Each core_ui_element has additional properties including a type, a chain of parent types, a list of attributes to be mixed into the html and a generic list of name/value properties. The type variable can influence which renderer method renders this core_ui_element (this requires a core change). The renderer method can adjust the output based on the chain of parent types of the current node, and the properties of the immediate parent. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The concepts applied in this approach:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
; Everything is an element : Everything that forms a part of output will be represented by a class and can be interacted with in a consistent fashion.&lt;br /&gt;
; All elements are renderables : All elements and components inherit from a common core_ui_element class that implements the renderable interface.&lt;br /&gt;
; All elements are also core_ui_elements : The core_ui_element class allows for common functionality across every element and component. It facilitates ownership of one element to another (building complex elements aka components) as well as adding attributes and properties.&lt;br /&gt;
; Attributes : Element objects have attributes, these are of direct relation to HTML attributes, they are managed as a public array and can easily added to and worked with. There is also a helper method on the renderer that turns them into an HTML attribute string that can be put immediately within a tag for ease of use.&lt;br /&gt;
; Properties : These are used for non-renderable attributes of the element. For instance when producing a menu with items that are disabled, and where one item is active. Properties get assigned by the parent element allowing for properties to appear with specific relation to the context the element is appearing in. For example a link can be a menu item, when it is a menu item it has &amp;quot;active&amp;quot; as a property. When it is used elsewhere it does not have that property.&lt;br /&gt;
; Chained render methods : When render is called on a link that is by itself &#039;&#039;render_link&#039;&#039; gets called. When render is called on a link within a menu &#039;&#039;render_menu_link&#039;&#039; gets called, and if it doesn&#039;t exist &#039;&#039;render_link&#039;&#039; gets called. When render is called on a link that is within a menu that is within a dropdown &#039;&#039;render_dropdown_menu_link&#039;&#039; gets called, if that doesn&#039;t exist then &#039;&#039;render_menu_link&#039;&#039; gets called and so on and so forth. Through this chaining you can override the individual elements within a complex component using predictable means.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Pros&#039;&#039;&#039;&lt;br /&gt;
* All elements take on a predictable, consistent structure through the core_ui_element.&lt;br /&gt;
* The magic gets rolled into the core_ui_element class so that elements need only publish the public properties that they consist of, any any helper methods used in the construction of the object or in setting its properties. There is no need to add any more logic than that.&lt;br /&gt;
* Absolutely all logic not associated with producing output to the needs of the theme gets rolled into the element objects. When rendering an element in most cases you should only need to render the structure for the element and then call render on its properties in the order you want.&lt;br /&gt;
* It will be very easy to deem good interfaces from bad as anything that is not consisting of core_ui_elements will not be an ideal interface.&lt;br /&gt;
* It will be very easy to see in code when writing a renderer what elements are available as each will be a class.&lt;br /&gt;
* Its a clean approach - we will be able to do things as we believe is correct without concern of getting in the way of existing practises.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cons&#039;&#039;&#039;&lt;br /&gt;
* There is going to be a lot of classes. I don&#039;t mean hundreds, but we may end up with over a hundred easily enough.&lt;br /&gt;
* Complexity of knowing PHP. In order to override a renderer you will need to know enough about PHP to understand what an object is.&lt;br /&gt;
* This is a completely new approach, while it provides clean separation from current practices it is yet another learning curve.&lt;br /&gt;
* There is a potential limitation if you have multiple elements of the same time occurring within a component each that needs to be rendered differently. I&#039;ve not actually thought of a use case for this yet, but am mentioning it as something to be investigated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Branch details&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To view this branch at github:&lt;br /&gt;
    https://github.com/samhemelryk/moodle/tree/output_prototype&lt;br /&gt;
&lt;br /&gt;
To get a copy of this code into your own local repository run the following commands:&lt;br /&gt;
    git checkout -b output_prototype&lt;br /&gt;
    git fetch &amp;lt;nowiki&amp;gt;http://github.com/samhemelryk/moodle.git&amp;lt;/nowiki&amp;gt; output_prototype&lt;br /&gt;
    git reset --hard FETCH_HEAD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Viewing it in your browser&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
# First get a copy of the code into your local repository.&lt;br /&gt;
# Browse to your site and turn on allowthemechangeonurl (Settings &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme settings)&lt;br /&gt;
# To view in clean: browse to /local/output/index.php?theme=clean&lt;br /&gt;
# To view with Bootstrap 3: browse to /local/output/index.php?theme=output_bs3&lt;br /&gt;
# To view with YUI Pureio: browse to /local/output/index.php?theme=output_pureio&lt;br /&gt;
# To view with Zurb foundation: browse to /local/output/index.php?theme=output_zurb&lt;br /&gt;
&lt;br /&gt;
=== Approach B ===&lt;br /&gt;
This design requires as little change to the existing code/implementations as possible. The idea, is simply to add a new list of renderables / renderer methods that implement the new things. There is no abstract class for renderables with no additional properties etc. Additionally, there are no restrictions on what can be put in a list/menu etc - it really is a just a list of renderables/strings. There is an edge case here, which is &amp;quot;How can a renderer method for a container modify the HTML for the elements it contains?&amp;quot;. An example of this is that the Bootstrap 3 theme wants to put the role=&amp;quot;menuitem&amp;quot; on the first link in each of the elements in it&#039;s &amp;quot;items&amp;quot; list. There are several possible approaches here - and this is one of the points of difference of this branch. One approach (too nasty) is to perform a str_replace on the first &amp;quot;&amp;lt;a&amp;quot; in the rendered html from the item - the downside of this approach is that it doesn&#039;t allow for differences in syntax for links, or merging with existing attributes on a link - it is doomed to fail. The approach chosen for this branch, is to parse the rendered html from the item into a DOMDocument - and use Dom manipulation to amend to the link before rendering it back to a string. There is a util method that takes this complexity out of the renderer method (and we can add more util methods as needed). &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$attributes = array(&#039;role&#039;=&amp;gt;&#039;menuitem&#039;, &#039;tabindex&#039;=&amp;gt;&#039;-1&#039;);&lt;br /&gt;
$newitemhtml = dom_utils::add_attributes_to_first_node_of_type(&#039;a&#039;, $attributes, $itemhtml);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Branch details: git pull http://github.com/damyon/moodle.git MENU_RENDERABLE&lt;br /&gt;
&lt;br /&gt;
== Related links ==&lt;br /&gt;
* [[Output API]]&lt;br /&gt;
* [[Migrating your code to the 2.0 rendering API#Outputting HTML specific to your module]]&lt;br /&gt;
* [[Output_renderers]]&lt;br /&gt;
* [[Overriding_a_renderer]]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=177535 Forum discussion on renderers]&lt;br /&gt;
* [[Renderer]]&lt;br /&gt;
&lt;br /&gt;
*Documents created as part of this spec*&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Renderer_best_practices&amp;diff=45907</id>
		<title>Renderer best practices</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Renderer_best_practices&amp;diff=45907"/>
		<updated>2014-07-22T11:22:57Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45853&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
This page documents renderer best practices.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
* Must mention atomic design and how the concept of &amp;quot;templates&amp;quot; should be applied. Relates to the next note. A forth method type for renderers?&lt;br /&gt;
* Within a component or plugin that has a renderer use the renderer for EVERYTHING within that area. [https://moodle.org/mod/forum/discuss.php?d=262817#p1138926 forum post that ignited this]&lt;br /&gt;
* Reference and probably copy the three render methods from [Guide to creating output elements]&lt;br /&gt;
&lt;br /&gt;
==Renderer best practices==&lt;br /&gt;
&lt;br /&gt;
This document discusses the recommended practises to follow when writing renderers for Moodle. It was created in Moodle 2.8 as part of the element library specification that took place.&lt;br /&gt;
&lt;br /&gt;
Renderers provide an abstraction of logic and display. They serve Moodle to both encourage us to properly structure our code and to provide a means by which themes can take control of output to completely customise the look of Moodle.&lt;br /&gt;
Elements and the element library provide us a set of building blocks to use when creating output. These provide us a consistent and manageable look that also minimising the amount of customisation required by a theme to change the look and feel of Moodle.&lt;br /&gt;
Here we make a recommendation on how to write renderers to maximise the benefits to both yourself as a developer and to designers who have to customise the interfaces you create.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
Its important to understand the goals for output before you start looking at renderers as they are just one part of the output plan.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output in Moodle is designed to:&#039;&#039;&#039;&lt;br /&gt;
* Aid developers in properly abstracting output from logic.&lt;br /&gt;
* Allow designers to take complete control of output from within a theme if they wish.&lt;br /&gt;
* Provide a consisten look and feel for Moodle user.&lt;br /&gt;
* Allow developers to more rapidly create interfaces by having a set of elements at their finger tips.&lt;br /&gt;
* Minimise the efforts designers must extrude in order to customise the look and feel of Moodle by limiting the output to a set of elements.&lt;br /&gt;
* Aid designers by providing tools to support styling Moodle such as the element library.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Renderers in Moodle:&#039;&#039;&#039;&lt;br /&gt;
* Are the link between Moodle and a theme through which all output is generated.&lt;br /&gt;
* Are organised for the benefit of designers, and should be written following this document.&lt;br /&gt;
* Most importantly allow designers to override the HTML that wraps the data being displayed in turn allowing designers to re-design output in a theme.&lt;br /&gt;
* Allow designers to change the information being displayed by providing not just what is initially required but that which that may require.&lt;br /&gt;
&lt;br /&gt;
==A simple set of rules for a good renderer==&lt;br /&gt;
&lt;br /&gt;
Summarising what will be discussed further in this document a good renderer can be summarised as:&lt;br /&gt;
&lt;br /&gt;
* Think in elements. We have an element library, when planning the output for your plugin/component start with the elements in the element library and the markup they provide.&lt;br /&gt;
* Containing only methods confroming to the four method types discussed below.&lt;br /&gt;
* Encapsulated data is given, maximising the information available to the renderer and minimising the number of arguments.&lt;br /&gt;
* Free of logic relating to anything except output. This includes not calculating the likes of links and capabilities.&lt;br /&gt;
* Uses helper methods to manipulate data where manipulate is absolutely required, essentially abstracting logic to conform to the above rule.&lt;br /&gt;
* Utilise the core elements as much as is possible.&lt;br /&gt;
* Recognise unique output needs and create element(s) for it.&lt;br /&gt;
* The render method should be used as often as possible to maximise consistent look.&lt;br /&gt;
&lt;br /&gt;
==The don&#039;ts==&lt;br /&gt;
&lt;br /&gt;
The following are things that should not be done within a renderer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT:&#039;&#039;&#039;&lt;br /&gt;
* design interfaces from scratch when desiging output for your plugin/component. Always start with the elements found in the element library.&lt;br /&gt;
* Use logic that isn&#039;t essential to producing output. This includes but is not limited to the following:&lt;br /&gt;
** Database interaction of any kind.&lt;br /&gt;
** Access or capability checks.&lt;br /&gt;
** Generation of data such as producing URL&#039;s, that should be owned by the plugin/component and made available preferably through the given arguments or failing that through a helper method.&lt;br /&gt;
* Generate HTML for something that should be an element, convert it to an element and call render on it.&lt;br /&gt;
* Create custom elements for everything you plan to output, instead try to maximise the core elements that you use.&lt;br /&gt;
* Write your own render methods for subelements of the elements you create. Only do this if you absolutely must change the markup from that produced by the natural render method for the element.&lt;br /&gt;
&lt;br /&gt;
==Creating a renderer==&lt;br /&gt;
&lt;br /&gt;
===Location and naming===&lt;br /&gt;
As of Moodle 2.8 renderers can be put into the output namespace. This is the recommended placement for Renderers in Moodle 2.8 and up, however the alternatives will also be listed here.&lt;br /&gt;
&lt;br /&gt;
Recommended:&lt;br /&gt;
* Put your renderer in &#039;&#039;&#039;mod/yourplugin/output/renderer.php&#039;&#039;&#039; use the namespace &#039;&#039;&#039;mod_yourplugin\output&#039;&#039;&#039; and call your class &#039;&#039;&#039;renderer&#039;&#039;&#039;.&lt;br /&gt;
* To get an instance of your renderer &#039;&#039;$PAGE-&amp;gt;get_renderer(&#039;mod_yourplugin&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is how mod/yourplugin/output/renderer.php will look:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
namespace mod_yourplugin\output;&lt;br /&gt;
&lt;br /&gt;
class renderer extends \plugin_renderer_base {&lt;br /&gt;
    // Your renderer methods in here.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also available but not recommended:&lt;br /&gt;
* Put your renderer in &#039;&#039;&#039;mod/yourplugin/renderer.php&#039;&#039;&#039; do NOT namespace it, and call your class &#039;&#039;&#039;mod_yourplugin_renderer&#039;&#039;&#039;.&lt;br /&gt;
* To get an instance of your renderer &#039;&#039;$PAGE-&amp;gt;get_renderer(&#039;mod_yourplugin&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This was how things were done in earlier versions of Moodle (2.7 and below).&lt;br /&gt;
&lt;br /&gt;
===Render methods===&lt;br /&gt;
&lt;br /&gt;
Renderers can be well structured, the purpose of them is the same across all plugins and components.&lt;br /&gt;
There are four distinct types of render methods that you can expect to find in a renderer, and these four can be categorised into one of two categories.&lt;br /&gt;
&lt;br /&gt;
The four types of render methods:&lt;br /&gt;
# Layout methods&lt;br /&gt;
# Translator methods&lt;br /&gt;
# Render methods&lt;br /&gt;
# Convenience methods&lt;br /&gt;
&lt;br /&gt;
These four methods can then be categorised in two ways:&lt;br /&gt;
; Plugin|Component method : The layout and translator methods are plugin or component methods. They take data for a plugin or component and meld it into renderables. These methods relate to and can be said to be owned by the plugin or component. &lt;br /&gt;
; Element methods :  The render and convenience methods relate only to elements. They take already encapsulated abstracted data and simply output HTML structure around it. They pay no regard to the plugin or component and are completely and solely bound to the output of an element.&lt;br /&gt;
&lt;br /&gt;
====Layout methods====&lt;br /&gt;
&lt;br /&gt;
====Translator methods====&lt;br /&gt;
&lt;br /&gt;
====Render methods====&lt;br /&gt;
If you&#039;ve spent any time working with renderers in the past you will already be familiar with the concept of a render method.&lt;br /&gt;
All elements within Moodle inherit the renderable interface. To produce output for them you call the renderers render method and give the element.&lt;br /&gt;
The render method looks at what is given and looks &lt;br /&gt;
&lt;br /&gt;
====Convenience methods====&lt;br /&gt;
These are very simple. A convenience method is simply an easy way to build and output an element in a single step.&lt;br /&gt;
If you take an element, likely an atom or molecule, a convenience method would have the same arguments as the constructor for the element, build an instance of the element and call render on it.&lt;br /&gt;
The following is a simple example using heading:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A convenience method to render a heading.&lt;br /&gt;
 */&lt;br /&gt;
public function heading($content, $level = 2) {&lt;br /&gt;
    $heading = new \core\output\heading($content, $level);&lt;br /&gt;
    return $this-&amp;gt;render($heading);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating output elements==&lt;br /&gt;
This is a big field and as such a dedicated document has been writen as a [[Guide to creating output elements]].&lt;br /&gt;
&lt;br /&gt;
==Tips on properly structuring your plugin==&lt;br /&gt;
Talk here about OO structuring of code, ensuring a traversable heirarchy that enables maximum movement of code structure to obtain data and in turn minimises necessary arguments for layout methods.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Render library specification discussion]&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45906</id>
		<title>User:Sam Hemelryk/CSS style guidelines</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45906"/>
		<updated>2014-07-22T11:22:12Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: Replaced content with &amp;quot;This page has now been made live. See Element HTML and CSS guidelines.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page has now been made live. See [[Element HTML and CSS guidelines]].&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Element_HTML_and_CSS_guidelines&amp;diff=45905</id>
		<title>Element HTML and CSS guidelines</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Element_HTML_and_CSS_guidelines&amp;diff=45905"/>
		<updated>2014-07-22T11:21:45Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: Copy the page from my personal area.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45830&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
This is a guide to writing HTML and CSS for elements within Moodle.&lt;br /&gt;
In the future this will likely become the HTML and CSS guide for output in Moodle as we want to move elements. However at present we don&#039;t want to enforce this for all output, just new conversions to elements.&lt;br /&gt;
&lt;br /&gt;
==Why have a strict guide==&lt;br /&gt;
&lt;br /&gt;
At the time of writing this CSS within Moodle (2.7) themes is in a poor state and has been for a long time. Without previously having a guide we were finding that:&lt;br /&gt;
&lt;br /&gt;
* As there was no formal guide to creating id&#039;s or classes, each developer does there own thing.&lt;br /&gt;
* As there was no formal guide on how to write CSS there were numerous techniques used when writing CSS and no consistency.&lt;br /&gt;
* Majority of pages create uniuqe output and require unique CSS, there is very little re-use of design.&lt;br /&gt;
&lt;br /&gt;
While those points may not sound bad to you consider that in following stats from Moodle 2.7 themes:&lt;br /&gt;
&lt;br /&gt;
* Base theme contains 3802 rulesets with a total of 5800 styles.&lt;br /&gt;
* Bootstrapbase theme contains 5170 rulesets with a total of 9362 styles.&lt;br /&gt;
* Clean theme contains 5172 rulesets with a total of 9366 styles.&lt;br /&gt;
* More theme contains 5177 rulesets with a total of 9063 styles.&lt;br /&gt;
&lt;br /&gt;
You get the picture, several thousand selectors containing nearly 10000 styles.&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.8 we commited to introducing a element library to aid the reuse of design and documenting all aspects of output including a guide on writing CSS for Moodle. This is that guide.&lt;br /&gt;
&lt;br /&gt;
==Our goals==&lt;br /&gt;
&lt;br /&gt;
Its very important to understand what we are trying to achieve with this style guide and output in general.&lt;br /&gt;
&lt;br /&gt;
; Frontend framework agnostic : We want theme designers to be able to apply present and future frontend frameworks to Moodle with minimal effort.&lt;br /&gt;
; Consistent interfaces : We want Moodle to have consistency throughout its interfaces, minimising the amount of frontend design and development that is required in coding and styling an interface.&lt;br /&gt;
; Cleanly formatted HTML and CSS : to minimise both development time and to make our renderers and CSS and more maintainable.&lt;br /&gt;
&lt;br /&gt;
We plan to faciliate these with the following:&lt;br /&gt;
; Elements : Highly re-usable objects to produce HTML, these will be used consistently and relied upon by developers creating interfaces. By having these elements we create a consistent look, interface creation will be much quicker and theme designers through the re-use of a limited number of elements.&lt;br /&gt;
; Element library : A tool to show samples of each element, this can be used to view and test designs. It aids the developer by showing them the elements they can select from when creating an interface, and it aids designers by giving them a test area that doesn&#039;t require them to dig through every page in Moodle.&lt;br /&gt;
; Documentation : We will now have proper documentation on all aspects of output. Including this CSS style guide, a renderer best practices guide, and a guide to creating elements.&lt;br /&gt;
&lt;br /&gt;
==Where to put CSS in Moodle core==&lt;br /&gt;
&lt;br /&gt;
CSS can reside in a number of locations depending upon what you are styling.&lt;br /&gt;
&lt;br /&gt;
Remember it doesn&#039;t matter how many CSS files we end up with, on a production site with Theme designer mode switched off (default) all CSS files will be combined and minimised into a single file that is served to the client.&lt;br /&gt;
Excepting the case of IE where we must split the CSS into several smaller files to work around browser limitations.&lt;br /&gt;
&lt;br /&gt;
===CSS for elements===&lt;br /&gt;
As we are moving to using elements you will find that CSS for elements is where most of the effort is going to go.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should reside within themes only, you will find that elements must be styled in all core base themes, this means at least Bootstrapbase and base.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should be located within either &#039;&#039;&#039;theme/themename/style/elements/elementname.css&#039;&#039;&#039; or &#039;&#039;&#039;theme/themename/less/elements/elementname.css&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The actual CSS file should be named according to the element. As elements can be namespaced we need to ensure that that is reflected in the name of the file.&lt;br /&gt;
For instance:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Element&lt;br /&gt;
! CSS location in base&lt;br /&gt;
! CSS location in bootstrapbase&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\button&lt;br /&gt;
| style/elements/core_output_button.css&lt;br /&gt;
| less/moodle/elements/core_output_button.css&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\navigation_bar&lt;br /&gt;
| style/elements/core_output_navigation_bar.css&lt;br /&gt;
| less/moodle/elements/core_output_navigation_bar.css&lt;br /&gt;
|-&lt;br /&gt;
| \mod_assign\output\user_submission&lt;br /&gt;
| style/elements/mod_assign_output_user_submission.css&lt;br /&gt;
| less/moodle/elements/mod_assign_output_user_submission.css&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These will still need to be included in the theme, by which ever means is relevant.&lt;br /&gt;
If you are using &#039;&#039;.css&#039;&#039; files like the base theme does then you will use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// In your themes config.php&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;elements/core_output_button&#039;,&lt;br /&gt;
    &#039;elements/core_output_navigation_bar&#039;,&lt;br /&gt;
    &#039;elements/mod_assign_output_user_submission&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using less as bootstrapbase does then you will use:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** In your primary less file **/&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_button&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_navigation_bar&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/mod_assign_output_user_submission&amp;quot;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General CSS===&lt;br /&gt;
&lt;br /&gt;
This is CSS for the theme that doesn&#039;t relate to a specific element. Hopefully as we convert more and more of Moodles interfaces to use elements we should see less general CSS.&lt;br /&gt;
&lt;br /&gt;
In any case nothing has changed in regards to the location of general CSS.&lt;br /&gt;
; CSS : If your theme is using standard CSS then it must be located within the &#039;&#039;style&#039;&#039; directory of your theme and should be in logically separated files.&lt;br /&gt;
; Less : If your theme is using less then it should be located in a &#039;&#039;less/moodle&#039;&#039; directory within your theme.&lt;br /&gt;
&lt;br /&gt;
We recommend that you separate styles into files based upon the Moodle component being styled. Again as all CSS files get combined into a single file on production sites it doesn&#039;t matter how many files you end up with.&lt;br /&gt;
&lt;br /&gt;
This would lead to files named like:&lt;br /&gt;
* style/core.css&lt;br /&gt;
* style/course.css&lt;br /&gt;
* style/mod_forum.css&lt;br /&gt;
&lt;br /&gt;
===Where to put CSS in plugins===&lt;br /&gt;
&lt;br /&gt;
It is possible in Moodle to add CSS stylesheets to all plugins (including core plugins).&amp;lt;br /&amp;gt;&lt;br /&gt;
Moodle always looks for a &#039;&#039;styles.css&#039;&#039; file within your plugins directory, and it also looks for a styles_themename.css where themename is the name of the currect theme being used.&lt;br /&gt;
&lt;br /&gt;
For instance the following could be added to the forum module:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;mod/forum/styles.css&#039;&#039;: Used all the time.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_base.css&#039;&#039; : Used when the user is using the base theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_bootstrapbase.css&#039;&#039; : Used when the user is using the bootstrapbase theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_clean.css&#039;&#039; : Used when the user is using the clean theme.&lt;br /&gt;
&lt;br /&gt;
===CSS in core plugins===&lt;br /&gt;
&lt;br /&gt;
For core plugins only styles.css is permitted and it should only ever contain styles essential to the presentation of the plugin.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present styles essential for the display of the plugin are allowed here, however when the plugin interfaces have been converted to use elements this file should be nearly empty and contain only the following:&lt;br /&gt;
* Images, icons and text used for visual presentation such as icons to notify state (expanded/collapsed, warnings...)&lt;br /&gt;
* Accessiblity orientated styles required to make the interface accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Under no circumstances should it contain any visual stylings such as border, rounded corners, and background colours not associated with state.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==HTML==&lt;br /&gt;
&lt;br /&gt;
The following sections detail rules in place for writing HTML.&lt;br /&gt;
&lt;br /&gt;
Before we start a couple of general recommendations:&lt;br /&gt;
&lt;br /&gt;
; Use hyphens rather than underscores when concatenating strings in attributes : for example &#039;&#039;.course-new-activity-chooser&#039;&#039; instead of &#039;&#039;.course_new_activity_chooser&#039;&#039;. By all doing this we will have a more consistent appearance and as We use underscores as part of frankenstyle which is prominent in CSS helps us to reduce the chance of naming conflicts.&lt;br /&gt;
; Think semantics - but don&#039;t get caught up in it : Semantic CSS is beautiful CSS lending itself ultimately to the redesign that is going to happen. But enforcing a semantic design can be an arduous journey. Instead we encourage semantic CSS but are happy to see non-semantic CSS when it is for the greater good.&lt;br /&gt;
&lt;br /&gt;
===Using the ID attribute===&lt;br /&gt;
&lt;br /&gt;
The situation of having a single JavaScript driven element was considered but even then it is better to style only classes and other attributes as we can&#039;t be sure what the future holds.&lt;br /&gt;
&lt;br /&gt;
There are three rules you should follow when creating an ID:&lt;br /&gt;
&lt;br /&gt;
# They should only be given to elements and HTML nodes that need to be interacted with by JavaScript.&lt;br /&gt;
# It should always start with &#039;&#039;&#039;m-&#039;&#039;&#039; &#039;&#039;(see note below)&#039;&#039;&lt;br /&gt;
# The actual ID should be descriptive of the node and contents as a whole unit. It must fully and concisely describe its purpose.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that in an ideal world ID&#039;s should not be used for styling.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Good&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-course-new-activity-chooser&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bad&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
It doesn&#039;t have the m- prefix&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This may appear OK at first but when you think about it selecting an activity within Moodle&lt;br /&gt;
is something that is done in multiple places and the this widget may not be applicable to&lt;br /&gt;
every place, as there may be other activity selector JS one day introduced having a&lt;br /&gt;
more complete ID is important&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-activity-selector&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The requirement to use m- prefix is entirely new, this has been created as this instantly reduces the chances of conflicting with present and future frontend frameworks that may be adopted by core or third party themes. Aiding our goal of being frontend framework agnostic.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will also help reduce the chance of conflicts in any third party code that may be used either by us in core, or by outside developers in their own code.&lt;br /&gt;
Moodle ID&#039;s will also be much more easily recognisable which we expect will be a benefit as JavaScript use in Moodle continues to increase.&lt;br /&gt;
&lt;br /&gt;
===Naming CSS classes===&lt;br /&gt;
&lt;br /&gt;
This is where a bit of organisation goes a long way and we want to be reasonably thorough in a consistent naming scheme and implementation.&lt;br /&gt;
&lt;br /&gt;
The very first thing to mention is that all classes in Moodle must now be prefixed by *m-*.&lt;br /&gt;
This instantly identifes a class as belonging to Moodle, it aids us in avoiding conflicts with any non-Moodle css that may be loaded, and it is part of our framework agnostic plan.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
All CSS classes must start with *m-*&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several prefix that are used within Moodle output now that should not be used as prefixs for classes unless they are serving the desired purpose.&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes are:&lt;br /&gt;
&lt;br /&gt;
; m-element : Prefix used on element classes, where m-element preceeds the name of the element, e.g. m-element-button, m-element-search&lt;br /&gt;
; m-state : Prefix used for CSS classes representing the state of an item, e.g. m-state-disabled, m-state-active, m-state-expanded.&lt;br /&gt;
; m-grid : Prefix used for creating HTML grids.&lt;br /&gt;
&lt;br /&gt;
====Elements====&lt;br /&gt;
&lt;br /&gt;
Semantic design where it gives the best result, smart design where there is a better solution.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re not already familiar with the idea of semantic CSS then Chris Coylers artical [http://css-tricks.com/semantic-class-names/ What makes for a semantic class name] is a great starting point.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve not commit to adopting any one strict approach for writing CSS. We have adopted atomic design for our HTML elements, a design style which fits nicely with the likes of OOCSS, however be very clear that we are not adopting the OOCSS approach in its entirety. The high level abstraction of the visual aspects of elements into highly reusable agnostic classes does not always lend itself well to the Moodle world in which the we wish to be frontend framework agnostic and support largescale completely customisable themes.&amp;lt;br /&amp;gt;&lt;br /&gt;
The highly reusable classes that appeal to one designer, or to one frontend framework may not apply to another.&amp;lt;br /&amp;gt;&lt;br /&gt;
This decision is also impacted by our current default theme bootstrapbase that does not use well abstracted OOCSS in its design.&lt;br /&gt;
&lt;br /&gt;
Atomic design is going to see us end up with many parent child relationships in our HTML that we must carry through to our CSS. Through atomic design we start with smalled atoms and molecules that get built into larger organisms and placed within layouts.&lt;br /&gt;
&lt;br /&gt;
Every element should have a single class that identifies it as element X.&lt;br /&gt;
&lt;br /&gt;
For instance the button atom will have the class *m-element-button*&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button class=&amp;quot;m-element-button&amp;quot;&amp;gt;I am a button&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is simply the prefix &amp;quot;m-element&amp;quot; plus the element name.&lt;br /&gt;
&lt;br /&gt;
The purpose of this class is to allow the element to be styled with ease. The class name should be applied to the root node for the element, it should never be applied any lower.&lt;br /&gt;
&lt;br /&gt;
By having one class for the element, and always and only applied to the root node it makes it very easy in HTML to see where one element belongs to another.&lt;br /&gt;
&lt;br /&gt;
The following is an example of the search molecule, which in turn contains two button atoms.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to partially adopt BEM as a CSS standard when writing CSS for elements.&lt;br /&gt;
BEM isn&#039;t a new CSS standard, but its not widely known either. Its existence fills a gap in how to style elements consistently. Through two basic notation techniques you can easily notate the purpose of structures that belong to an element and notate the intent of an element that is desired if the element has multiple versions.&lt;br /&gt;
&lt;br /&gt;
; Notating purpose : Here we use a suffix *__purpose*, the key being the two underscores.&lt;br /&gt;
; Notating intent : Here we use a suffix *--intent*, the key being the two hyphens.&lt;br /&gt;
&lt;br /&gt;
You&#039;ll notice in the example above that there is no way to style the continue button differently from the cancel button without relying on its name, something we certainly don&#039;t want to do.&lt;br /&gt;
The solution is to wrap each button in a div and give each div a class.&lt;br /&gt;
The BEM standard comes into play here in naming the classes, the following shows how you would apply BEM to show the purpose of each button in a way that can be easily interpreted and styled in CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__cancel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__continue&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now each button is wrapped in a div with a class, *m-element-confirmation__cancel* and *m-element-confirmation__continue*.&lt;br /&gt;
This class can be read by the themer and because of the __ can be easily identified as both belonging to the m-element-confirmation and serving a specific purpose, continue or cancel.&lt;br /&gt;
&lt;br /&gt;
Now to explain the idea of intents.&lt;br /&gt;
An intent is when a single element takes on a different apprearance to convey a specific meaning. A little bit like a state, but with more meaning.&lt;br /&gt;
An easy example is notifications where you will no doubt be familiar with the idea of having a error notifications, warning notifications, success notification etc. Each of error, warning, and success is a intent.&lt;br /&gt;
&lt;br /&gt;
The following shows how this would work:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- A standard notification --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- A warning --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification m-element-notification--warning&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Grids====&lt;br /&gt;
&lt;br /&gt;
We need to adopt a single grid framework.&lt;br /&gt;
&lt;br /&gt;
Personally I don&#039;t think we should use pure bootstrap or pure YUI, instead we should choose one of these and build it use our class name structures.&lt;br /&gt;
&lt;br /&gt;
All grid classes should start with m-grid.&lt;br /&gt;
&lt;br /&gt;
==CSS==&lt;br /&gt;
&lt;br /&gt;
Before we begin lets lay down some ground level goals, things that will help us achieve clear and understandable CSS in the future.&lt;br /&gt;
* Formatting, ordering, alignment, and spacing are all important in having CSS that can be easily read by others.&lt;br /&gt;
* Don&#039;t optimise your CSS, be verbose and stick to the styles in this guide. We have tools that will handle optimisation for you.&lt;br /&gt;
* Never use *!important* in your CSS unless it is absolutely impossible to avoid doing so.&lt;br /&gt;
&lt;br /&gt;
===Terminology===&lt;br /&gt;
&lt;br /&gt;
Its important that when we are speaking about CSS we are speaking the same language.&lt;br /&gt;
Lets look at the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-page .m-selector-1,&lt;br /&gt;
.m-page .m-selector-2,&lt;br /&gt;
.m-page .m-selector-3 {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
    color: #000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-1 {&lt;br /&gt;
    margin: 1em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Ruleset : Each of the two rules is a single *ruleset*.&lt;br /&gt;
; Rule: _.m-page .m-selector-1_ is a rule.&lt;br /&gt;
; Selector : _.m-selector-1_ is a *selector*, it is a single part of a rule.&lt;br /&gt;
; Declaration : _background-color: #FFF_ is a declaration.&lt;br /&gt;
;&lt;br /&gt;
&lt;br /&gt;
===Essential formatting===&lt;br /&gt;
&lt;br /&gt;
The following are the guies for writing CSS.&lt;br /&gt;
&lt;br /&gt;
* Always use spaces - never use tabs. All editors can be configured to do it.&lt;br /&gt;
* Indent by 4 spaces - never more, never less.&lt;br /&gt;
* A single empty line between rulesets to maintain consistent spacing of rules.&lt;br /&gt;
* One rule per line.&lt;br /&gt;
* A single space between each selector in a rule.&lt;br /&gt;
* No space between a rule and the comma in a ruleset.&lt;br /&gt;
* A single space between a selector and the opening brace of a ruleset.&lt;br /&gt;
* One level of indentation before each declaration.&lt;br /&gt;
* A single space the colon in a declaration.&lt;br /&gt;
* A single space after each item in a declaration containing multiple items.&lt;br /&gt;
&lt;br /&gt;
The following shows how the above rules apply:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-selector-1,&lt;br /&gt;
.m-selector-2 .m-selector-3 {&lt;br /&gt;
    background: #ffa800 url(&amp;quot;background.png&amp;quot;) no-repeat right top;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    display: inline-block;&lt;br /&gt;
    font-family: arial, sans-serif;&lt;br /&gt;
    margin: 5px 10px;&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-4 {&lt;br /&gt;
    border-radius: 3px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General rules===&lt;br /&gt;
&lt;br /&gt;
Declaration ordering is the very first thing to discuss. There is no strict rule on how to order your declarations, however there is a recommendation.&lt;br /&gt;
We recommend that you order declarations within a ruleset alphabetically.&lt;br /&gt;
If we all start doing this then when you read CSS written by someone else you will soon learn to very quickly find your way around the declarations within a rule.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Recommended **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    color: #000;&lt;br /&gt;
    display: block;&lt;br /&gt;
    margin: 5px;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do not use a measurement unit when writing a 0 value.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use lowercase and shorthand values for colours.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #ffffff;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: white;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always quote variable values.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector[attr=&amp;quot;variable&amp;quot;] {&lt;br /&gt;
    background-image: url(&amp;quot;image.png&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector[attr=variable] {&lt;br /&gt;
    background-image: url(image.png);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Commenting===&lt;br /&gt;
&lt;br /&gt;
Always comment your CSS and Less.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Styles for the button atom.&lt;br /&gt;
 */&lt;br /&gt;
.m-element-button {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rules and exceptions for less===&lt;br /&gt;
&lt;br /&gt;
Need to write some guff on Less.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[Element HTML and CSS guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Renderer_best_practises&amp;diff=45904</id>
		<title>Renderer best practises</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Renderer_best_practises&amp;diff=45904"/>
		<updated>2014-07-22T11:18:14Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: Replaced content with &amp;quot;{{obsolete}} Sorry - this page was created as a typo. Please see Renderer best practices&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{obsolete}}&lt;br /&gt;
Sorry - this page was created as a typo. Please see [[Renderer best practices]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Renderer_best_practices&amp;diff=45903</id>
		<title>Renderer best practices</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Renderer_best_practices&amp;diff=45903"/>
		<updated>2014-07-22T11:17:29Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: Page copied from my personal area.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45853&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
This page documents renderer best practices.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
* Must mention atomic design and how the concept of &amp;quot;templates&amp;quot; should be applied. Relates to the next note. A forth method type for renderers?&lt;br /&gt;
* Within a component or plugin that has a renderer use the renderer for EVERYTHING within that area. [https://moodle.org/mod/forum/discuss.php?d=262817#p1138926 forum post that ignited this]&lt;br /&gt;
* Reference and probably copy the three render methods from [Guide to creating output elements]&lt;br /&gt;
&lt;br /&gt;
==Renderer best practices==&lt;br /&gt;
&lt;br /&gt;
This document discusses the recommended practises to follow when writing renderers for Moodle. It was created in Moodle 2.8 as part of the element library specification that took place.&lt;br /&gt;
&lt;br /&gt;
Renderers provide an abstraction of logic and display. They serve Moodle to both encourage us to properly structure our code and to provide a means by which themes can take control of output to completely customise the look of Moodle.&lt;br /&gt;
Elements and the element library provide us a set of building blocks to use when creating output. These provide us a consistent and manageable look that also minimising the amount of customisation required by a theme to change the look and feel of Moodle.&lt;br /&gt;
Here we make a recommendation on how to write renderers to maximise the benefits to both yourself as a developer and to designers who have to customise the interfaces you create.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
Its important to understand the goals for output before you start looking at renderers as they are just one part of the output plan.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output in Moodle is designed to:&#039;&#039;&#039;&lt;br /&gt;
* Aid developers in properly abstracting output from logic.&lt;br /&gt;
* Allow designers to take complete control of output from within a theme if they wish.&lt;br /&gt;
* Provide a consisten look and feel for Moodle user.&lt;br /&gt;
* Allow developers to more rapidly create interfaces by having a set of elements at their finger tips.&lt;br /&gt;
* Minimise the efforts designers must extrude in order to customise the look and feel of Moodle by limiting the output to a set of elements.&lt;br /&gt;
* Aid designers by providing tools to support styling Moodle such as the element library.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Renderers in Moodle:&#039;&#039;&#039;&lt;br /&gt;
* Are the link between Moodle and a theme through which all output is generated.&lt;br /&gt;
* Are organised for the benefit of designers, and should be written following this document.&lt;br /&gt;
* Most importantly allow designers to override the HTML that wraps the data being displayed in turn allowing designers to re-design output in a theme.&lt;br /&gt;
* Allow designers to change the information being displayed by providing not just what is initially required but that which that may require.&lt;br /&gt;
&lt;br /&gt;
==A simple set of rules for a good renderer==&lt;br /&gt;
&lt;br /&gt;
Summarising what will be discussed further in this document a good renderer can be summarised as:&lt;br /&gt;
&lt;br /&gt;
* Think in elements. We have an element library, when planning the output for your plugin/component start with the elements in the element library and the markup they provide.&lt;br /&gt;
* Containing only methods confroming to the four method types discussed below.&lt;br /&gt;
* Encapsulated data is given, maximising the information available to the renderer and minimising the number of arguments.&lt;br /&gt;
* Free of logic relating to anything except output. This includes not calculating the likes of links and capabilities.&lt;br /&gt;
* Uses helper methods to manipulate data where manipulate is absolutely required, essentially abstracting logic to conform to the above rule.&lt;br /&gt;
* Utilise the core elements as much as is possible.&lt;br /&gt;
* Recognise unique output needs and create element(s) for it.&lt;br /&gt;
* The render method should be used as often as possible to maximise consistent look.&lt;br /&gt;
&lt;br /&gt;
==The don&#039;ts==&lt;br /&gt;
&lt;br /&gt;
The following are things that should not be done within a renderer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT:&#039;&#039;&#039;&lt;br /&gt;
* design interfaces from scratch when desiging output for your plugin/component. Always start with the elements found in the element library.&lt;br /&gt;
* Use logic that isn&#039;t essential to producing output. This includes but is not limited to the following:&lt;br /&gt;
** Database interaction of any kind.&lt;br /&gt;
** Access or capability checks.&lt;br /&gt;
** Generation of data such as producing URL&#039;s, that should be owned by the plugin/component and made available preferably through the given arguments or failing that through a helper method.&lt;br /&gt;
* Generate HTML for something that should be an element, convert it to an element and call render on it.&lt;br /&gt;
* Create custom elements for everything you plan to output, instead try to maximise the core elements that you use.&lt;br /&gt;
* Write your own render methods for subelements of the elements you create. Only do this if you absolutely must change the markup from that produced by the natural render method for the element.&lt;br /&gt;
&lt;br /&gt;
==Creating a renderer==&lt;br /&gt;
&lt;br /&gt;
===Location and naming===&lt;br /&gt;
As of Moodle 2.8 renderers can be put into the output namespace. This is the recommended placement for Renderers in Moodle 2.8 and up, however the alternatives will also be listed here.&lt;br /&gt;
&lt;br /&gt;
Recommended:&lt;br /&gt;
* Put your renderer in &#039;&#039;&#039;mod/yourplugin/output/renderer.php&#039;&#039;&#039; use the namespace &#039;&#039;&#039;mod_yourplugin\output&#039;&#039;&#039; and call your class &#039;&#039;&#039;renderer&#039;&#039;&#039;.&lt;br /&gt;
* To get an instance of your renderer &#039;&#039;$PAGE-&amp;gt;get_renderer(&#039;mod_yourplugin&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is how mod/yourplugin/output/renderer.php will look:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
namespace mod_yourplugin\output;&lt;br /&gt;
&lt;br /&gt;
class renderer extends \plugin_renderer_base {&lt;br /&gt;
    // Your renderer methods in here.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also available but not recommended:&lt;br /&gt;
* Put your renderer in &#039;&#039;&#039;mod/yourplugin/renderer.php&#039;&#039;&#039; do NOT namespace it, and call your class &#039;&#039;&#039;mod_yourplugin_renderer&#039;&#039;&#039;.&lt;br /&gt;
* To get an instance of your renderer &#039;&#039;$PAGE-&amp;gt;get_renderer(&#039;mod_yourplugin&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This was how things were done in earlier versions of Moodle (2.7 and below).&lt;br /&gt;
&lt;br /&gt;
===Render methods===&lt;br /&gt;
&lt;br /&gt;
Renderers can be well structured, the purpose of them is the same across all plugins and components.&lt;br /&gt;
There are four distinct types of render methods that you can expect to find in a renderer, and these four can be categorised into one of two categories.&lt;br /&gt;
&lt;br /&gt;
The four types of render methods:&lt;br /&gt;
# Layout methods&lt;br /&gt;
# Translator methods&lt;br /&gt;
# Render methods&lt;br /&gt;
# Convenience methods&lt;br /&gt;
&lt;br /&gt;
These four methods can then be categorised in two ways:&lt;br /&gt;
; Plugin|Component method : The layout and translator methods are plugin or component methods. They take data for a plugin or component and meld it into renderables. These methods relate to and can be said to be owned by the plugin or component. &lt;br /&gt;
; Element methods :  The render and convenience methods relate only to elements. They take already encapsulated abstracted data and simply output HTML structure around it. They pay no regard to the plugin or component and are completely and solely bound to the output of an element.&lt;br /&gt;
&lt;br /&gt;
====Layout methods====&lt;br /&gt;
&lt;br /&gt;
====Translator methods====&lt;br /&gt;
&lt;br /&gt;
====Render methods====&lt;br /&gt;
If you&#039;ve spent any time working with renderers in the past you will already be familiar with the concept of a render method.&lt;br /&gt;
All elements within Moodle inherit the renderable interface. To produce output for them you call the renderers render method and give the element.&lt;br /&gt;
The render method looks at what is given and looks &lt;br /&gt;
&lt;br /&gt;
====Convenience methods====&lt;br /&gt;
These are very simple. A convenience method is simply an easy way to build and output an element in a single step.&lt;br /&gt;
If you take an element, likely an atom or molecule, a convenience method would have the same arguments as the constructor for the element, build an instance of the element and call render on it.&lt;br /&gt;
The following is a simple example using heading:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A convenience method to render a heading.&lt;br /&gt;
 */&lt;br /&gt;
public function heading($content, $level = 2) {&lt;br /&gt;
    $heading = new \core\output\heading($content, $level);&lt;br /&gt;
    return $this-&amp;gt;render($heading);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating output elements==&lt;br /&gt;
This is a big field and as such a dedicated document has been writen as a [[Guide to creating output elements]].&lt;br /&gt;
&lt;br /&gt;
==Tips on properly structuring your plugin==&lt;br /&gt;
Talk here about OO structuring of code, ensuring a traversable heirarchy that enables maximum movement of code structure to obtain data and in turn minimises necessary arguments for layout methods.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Render library specification discussion]&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Renderer_best_practices&amp;diff=45902</id>
		<title>User:Sam Hemelryk/Renderer best practices</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Renderer_best_practices&amp;diff=45902"/>
		<updated>2014-07-22T11:13:16Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page has now been published as [[Renderer best practices]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Renderer_best_practices&amp;diff=45901</id>
		<title>User:Sam Hemelryk/Renderer best practices</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Renderer_best_practices&amp;diff=45901"/>
		<updated>2014-07-22T11:12:51Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: Replaced content with &amp;quot;This page has now been published as [Renderer best practices]&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page has now been published as [Renderer best practices]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Renderer_best_practises&amp;diff=45900</id>
		<title>Renderer best practises</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Renderer_best_practises&amp;diff=45900"/>
		<updated>2014-07-22T11:12:04Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: Created page with &amp;quot;{{Infobox Project |name = Renderer consistency |state = Specification |tracker = https://tracker.moodle.org/browse/MDL-45853 |discussion = https://moodle.org/mod/forum/discuss...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45853&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
This page documents renderer best practices.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
* Must mention atomic design and how the concept of &amp;quot;templates&amp;quot; should be applied. Relates to the next note. A forth method type for renderers?&lt;br /&gt;
* Within a component or plugin that has a renderer use the renderer for EVERYTHING within that area. [https://moodle.org/mod/forum/discuss.php?d=262817#p1138926 forum post that ignited this]&lt;br /&gt;
* Reference and probably copy the three render methods from [Guide to creating output elements]&lt;br /&gt;
&lt;br /&gt;
==Renderer best practices==&lt;br /&gt;
&lt;br /&gt;
This document discusses the recommended practises to follow when writing renderers for Moodle. It was created in Moodle 2.8 as part of the element library specification that took place.&lt;br /&gt;
&lt;br /&gt;
Renderers provide an abstraction of logic and display. They serve Moodle to both encourage us to properly structure our code and to provide a means by which themes can take control of output to completely customise the look of Moodle.&lt;br /&gt;
Elements and the element library provide us a set of building blocks to use when creating output. These provide us a consistent and manageable look that also minimising the amount of customisation required by a theme to change the look and feel of Moodle.&lt;br /&gt;
Here we make a recommendation on how to write renderers to maximise the benefits to both yourself as a developer and to designers who have to customise the interfaces you create.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
Its important to understand the goals for output before you start looking at renderers as they are just one part of the output plan.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output in Moodle is designed to:&#039;&#039;&#039;&lt;br /&gt;
* Aid developers in properly abstracting output from logic.&lt;br /&gt;
* Allow designers to take complete control of output from within a theme if they wish.&lt;br /&gt;
* Provide a consisten look and feel for Moodle user.&lt;br /&gt;
* Allow developers to more rapidly create interfaces by having a set of elements at their finger tips.&lt;br /&gt;
* Minimise the efforts designers must extrude in order to customise the look and feel of Moodle by limiting the output to a set of elements.&lt;br /&gt;
* Aid designers by providing tools to support styling Moodle such as the element library.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Renderers in Moodle:&#039;&#039;&#039;&lt;br /&gt;
* Are the link between Moodle and a theme through which all output is generated.&lt;br /&gt;
* Are organised for the benefit of designers, and should be written following this document.&lt;br /&gt;
* Most importantly allow designers to override the HTML that wraps the data being displayed in turn allowing designers to re-design output in a theme.&lt;br /&gt;
* Allow designers to change the information being displayed by providing not just what is initially required but that which that may require.&lt;br /&gt;
&lt;br /&gt;
==A simple set of rules for a good renderer==&lt;br /&gt;
&lt;br /&gt;
Summarising what will be discussed further in this document a good renderer can be summarised as:&lt;br /&gt;
&lt;br /&gt;
* Think in elements. We have an element library, when planning the output for your plugin/component start with the elements in the element library and the markup they provide.&lt;br /&gt;
* Containing only methods confroming to the four method types discussed below.&lt;br /&gt;
* Encapsulated data is given, maximising the information available to the renderer and minimising the number of arguments.&lt;br /&gt;
* Free of logic relating to anything except output. This includes not calculating the likes of links and capabilities.&lt;br /&gt;
* Uses helper methods to manipulate data where manipulate is absolutely required, essentially abstracting logic to conform to the above rule.&lt;br /&gt;
* Utilise the core elements as much as is possible.&lt;br /&gt;
* Recognise unique output needs and create element(s) for it.&lt;br /&gt;
* The render method should be used as often as possible to maximise consistent look.&lt;br /&gt;
&lt;br /&gt;
==The don&#039;ts==&lt;br /&gt;
&lt;br /&gt;
The following are things that should not be done within a renderer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT:&#039;&#039;&#039;&lt;br /&gt;
* design interfaces from scratch when desiging output for your plugin/component. Always start with the elements found in the element library.&lt;br /&gt;
* Use logic that isn&#039;t essential to producing output. This includes but is not limited to the following:&lt;br /&gt;
** Database interaction of any kind.&lt;br /&gt;
** Access or capability checks.&lt;br /&gt;
** Generation of data such as producing URL&#039;s, that should be owned by the plugin/component and made available preferably through the given arguments or failing that through a helper method.&lt;br /&gt;
* Generate HTML for something that should be an element, convert it to an element and call render on it.&lt;br /&gt;
* Create custom elements for everything you plan to output, instead try to maximise the core elements that you use.&lt;br /&gt;
* Write your own render methods for subelements of the elements you create. Only do this if you absolutely must change the markup from that produced by the natural render method for the element.&lt;br /&gt;
&lt;br /&gt;
==Creating a renderer==&lt;br /&gt;
&lt;br /&gt;
===Location and naming===&lt;br /&gt;
As of Moodle 2.8 renderers can be put into the output namespace. This is the recommended placement for Renderers in Moodle 2.8 and up, however the alternatives will also be listed here.&lt;br /&gt;
&lt;br /&gt;
Recommended:&lt;br /&gt;
* Put your renderer in &#039;&#039;&#039;mod/yourplugin/output/renderer.php&#039;&#039;&#039; use the namespace &#039;&#039;&#039;mod_yourplugin\output&#039;&#039;&#039; and call your class &#039;&#039;&#039;renderer&#039;&#039;&#039;.&lt;br /&gt;
* To get an instance of your renderer &#039;&#039;$PAGE-&amp;gt;get_renderer(&#039;mod_yourplugin&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is how mod/yourplugin/output/renderer.php will look:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
namespace mod_yourplugin\output;&lt;br /&gt;
&lt;br /&gt;
class renderer extends \plugin_renderer_base {&lt;br /&gt;
    // Your renderer methods in here.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also available but not recommended:&lt;br /&gt;
* Put your renderer in &#039;&#039;&#039;mod/yourplugin/renderer.php&#039;&#039;&#039; do NOT namespace it, and call your class &#039;&#039;&#039;mod_yourplugin_renderer&#039;&#039;&#039;.&lt;br /&gt;
* To get an instance of your renderer &#039;&#039;$PAGE-&amp;gt;get_renderer(&#039;mod_yourplugin&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This was how things were done in earlier versions of Moodle (2.7 and below).&lt;br /&gt;
&lt;br /&gt;
===Render methods===&lt;br /&gt;
&lt;br /&gt;
Renderers can be well structured, the purpose of them is the same across all plugins and components.&lt;br /&gt;
There are four distinct types of render methods that you can expect to find in a renderer, and these four can be categorised into one of two categories.&lt;br /&gt;
&lt;br /&gt;
The four types of render methods:&lt;br /&gt;
# Layout methods&lt;br /&gt;
# Translator methods&lt;br /&gt;
# Render methods&lt;br /&gt;
# Convenience methods&lt;br /&gt;
&lt;br /&gt;
These four methods can then be categorised in two ways:&lt;br /&gt;
; Plugin|Component method : The layout and translator methods are plugin or component methods. They take data for a plugin or component and meld it into renderables. These methods relate to and can be said to be owned by the plugin or component. &lt;br /&gt;
; Element methods :  The render and convenience methods relate only to elements. They take already encapsulated abstracted data and simply output HTML structure around it. They pay no regard to the plugin or component and are completely and solely bound to the output of an element.&lt;br /&gt;
&lt;br /&gt;
====Layout methods====&lt;br /&gt;
&lt;br /&gt;
====Translator methods====&lt;br /&gt;
&lt;br /&gt;
====Render methods====&lt;br /&gt;
If you&#039;ve spent any time working with renderers in the past you will already be familiar with the concept of a render method.&lt;br /&gt;
All elements within Moodle inherit the renderable interface. To produce output for them you call the renderers render method and give the element.&lt;br /&gt;
The render method looks at what is given and looks &lt;br /&gt;
&lt;br /&gt;
====Convenience methods====&lt;br /&gt;
These are very simple. A convenience method is simply an easy way to build and output an element in a single step.&lt;br /&gt;
If you take an element, likely an atom or molecule, a convenience method would have the same arguments as the constructor for the element, build an instance of the element and call render on it.&lt;br /&gt;
The following is a simple example using heading:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A convenience method to render a heading.&lt;br /&gt;
 */&lt;br /&gt;
public function heading($content, $level = 2) {&lt;br /&gt;
    $heading = new \core\output\heading($content, $level);&lt;br /&gt;
    return $this-&amp;gt;render($heading);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating output elements==&lt;br /&gt;
This is a big field and as such a dedicated document has been writen as a [[Guide to creating output elements]].&lt;br /&gt;
&lt;br /&gt;
==Tips on properly structuring your plugin==&lt;br /&gt;
Talk here about OO structuring of code, ensuring a traversable heirarchy that enables maximum movement of code structure to obtain data and in turn minimises necessary arguments for layout methods.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Render library specification discussion]&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45899</id>
		<title>User:Sam Hemelryk/CSS style guidelines</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45899"/>
		<updated>2014-07-22T05:27:04Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45830&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
==HTML and CSS style guide==&lt;br /&gt;
&lt;br /&gt;
This is a guide to writing CSS within Moodle.&lt;br /&gt;
&lt;br /&gt;
==Why have a strict guide==&lt;br /&gt;
&lt;br /&gt;
At the time of writing this CSS within Moodle (2.7) themes is in a poor state and has been for a long time. Without previously having a guide we were finding that:&lt;br /&gt;
&lt;br /&gt;
* As there was no formal guide to creating id&#039;s or classes, each developer does there own thing.&lt;br /&gt;
* As there was no formal guide on how to write CSS there were numerous techniques used when writing CSS and no consistency.&lt;br /&gt;
* Majority of pages create uniuqe output and require unique CSS, there is very little re-use of design.&lt;br /&gt;
&lt;br /&gt;
While those points may not sound bad to you consider that in following stats from Moodle 2.7 themes:&lt;br /&gt;
&lt;br /&gt;
* Base theme contains 3802 rulesets with a total of 5800 styles.&lt;br /&gt;
* Bootstrapbase theme contains 5170 rulesets with a total of 9362 styles.&lt;br /&gt;
* Clean theme contains 5172 rulesets with a total of 9366 styles.&lt;br /&gt;
* More theme contains 5177 rulesets with a total of 9063 styles.&lt;br /&gt;
&lt;br /&gt;
You get the picture, several thousand selectors containing nearly 10000 styles.&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.8 we commited to introducing a element library to aid the reuse of design and documenting all aspects of output including a guide on writing CSS for Moodle. This is that guide.&lt;br /&gt;
&lt;br /&gt;
==Our goals==&lt;br /&gt;
&lt;br /&gt;
Its very important to understand what we are trying to achieve with this style guide and output in general.&lt;br /&gt;
&lt;br /&gt;
; Frontend framework agnostic : We want theme designers to be able to apply present and future frontend frameworks to Moodle with minimal effort.&lt;br /&gt;
; Consistent interfaces : We want Moodle to have consistency throughout its interfaces, minimising the amount of frontend design and development that is required in coding and styling an interface.&lt;br /&gt;
; Cleanly formatted HTML and CSS : to minimise both development time and to make our renderers and CSS and more maintainable.&lt;br /&gt;
&lt;br /&gt;
We plan to faciliate these with the following:&lt;br /&gt;
; Elements : Highly re-usable objects to produce HTML, these will be used consistently and relied upon by developers creating interfaces. By having these elements we create a consistent look, interface creation will be much quicker and theme designers through the re-use of a limited number of elements.&lt;br /&gt;
; Element library : A tool to show samples of each element, this can be used to view and test designs. It aids the developer by showing them the elements they can select from when creating an interface, and it aids designers by giving them a test area that doesn&#039;t require them to dig through every page in Moodle.&lt;br /&gt;
; Documentation : We will now have proper documentation on all aspects of output. Including this CSS style guide, a renderer best practices guide, and a guide to creating elements.&lt;br /&gt;
&lt;br /&gt;
==Where to put CSS in Moodle core==&lt;br /&gt;
&lt;br /&gt;
CSS can reside in a number of locations depending upon what you are styling.&lt;br /&gt;
&lt;br /&gt;
Remember it doesn&#039;t matter how many CSS files we end up with, on a production site with Theme designer mode switched off (default) all CSS files will be combined and minimised into a single file that is served to the client.&lt;br /&gt;
Excepting the case of IE where we must split the CSS into several smaller files to work around browser limitations.&lt;br /&gt;
&lt;br /&gt;
===CSS for elements===&lt;br /&gt;
As we are moving to using elements you will find that CSS for elements is where most of the effort is going to go.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should reside within themes only, you will find that elements must be styled in all core base themes, this means at least Bootstrapbase and base.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should be located within either &#039;&#039;&#039;theme/themename/style/elements/elementname.css&#039;&#039;&#039; or &#039;&#039;&#039;theme/themename/less/elements/elementname.css&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The actual CSS file should be named according to the element. As elements can be namespaced we need to ensure that that is reflected in the name of the file.&lt;br /&gt;
For instance:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Element&lt;br /&gt;
! CSS location in base&lt;br /&gt;
! CSS location in bootstrapbase&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\button&lt;br /&gt;
| style/elements/core_output_button.css&lt;br /&gt;
| less/moodle/elements/core_output_button.css&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\navigation_bar&lt;br /&gt;
| style/elements/core_output_navigation_bar.css&lt;br /&gt;
| less/moodle/elements/core_output_navigation_bar.css&lt;br /&gt;
|-&lt;br /&gt;
| \mod_assign\output\user_submission&lt;br /&gt;
| style/elements/mod_assign_output_user_submission.css&lt;br /&gt;
| less/moodle/elements/mod_assign_output_user_submission.css&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These will still need to be included in the theme, by which ever means is relevant.&lt;br /&gt;
If you are using &#039;&#039;.css&#039;&#039; files like the base theme does then you will use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// In your themes config.php&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;elements/core_output_button&#039;,&lt;br /&gt;
    &#039;elements/core_output_navigation_bar&#039;,&lt;br /&gt;
    &#039;elements/mod_assign_output_user_submission&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using less as bootstrapbase does then you will use:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** In your primary less file **/&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_button&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_navigation_bar&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/mod_assign_output_user_submission&amp;quot;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General CSS===&lt;br /&gt;
&lt;br /&gt;
This is CSS for the theme that doesn&#039;t relate to a specific element. Hopefully as we convert more and more of Moodles interfaces to use elements we should see less general CSS.&lt;br /&gt;
&lt;br /&gt;
In any case nothing has changed in regards to the location of general CSS.&lt;br /&gt;
; CSS : If your theme is using standard CSS then it must be located within the &#039;&#039;style&#039;&#039; directory of your theme and should be in logically separated files.&lt;br /&gt;
; Less : If your theme is using less then it should be located in a &#039;&#039;less/moodle&#039;&#039; directory within your theme.&lt;br /&gt;
&lt;br /&gt;
We recommend that you separate styles into files based upon the Moodle component being styled. Again as all CSS files get combined into a single file on production sites it doesn&#039;t matter how many files you end up with.&lt;br /&gt;
&lt;br /&gt;
This would lead to files named like:&lt;br /&gt;
* style/core.css&lt;br /&gt;
* style/course.css&lt;br /&gt;
* style/mod_forum.css&lt;br /&gt;
&lt;br /&gt;
===Where to put CSS in plugins===&lt;br /&gt;
&lt;br /&gt;
It is possible in Moodle to add CSS stylesheets to all plugins (including core plugins).&amp;lt;br /&amp;gt;&lt;br /&gt;
Moodle always looks for a &#039;&#039;styles.css&#039;&#039; file within your plugins directory, and it also looks for a styles_themename.css where themename is the name of the currect theme being used.&lt;br /&gt;
&lt;br /&gt;
For instance the following could be added to the forum module:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;mod/forum/styles.css&#039;&#039;: Used all the time.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_base.css&#039;&#039; : Used when the user is using the base theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_bootstrapbase.css&#039;&#039; : Used when the user is using the bootstrapbase theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_clean.css&#039;&#039; : Used when the user is using the clean theme.&lt;br /&gt;
&lt;br /&gt;
===CSS in core plugins===&lt;br /&gt;
&lt;br /&gt;
For core plugins only styles.css is permitted and it should only ever contain styles essential to the presentation of the plugin.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present styles essential for the display of the plugin are allowed here, however when the plugin interfaces have been converted to use elements this file should be nearly empty and contain only the following:&lt;br /&gt;
* Images, icons and text used for visual presentation such as icons to notify state (expanded/collapsed, warnings...)&lt;br /&gt;
* Accessiblity orientated styles required to make the interface accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Under no circumstances should it contain any visual stylings such as border, rounded corners, and background colours not associated with state.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==HTML==&lt;br /&gt;
&lt;br /&gt;
The following sections detail rules in place for writing HTML.&lt;br /&gt;
&lt;br /&gt;
Before we start a couple of general recommendations:&lt;br /&gt;
&lt;br /&gt;
; Use hyphens rather than underscores when concatenating strings in attributes : for example &#039;&#039;.course-new-activity-chooser&#039;&#039; instead of &#039;&#039;.course_new_activity_chooser&#039;&#039;. By all doing this we will have a more consistent appearance and as We use underscores as part of frankenstyle which is prominent in CSS helps us to reduce the chance of naming conflicts.&lt;br /&gt;
; Think semantics - but don&#039;t get caught up in it : Semantic CSS is beautiful CSS lending itself ultimately to the redesign that is going to happen. But enforcing a semantic design can be an arduous journey. Instead we encourage semantic CSS but are happy to see non-semantic CSS when it is for the greater good.&lt;br /&gt;
&lt;br /&gt;
===Using the ID attribute===&lt;br /&gt;
&lt;br /&gt;
The situation of having a single JavaScript driven element was considered but even then it is better to style only classes and other attributes as we can&#039;t be sure what the future holds.&lt;br /&gt;
&lt;br /&gt;
There are three rules you should follow when creating an ID:&lt;br /&gt;
&lt;br /&gt;
# They should only be given to elements and HTML nodes that need to be interacted with by JavaScript.&lt;br /&gt;
# It should always start with &#039;&#039;&#039;m-&#039;&#039;&#039; &#039;&#039;(see note below)&#039;&#039;&lt;br /&gt;
# The actual ID should be descriptive of the node and contents as a whole unit. It must fully and concisely describe its purpose.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that in an ideal world ID&#039;s should not be used for styling.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Good&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-course-new-activity-chooser&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bad&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
It doesn&#039;t have the m- prefix&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This may appear OK at first but when you think about it selecting an activity within Moodle&lt;br /&gt;
is something that is done in multiple places and the this widget may not be applicable to&lt;br /&gt;
every place, as there may be other activity selector JS one day introduced having a&lt;br /&gt;
more complete ID is important&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-activity-selector&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The requirement to use m- prefix is entirely new, this has been created as this instantly reduces the chances of conflicting with present and future frontend frameworks that may be adopted by core or third party themes. Aiding our goal of being frontend framework agnostic.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will also help reduce the chance of conflicts in any third party code that may be used either by us in core, or by outside developers in their own code.&lt;br /&gt;
Moodle ID&#039;s will also be much more easily recognisable which we expect will be a benefit as JavaScript use in Moodle continues to increase.&lt;br /&gt;
&lt;br /&gt;
===Naming CSS classes===&lt;br /&gt;
&lt;br /&gt;
This is where a bit of organisation goes a long way and we want to be reasonably thorough in a consistent naming scheme and implementation.&lt;br /&gt;
&lt;br /&gt;
The very first thing to mention is that all classes in Moodle must now be prefixed by *m-*.&lt;br /&gt;
This instantly identifes a class as belonging to Moodle, it aids us in avoiding conflicts with any non-Moodle css that may be loaded, and it is part of our framework agnostic plan.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
All CSS classes must start with *m-*&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several prefix that are used within Moodle output now that should not be used as prefixs for classes unless they are serving the desired purpose.&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes are:&lt;br /&gt;
&lt;br /&gt;
; m-element : Prefix used on element classes, where m-element preceeds the name of the element, e.g. m-element-button, m-element-search&lt;br /&gt;
; m-state : Prefix used for CSS classes representing the state of an item, e.g. m-state-disabled, m-state-active, m-state-expanded.&lt;br /&gt;
; m-grid : Prefix used for creating HTML grids.&lt;br /&gt;
&lt;br /&gt;
====Elements====&lt;br /&gt;
&lt;br /&gt;
Semantic design where it gives the best result, smart design where there is a better solution.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re not already familiar with the idea of semantic CSS then Chris Coylers artical [http://css-tricks.com/semantic-class-names/ What makes for a semantic class name] is a great starting point.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve not commit to adopting any one strict approach for writing CSS. We have adopted atomic design for our HTML elements, a design style which fits nicely with the likes of OOCSS, however be very clear that we are not adopting the OOCSS approach in its entirety. The high level abstraction of the visual aspects of elements into highly reusable agnostic classes does not always lend itself well to the Moodle world in which the we wish to be frontend framework agnostic and support largescale completely customisable themes.&amp;lt;br /&amp;gt;&lt;br /&gt;
The highly reusable classes that appeal to one designer, or to one frontend framework may not apply to another.&amp;lt;br /&amp;gt;&lt;br /&gt;
This decision is also impacted by our current default theme bootstrapbase that does not use well abstracted OOCSS in its design.&lt;br /&gt;
&lt;br /&gt;
Atomic design is going to see us end up with many parent child relationships in our HTML that we must carry through to our CSS. Through atomic design we start with smalled atoms and molecules that get built into larger organisms and placed within layouts.&lt;br /&gt;
&lt;br /&gt;
Every element should have a single class that identifies it as element X.&lt;br /&gt;
&lt;br /&gt;
For instance the button atom will have the class *m-element-button*&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button class=&amp;quot;m-element-button&amp;quot;&amp;gt;I am a button&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is simply the prefix &amp;quot;m-element&amp;quot; plus the element name.&lt;br /&gt;
&lt;br /&gt;
The purpose of this class is to allow the element to be styled with ease. The class name should be applied to the root node for the element, it should never be applied any lower.&lt;br /&gt;
&lt;br /&gt;
By having one class for the element, and always and only applied to the root node it makes it very easy in HTML to see where one element belongs to another.&lt;br /&gt;
&lt;br /&gt;
The following is an example of the search molecule, which in turn contains two button atoms.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to partially adopt BEM as a CSS standard when writing CSS for elements.&lt;br /&gt;
BEM isn&#039;t a new CSS standard, but its not widely known either. Its existence fills a gap in how to style elements consistently. Through two basic notation techniques you can easily notate the purpose of structures that belong to an element and notate the intent of an element that is desired if the element has multiple versions.&lt;br /&gt;
&lt;br /&gt;
; Notating purpose : Here we use a suffix *__purpose*, the key being the two underscores.&lt;br /&gt;
; Notating intent : Here we use a suffix *--intent*, the key being the two hyphens.&lt;br /&gt;
&lt;br /&gt;
You&#039;ll notice in the example above that there is no way to style the continue button differently from the cancel button without relying on its name, something we certainly don&#039;t want to do.&lt;br /&gt;
The solution is to wrap each button in a div and give each div a class.&lt;br /&gt;
The BEM standard comes into play here in naming the classes, the following shows how you would apply BEM to show the purpose of each button in a way that can be easily interpreted and styled in CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__cancel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__continue&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now each button is wrapped in a div with a class, *m-element-confirmation__cancel* and *m-element-confirmation__continue*.&lt;br /&gt;
This class can be read by the themer and because of the __ can be easily identified as both belonging to the m-element-confirmation and serving a specific purpose, continue or cancel.&lt;br /&gt;
&lt;br /&gt;
Now to explain the idea of intents.&lt;br /&gt;
An intent is when a single element takes on a different apprearance to convey a specific meaning. A little bit like a state, but with more meaning.&lt;br /&gt;
An easy example is notifications where you will no doubt be familiar with the idea of having a error notifications, warning notifications, success notification etc. Each of error, warning, and success is a intent.&lt;br /&gt;
&lt;br /&gt;
The following shows how this would work:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- A standard notification --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- A warning --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification m-element-notification--warning&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Grids====&lt;br /&gt;
&lt;br /&gt;
We need to adopt a single grid framework.&lt;br /&gt;
&lt;br /&gt;
Personally I don&#039;t think we should use pure bootstrap or pure YUI, instead we should choose one of these and build it use our class name structures.&lt;br /&gt;
&lt;br /&gt;
All grid classes should start with m-grid.&lt;br /&gt;
&lt;br /&gt;
==CSS==&lt;br /&gt;
&lt;br /&gt;
Before we begin lets lay down some ground level goals, things that will help us achieve clear and understandable CSS in the future.&lt;br /&gt;
* Formatting, ordering, alignment, and spacing are all important in having CSS that can be easily read by others.&lt;br /&gt;
* Don&#039;t optimise your CSS, be verbose and stick to the styles in this guide. We have tools that will handle optimisation for you.&lt;br /&gt;
* Never use *!important* in your CSS unless it is absolutely impossible to avoid doing so.&lt;br /&gt;
&lt;br /&gt;
===Terminology===&lt;br /&gt;
&lt;br /&gt;
Its important that when we are speaking about CSS we are speaking the same language.&lt;br /&gt;
Lets look at the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-page .m-selector-1,&lt;br /&gt;
.m-page .m-selector-2,&lt;br /&gt;
.m-page .m-selector-3 {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
    color: #000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-1 {&lt;br /&gt;
    margin: 1em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Ruleset : Each of the two rules is a single *ruleset*.&lt;br /&gt;
; Rule: _.m-page .m-selector-1_ is a rule.&lt;br /&gt;
; Selector : _.m-selector-1_ is a *selector*, it is a single part of a rule.&lt;br /&gt;
; Declaration : _background-color: #FFF_ is a declaration.&lt;br /&gt;
;&lt;br /&gt;
&lt;br /&gt;
===Essential formatting===&lt;br /&gt;
&lt;br /&gt;
The following are the guies for writing CSS.&lt;br /&gt;
&lt;br /&gt;
* Always use spaces - never use tabs. All editors can be configured to do it.&lt;br /&gt;
* Indent by 4 spaces - never more, never less.&lt;br /&gt;
* A single empty line between rulesets to maintain consistent spacing of rules.&lt;br /&gt;
* One rule per line.&lt;br /&gt;
* A single space between each selector in a rule.&lt;br /&gt;
* No space between a rule and the comma in a ruleset.&lt;br /&gt;
* A single space between a selector and the opening brace of a ruleset.&lt;br /&gt;
* One level of indentation before each declaration.&lt;br /&gt;
* A single space the colon in a declaration.&lt;br /&gt;
* A single space after each item in a declaration containing multiple items.&lt;br /&gt;
&lt;br /&gt;
The following shows how the above rules apply:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-selector-1,&lt;br /&gt;
.m-selector-2 .m-selector-3 {&lt;br /&gt;
    background: #ffa800 url(&amp;quot;background.png&amp;quot;) no-repeat right top;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    display: inline-block;&lt;br /&gt;
    font-family: arial, sans-serif;&lt;br /&gt;
    margin: 5px 10px;&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-4 {&lt;br /&gt;
    border-radius: 3px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General rules===&lt;br /&gt;
&lt;br /&gt;
Declaration ordering is the very first thing to discuss. There is no strict rule on how to order your declarations, however there is a recommendation.&lt;br /&gt;
We recommend that you order declarations within a ruleset alphabetically.&lt;br /&gt;
If we all start doing this then when you read CSS written by someone else you will soon learn to very quickly find your way around the declarations within a rule.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Recommended **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    color: #000;&lt;br /&gt;
    display: block;&lt;br /&gt;
    margin: 5px;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do not use a measurement unit when writing a 0 value.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use lowercase and shorthand values for colours.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #ffffff;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: white;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always quote variable values.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector[attr=&amp;quot;variable&amp;quot;] {&lt;br /&gt;
    background-image: url(&amp;quot;image.png&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector[attr=variable] {&lt;br /&gt;
    background-image: url(image.png);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Commenting===&lt;br /&gt;
&lt;br /&gt;
Always comment your CSS and Less.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Styles for the button atom.&lt;br /&gt;
 */&lt;br /&gt;
.m-element-button {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rules and exceptions for less===&lt;br /&gt;
&lt;br /&gt;
Need to write some guff on Less.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45898</id>
		<title>User:Sam Hemelryk/CSS style guidelines</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45898"/>
		<updated>2014-07-22T05:26:32Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45830&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
==HTML and CSS style guide==&lt;br /&gt;
&lt;br /&gt;
This is a guide to writing CSS within Moodle.&lt;br /&gt;
&lt;br /&gt;
==Why have a strict guide==&lt;br /&gt;
&lt;br /&gt;
At the time of writing this CSS within Moodle (2.7) themes is in a poor state and has been for a long time. Without previously having a guide we were finding that:&lt;br /&gt;
&lt;br /&gt;
* As there was no formal guide to creating id&#039;s or classes, each developer does there own thing.&lt;br /&gt;
* As there was no formal guide on how to write CSS there were numerous techniques used when writing CSS and no consistency.&lt;br /&gt;
* Majority of pages create uniuqe output and require unique CSS, there is very little re-use of design.&lt;br /&gt;
&lt;br /&gt;
While those points may not sound bad to you consider that in following stats from Moodle 2.7 themes:&lt;br /&gt;
&lt;br /&gt;
* Base theme contains 3802 rulesets with a total of 5800 styles.&lt;br /&gt;
* Bootstrapbase theme contains 5170 rulesets with a total of 9362 styles.&lt;br /&gt;
* Clean theme contains 5172 rulesets with a total of 9366 styles.&lt;br /&gt;
* More theme contains 5177 rulesets with a total of 9063 styles.&lt;br /&gt;
&lt;br /&gt;
You get the picture, several thousand selectors containing nearly 10000 styles.&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.8 we commited to introducing a element library to aid the reuse of design and documenting all aspects of output including a guide on writing CSS for Moodle. This is that guide.&lt;br /&gt;
&lt;br /&gt;
==Our goals==&lt;br /&gt;
&lt;br /&gt;
Its very important to understand what we are trying to achieve with this style guide and output in general.&lt;br /&gt;
&lt;br /&gt;
; Frontend framework agnostic : We want theme designers to be able to apply present and future frontend frameworks to Moodle with minimal effort.&lt;br /&gt;
; Consistent interfaces : We want Moodle to have consistency throughout its interfaces, minimising the amount of frontend design and development that is required in coding and styling an interface.&lt;br /&gt;
; Cleanly formatted HTML and CSS : to minimise both development time and to make our renderers and CSS and more maintainable.&lt;br /&gt;
&lt;br /&gt;
We plan to faciliate these with the following:&lt;br /&gt;
; Elements : Highly re-usable objects to produce HTML, these will be used consistently and relied upon by developers creating interfaces. By having these elements we create a consistent look, interface creation will be much quicker and theme designers through the re-use of a limited number of elements.&lt;br /&gt;
; Element library : A tool to show samples of each element, this can be used to view and test designs. It aids the developer by showing them the elements they can select from when creating an interface, and it aids designers by giving them a test area that doesn&#039;t require them to dig through every page in Moodle.&lt;br /&gt;
; Documentation : We will now have proper documentation on all aspects of output. Including this CSS style guide, a renderer best practices guide, and a guide to creating elements.&lt;br /&gt;
&lt;br /&gt;
==Where to put CSS in Moodle core==&lt;br /&gt;
&lt;br /&gt;
CSS can reside in a number of locations depending upon what you are styling.&lt;br /&gt;
&lt;br /&gt;
Remember it doesn&#039;t matter how many CSS files we end up with, on a production site with Theme designer mode switched off (default) all CSS files will be combined and minimised into a single file that is served to the client.&lt;br /&gt;
Excepting the case of IE where we must split the CSS into several smaller files to work around browser limitations.&lt;br /&gt;
&lt;br /&gt;
===CSS for elements===&lt;br /&gt;
As we are moving to using elements you will find that CSS for elements is where most of the effort is going to go.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should reside within themes only, you will find that elements must be styled in all core base themes, this means at least Bootstrapbase and base.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should be located within either &#039;&#039;&#039;theme/themename/style/elements/elementname.css&#039;&#039;&#039; or &#039;&#039;&#039;theme/themename/less/elements/elementname.css&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The actual CSS file should be named according to the element. As elements can be namespaced we need to ensure that that is reflected in the name of the file.&lt;br /&gt;
For instance:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Element&lt;br /&gt;
! CSS location in base&lt;br /&gt;
! CSS location in bootstrapbase&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\button&lt;br /&gt;
| style/elements/core_output_button.css&lt;br /&gt;
| less/moodle/elements/core_output_button.css&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\navigation_bar&lt;br /&gt;
| style/elements/core_output_navigation_bar.css&lt;br /&gt;
| less/moodle/elements/core_output_navigation_bar.css&lt;br /&gt;
|-&lt;br /&gt;
| \mod_assign\output\user_submission&lt;br /&gt;
| style/elements/mod_assign_output_user_submission.css&lt;br /&gt;
| less/moodle/elements/mod_assign_output_user_submission.css&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These will still need to be included in the theme, by which ever means is relevant.&lt;br /&gt;
If you are using &#039;&#039;.css&#039;&#039; files like the base theme does then you will use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// In your themes config.php&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;elements/core_output_button&#039;,&lt;br /&gt;
    &#039;elements/core_output_navigation_bar&#039;,&lt;br /&gt;
    &#039;elements/mod_assign_output_user_submission&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using less as bootstrapbase does then you will use:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** In your primary less file **/&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_button&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_navigation_bar&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/mod_assign_output_user_submission&amp;quot;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General CSS===&lt;br /&gt;
&lt;br /&gt;
This is CSS for the theme that doesn&#039;t relate to a specific element. Hopefully as we convert more and more of Moodles interfaces to use elements we should see less general CSS.&lt;br /&gt;
&lt;br /&gt;
In any case nothing has changed in regards to the location of general CSS.&lt;br /&gt;
; CSS : If your theme is using standard CSS then it must be located within the &#039;&#039;style&#039;&#039; directory of your theme and should be in logically separated files.&lt;br /&gt;
; Less : If your theme is using less then it should be located in a &#039;&#039;less/moodle&#039;&#039; directory within your theme.&lt;br /&gt;
&lt;br /&gt;
We recommend that you separate styles into files based upon the Moodle component being styled. Again as all CSS files get combined into a single file on production sites it doesn&#039;t matter how many files you end up with.&lt;br /&gt;
&lt;br /&gt;
This would lead to files named like:&lt;br /&gt;
* style/core.css&lt;br /&gt;
* style/course.css&lt;br /&gt;
* style/mod_forum.css&lt;br /&gt;
&lt;br /&gt;
===Where to put CSS in plugins===&lt;br /&gt;
&lt;br /&gt;
It is possible in Moodle to add CSS stylesheets to all plugins (including core plugins).&amp;lt;br /&amp;gt;&lt;br /&gt;
Moodle always looks for a &#039;&#039;styles.css&#039;&#039; file within your plugins directory, and it also looks for a styles_themename.css where themename is the name of the currect theme being used.&lt;br /&gt;
&lt;br /&gt;
For instance the following could be added to the forum module:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;mod/forum/styles.css&#039;&#039;: Used all the time.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_base.css&#039;&#039; : Used when the user is using the base theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_bootstrapbase.css&#039;&#039; : Used when the user is using the bootstrapbase theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_clean.css&#039;&#039; : Used when the user is using the clean theme.&lt;br /&gt;
&lt;br /&gt;
===CSS in core plugins===&lt;br /&gt;
&lt;br /&gt;
For core plugins only styles.css is permitted and it should only ever contain styles essential to the presentation of the plugin.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present styles essential for the display of the plugin are allowed here, however when the plugin interfaces have been converted to use elements this file should be nearly empty and contain only the following:&lt;br /&gt;
* Images, icons and text used for visual presentation such as icons to notify state (expanded/collapsed, warnings...)&lt;br /&gt;
* Accessiblity orientated styles required to make the interface accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Under no circumstances should it contain any visual stylings such as border, rounded corners, and background colours not associated with state.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==HTML==&lt;br /&gt;
&lt;br /&gt;
The following sections detail rules in place for writing HTML.&lt;br /&gt;
&lt;br /&gt;
Before we start a couple of general recommendations:&lt;br /&gt;
&lt;br /&gt;
; Use hyphens rather than underscores when concatenating strings in attributes : for example &#039;&#039;.course-new-activity-chooser&#039;&#039; instead of &#039;&#039;.course_new_activity_chooser&#039;&#039;. By all doing this we will have a more consistent appearance and as We use underscores as part of frankenstyle which is prominent in CSS helps us to reduce the chance of naming conflicts.&lt;br /&gt;
; Think semantics - but don&#039;t get caught up in it : Semantic CSS is beautiful CSS lending itself ultimately to the redesign that is going to happen. But enforcing a semantic design can be an arduous journey. Instead we encourage semantic CSS but are happy to see non-semantic CSS when it is for the greater good.&lt;br /&gt;
&lt;br /&gt;
===Using the ID attribute===&lt;br /&gt;
&lt;br /&gt;
The situation of having a single JavaScript driven element was considered but even then it is better to style only classes and other attributes as we can&#039;t be sure what the future holds.&lt;br /&gt;
&lt;br /&gt;
There are three rules you should follow when creating an ID:&lt;br /&gt;
&lt;br /&gt;
# They should only be given to elements and HTML nodes that need to be interacted with by JavaScript.&lt;br /&gt;
# It should always start with &#039;&#039;&#039;m-&#039;&#039;&#039; &#039;&#039;(see note below)&#039;&#039;&lt;br /&gt;
# The actual ID should be descriptive of the node and contents as a whole unit. It must fully and concisely describe its purpose.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that in an ideal world ID&#039;s should not be used for styling.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Good&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-course-new-activity-chooser&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bad&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
It doesn&#039;t have the m- prefix&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This may appear OK at first but when you think about it selecting an activity within Moodle&lt;br /&gt;
is something that is done in multiple places and the this widget may not be applicable to&lt;br /&gt;
every place, as there may be other activity selector JS one day introduced having a&lt;br /&gt;
more complete ID is important&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-activity-selector&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The requirement to use m- prefix is entirely new, this has been created as this instantly reduces the chances of conflicting with present and future frontend frameworks that may be adopted by core or third party themes. Aiding our goal of being frontend framework agnostic.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will also help reduce the chance of conflicts in any third party code that may be used either by us in core, or by outside developers in their own code.&lt;br /&gt;
Moodle ID&#039;s will also be much more easily recognisable which we expect will be a benefit as JavaScript use in Moodle continues to increase.&lt;br /&gt;
&lt;br /&gt;
===Naming CSS classes===&lt;br /&gt;
&lt;br /&gt;
This is where a bit of organisation goes a long way and we want to be reasonably thorough in a consistent naming scheme and implementation.&lt;br /&gt;
&lt;br /&gt;
The very first thing to mention is that all classes in Moodle must now be prefixed by *m-*.&lt;br /&gt;
This instantly identifes a class as belonging to Moodle, it aids us in avoiding conflicts with any non-Moodle css that may be loaded, and it is part of our framework agnostic plan.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
All CSS classes must start with *m-*&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several prefix that are used within Moodle output now that should not be used as prefixs for classes unless they are serving the desired purpose.&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes are:&lt;br /&gt;
&lt;br /&gt;
; m-element : Prefix used on element classes, where m-element preceeds the name of the element, e.g. m-element-button, m-element-search&lt;br /&gt;
; m-state : Prefix used for CSS classes representing the state of an item, e.g. m-state-disabled, m-state-active, m-state-expanded.&lt;br /&gt;
; m-grid : Prefix used for creating HTML grids.&lt;br /&gt;
&lt;br /&gt;
====Elements====&lt;br /&gt;
&lt;br /&gt;
Semantic design where it gives the best result, smart design where there is a better solution.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re not already familiar with the idea of semantic CSS then Chris Coylers artical [http://css-tricks.com/semantic-class-names/ What makes for a semantic class name] is a great starting point.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve not commit to adopting any one strict approach for writing CSS. We have adopted atomic design for our HTML elements, a design style which fits nicely with the likes of OOCSS, however be very clear that we are not adopting the OOCSS approach in its entirety. The high level abstraction of the visual aspects of elements into highly reusable agnostic classes does not always lend itself well to the Moodle world in which the we wish to be frontend framework agnostic and support largescale completely customisable themes.&amp;lt;br /&amp;gt;&lt;br /&gt;
The highly reusable classes that appeal to one designer, or to one frontend framework may not apply to another.&amp;lt;br /&amp;gt;&lt;br /&gt;
This decision is also impacted by our current default theme bootstrapbase that does not use well abstracted OOCSS in its design.&lt;br /&gt;
&lt;br /&gt;
Atomic design is going to see us end up with many parent child relationships in our HTML that we must carry through to our CSS. Through atomic design we start with smalled atoms and molecules that get built into larger organisms and placed within layouts.&lt;br /&gt;
&lt;br /&gt;
Every element should have a single class that identifies it as element X.&lt;br /&gt;
&lt;br /&gt;
For instance the button atom will have the class *m-element-button*&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button class=&amp;quot;m-element-button&amp;quot;&amp;gt;I am a button&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is simply the prefix &amp;quot;m-element&amp;quot; plus the element name.&lt;br /&gt;
&lt;br /&gt;
The purpose of this class is to allow the element to be styled with ease. The class name should be applied to the root node for the element, it should never be applied any lower.&lt;br /&gt;
&lt;br /&gt;
By having one class for the element, and always and only applied to the root node it makes it very easy in HTML to see where one element belongs to another.&lt;br /&gt;
&lt;br /&gt;
The following is an example of the search molecule, which in turn contains two button atoms.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to partially adopt BEM as a CSS standard when writing CSS for elements.&lt;br /&gt;
BEM isn&#039;t a new CSS standard, but its not widely known either. Its existence fills a gap in how to style elements consistently. Through two basic notation techniques you can easily notate the purpose of structures that belong to an element and notate the intent of an element that is desired if the element has multiple versions.&lt;br /&gt;
&lt;br /&gt;
; Notating purpose : Here we use a suffix *__purpose*, the key being the two underscores.&lt;br /&gt;
; Notating intent : Here we use a suffix *--intent*, the key being the two hyphens.&lt;br /&gt;
&lt;br /&gt;
You&#039;ll notice in the example above that there is no way to style the continue button differently from the cancel button without relying on its name, something we certainly don&#039;t want to do.&lt;br /&gt;
The solution is to wrap each button in a div and give each div a class.&lt;br /&gt;
The BEM standard comes into play here in naming the classes, the following shows how you would apply BEM to show the purpose of each button in a way that can be easily interpreted and styled in CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__cancel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__continue&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now each button is wrapped in a div with a class, *m-element-confirmation__cancel* and *m-element-confirmation__continue*.&lt;br /&gt;
This class can be read by the themer and because of the __ can be easily identified as both belonging to the m-element-confirmation and serving a specific purpose, continue or cancel.&lt;br /&gt;
&lt;br /&gt;
Now to explain the idea of intents.&lt;br /&gt;
An intent is when a single element takes on a different apprearance to convey a specific meaning. A little bit like a state, but with more meaning.&lt;br /&gt;
An easy example is notifications where you will no doubt be familiar with the idea of having a error notifications, warning notifications, success notification etc. Each of error, warning, and success is a intent.&lt;br /&gt;
&lt;br /&gt;
The following shows how this would work:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- A standard notification --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- A warning --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification m-element-notification--warning&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Grids====&lt;br /&gt;
&lt;br /&gt;
We need to adopt a single grid framework.&lt;br /&gt;
&lt;br /&gt;
Personally I don&#039;t think we should use pure bootstrap or pure YUI, instead we should choose one of these and build it use our class name structures.&lt;br /&gt;
&lt;br /&gt;
All grid classes should start with m-grid.&lt;br /&gt;
&lt;br /&gt;
==CSS==&lt;br /&gt;
&lt;br /&gt;
Before we begin lets lay down some ground level goals, things that will help us achieve clear and understandable CSS in the future.&lt;br /&gt;
* Formatting, ordering, alignment, and spacing are all important in having CSS that can be easily read by others.&lt;br /&gt;
* Don&#039;t optimise your CSS, be verbose and stick to the styles in this guide. We have tools that will handle optimisation for you.&lt;br /&gt;
* Never use *!important* in your CSS unless it is absolutely impossible to avoid doing so.&lt;br /&gt;
&lt;br /&gt;
===Terminology===&lt;br /&gt;
&lt;br /&gt;
Its important that when we are speaking about CSS we are speaking the same language.&lt;br /&gt;
Lets look at the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-page .m-selector-1,&lt;br /&gt;
.m-page .m-selector-2,&lt;br /&gt;
.m-page .m-selector-3 {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
    color: #000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-1 {&lt;br /&gt;
    margin: 1em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Ruleset : Each of the two rules is a single *ruleset*.&lt;br /&gt;
; Rule: _.m-page .m-selector-1_ is a rule.&lt;br /&gt;
; Selector : _.m-selector-1_ is a *selector*, it is a single part of a rule.&lt;br /&gt;
; Declaration : _background-color: #FFF_ is a declaration.&lt;br /&gt;
;&lt;br /&gt;
&lt;br /&gt;
===Essential formatting===&lt;br /&gt;
&lt;br /&gt;
The following are the guies for writing CSS.&lt;br /&gt;
&lt;br /&gt;
* Always use spaces - never use tabs. All editors can be configured to do it.&lt;br /&gt;
* Indent by 4 spaces - never more, never less.&lt;br /&gt;
* A single empty line between rulesets to maintain consistent spacing of rules.&lt;br /&gt;
* One rule per line.&lt;br /&gt;
* A single space between each selector in a rule.&lt;br /&gt;
* No space between a rule and the comma in a ruleset.&lt;br /&gt;
* A single space between a selector and the opening brace of a ruleset.&lt;br /&gt;
* One level of indentation before each declaration.&lt;br /&gt;
* A single space the colon in a declaration.&lt;br /&gt;
* A single space after each item in a declaration containing multiple items.&lt;br /&gt;
&lt;br /&gt;
The following shows how the above rules apply:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-selector-1,&lt;br /&gt;
.m-selector-2 .m-selector-3 {&lt;br /&gt;
    background: #ffa800 url(&amp;quot;background.png&amp;quot;) no-repeat right top;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    display: inline-block;&lt;br /&gt;
    font-family: arial, sans-serif;&lt;br /&gt;
    margin: 5px 10px;&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-4 {&lt;br /&gt;
    border-radius: 3px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General rules===&lt;br /&gt;
&lt;br /&gt;
Declaration ordering is the very first thing to discuss. There is no strict rule on how to order your declarations, however there is a recommendation.&lt;br /&gt;
We recommend that you order declarations within a ruleset alphabetically.&lt;br /&gt;
If we all start doing this then when you read CSS written by someone else you will soon learn to very quickly find your way around the declarations within a rule.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Recommended **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    color: #000;&lt;br /&gt;
    display: block;&lt;br /&gt;
    margin: 5px;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do not use a measurement unit when writing a 0 value.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use lowercase and shorthand values for colours.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #ffffff;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: white;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always quote variable values.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector[attr=&amp;quot;variable&amp;quot;] {&lt;br /&gt;
    background-image: url(&amp;quot;image.png&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector[attr=variable] {&lt;br /&gt;
    background-image: url(image.png);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Commenting===&lt;br /&gt;
&lt;br /&gt;
Always comment your CSS and Less.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Styles for the button atom.&lt;br /&gt;
 */&lt;br /&gt;
.m-element-button {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rules and exceptions for less===&lt;br /&gt;
&lt;br /&gt;
Need to write some guff on Less.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45897</id>
		<title>User:Sam Hemelryk/CSS style guidelines</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45897"/>
		<updated>2014-07-22T05:25:04Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45830&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
==HTML and CSS style guide==&lt;br /&gt;
&lt;br /&gt;
This is a guide to writing CSS within Moodle.&lt;br /&gt;
&lt;br /&gt;
==Why have a strict guide==&lt;br /&gt;
&lt;br /&gt;
At the time of writing this CSS within Moodle (2.7) themes is in a poor state and has been for a long time. Without previously having a guide we were finding that:&lt;br /&gt;
&lt;br /&gt;
* As there was no formal guide to creating id&#039;s or classes, each developer does there own thing.&lt;br /&gt;
* As there was no formal guide on how to write CSS there were numerous techniques used when writing CSS and no consistency.&lt;br /&gt;
* Majority of pages create uniuqe output and require unique CSS, there is very little re-use of design.&lt;br /&gt;
&lt;br /&gt;
While those points may not sound bad to you consider that in following stats from Moodle 2.7 themes:&lt;br /&gt;
&lt;br /&gt;
* Base theme contains 3802 rulesets with a total of 5800 styles.&lt;br /&gt;
* Bootstrapbase theme contains 5170 rulesets with a total of 9362 styles.&lt;br /&gt;
* Clean theme contains 5172 rulesets with a total of 9366 styles.&lt;br /&gt;
* More theme contains 5177 rulesets with a total of 9063 styles.&lt;br /&gt;
&lt;br /&gt;
You get the picture, several thousand selectors containing nearly 10000 styles.&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.8 we commited to introducing a element library to aid the reuse of design and documenting all aspects of output including a guide on writing CSS for Moodle. This is that guide.&lt;br /&gt;
&lt;br /&gt;
==Our goals==&lt;br /&gt;
&lt;br /&gt;
Its very important to understand what we are trying to achieve with this style guide and output in general.&lt;br /&gt;
&lt;br /&gt;
; Frontend framework agnostic : We want theme designers to be able to apply present and future frontend frameworks to Moodle with minimal effort.&lt;br /&gt;
; Consistent interfaces : We want Moodle to have consistency throughout its interfaces, minimising the amount of frontend design and development that is required in coding and styling an interface.&lt;br /&gt;
; Cleanly formatted HTML and CSS : to minimise both development time and to make our renderers and CSS and more maintainable.&lt;br /&gt;
&lt;br /&gt;
We plan to faciliate these with the following:&lt;br /&gt;
; Elements : Highly re-usable objects to produce HTML, these will be used consistently and relied upon by developers creating interfaces. By having these elements we create a consistent look, interface creation will be much quicker and theme designers through the re-use of a limited number of elements.&lt;br /&gt;
; Element library : A tool to show samples of each element, this can be used to view and test designs. It aids the developer by showing them the elements they can select from when creating an interface, and it aids designers by giving them a test area that doesn&#039;t require them to dig through every page in Moodle.&lt;br /&gt;
; Documentation : We will now have proper documentation on all aspects of output. Including this CSS style guide, a renderer best practices guide, and a guide to creating elements.&lt;br /&gt;
&lt;br /&gt;
==Where to put CSS in Moodle core==&lt;br /&gt;
&lt;br /&gt;
CSS can reside in a number of locations depending upon what you are styling.&lt;br /&gt;
&lt;br /&gt;
Remember it doesn&#039;t matter how many CSS files we end up with, on a production site with Theme designer mode switched off (default) all CSS files will be combined and minimised into a single file that is served to the client.&lt;br /&gt;
Excepting the case of IE where we must split the CSS into several smaller files to work around browser limitations.&lt;br /&gt;
&lt;br /&gt;
===CSS for elements===&lt;br /&gt;
As we are moving to using elements you will find that CSS for elements is where most of the effort is going to go.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should reside within themes only, you will find that elements must be styled in all core base themes, this means at least Bootstrapbase and base.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should be located within either &#039;&#039;&#039;theme/themename/style/elements/elementname.css&#039;&#039;&#039; or &#039;&#039;&#039;theme/themename/less/elements/elementname.css&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The actual CSS file should be named according to the element. As elements can be namespaced we need to ensure that that is reflected in the name of the file.&lt;br /&gt;
For instance:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Element&lt;br /&gt;
! CSS location in base&lt;br /&gt;
! CSS location in bootstrapbase&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\button&lt;br /&gt;
| style/elements/core_output_button.css&lt;br /&gt;
| less/moodle/elements/core_output_button.css&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\navigation_bar&lt;br /&gt;
| style/elements/core_output_navigation_bar.css&lt;br /&gt;
| less/moodle/elements/core_output_navigation_bar.css&lt;br /&gt;
|-&lt;br /&gt;
| \mod_assign\output\user_submission&lt;br /&gt;
| style/elements/mod_assign_output_user_submission.css&lt;br /&gt;
| less/moodle/elements/mod_assign_output_user_submission.css&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These will still need to be included in the theme, by which ever means is relevant.&lt;br /&gt;
If you are using &#039;&#039;.css&#039;&#039; files like the base theme does then you will use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// In your themes config.php&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;elements/core_output_button&#039;,&lt;br /&gt;
    &#039;elements/core_output_navigation_bar&#039;,&lt;br /&gt;
    &#039;elements/mod_assign_output_user_submission&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using less as bootstrapbase does then you will use:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** In your primary less file **/&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_button&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_navigation_bar&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/mod_assign_output_user_submission&amp;quot;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General CSS===&lt;br /&gt;
&lt;br /&gt;
This is CSS for the theme that doesn&#039;t relate to a specific element. Hopefully as we convert more and more of Moodles interfaces to use elements we should see less general CSS.&lt;br /&gt;
&lt;br /&gt;
In any case nothing has changed in regards to the location of general CSS.&lt;br /&gt;
; CSS : If your theme is using standard CSS then it must be located within the &#039;&#039;style&#039;&#039; directory of your theme and should be in logically separated files.&lt;br /&gt;
; Less : If your theme is using less then it should be located in a &#039;&#039;less/moodle&#039;&#039; directory within your theme.&lt;br /&gt;
&lt;br /&gt;
We recommend that you separate styles into files based upon the Moodle component being styled. Again as all CSS files get combined into a single file on production sites it doesn&#039;t matter how many files you end up with.&lt;br /&gt;
&lt;br /&gt;
This would lead to files named like:&lt;br /&gt;
* style/core.css&lt;br /&gt;
* style/course.css&lt;br /&gt;
* style/mod_forum.css&lt;br /&gt;
&lt;br /&gt;
===Where to put CSS in plugins===&lt;br /&gt;
&lt;br /&gt;
It is possible in Moodle to add CSS stylesheets to all plugins (including core plugins).&amp;lt;br /&amp;gt;&lt;br /&gt;
Moodle always looks for a &#039;&#039;styles.css&#039;&#039; file within your plugins directory, and it also looks for a styles_themename.css where themename is the name of the currect theme being used.&lt;br /&gt;
&lt;br /&gt;
For instance the following could be added to the forum module:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;mod/forum/styles.css&#039;&#039;: Used all the time.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_base.css&#039;&#039; : Used when the user is using the base theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_bootstrapbase.css&#039;&#039; : Used when the user is using the bootstrapbase theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_clean.css&#039;&#039; : Used when the user is using the clean theme.&lt;br /&gt;
&lt;br /&gt;
===CSS in core plugins===&lt;br /&gt;
&lt;br /&gt;
For core plugins only styles.css is permitted and it should only ever contain styles essential to the presentation of the plugin.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present styles essential for the display of the plugin are allowed here, however when the plugin interfaces have been converted to use elements this file should be nearly empty and contain only the following:&lt;br /&gt;
* Images, icons and text used for visual presentation such as icons to notify state (expanded/collapsed, warnings...)&lt;br /&gt;
* Accessiblity orientated styles required to make the interface accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Under no circumstances should it contain any visual stylings such as border, rounded corners, and background colours not associated with state.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==HTML==&lt;br /&gt;
&lt;br /&gt;
The following sections detail rules in place for writing HTML.&lt;br /&gt;
&lt;br /&gt;
Before we start a couple of general recommendations:&lt;br /&gt;
&lt;br /&gt;
; Use hyphens rather than underscores when concatenating strings in attributes : for example &#039;&#039;.course-new-activity-chooser&#039;&#039; instead of &#039;&#039;.course_new_activity_chooser&#039;&#039;. By all doing this we will have a more consistent appearance and as We use underscores as part of frankenstyle which is prominent in CSS helps us to reduce the chance of naming conflicts.&lt;br /&gt;
; Think semantics - but don&#039;t get caught up in it : Semantic CSS is beautiful CSS lending itself ultimately to the redesign that is going to happen. But enforcing a semantic design can be an arduous journey. Instead we encourage semantic CSS but are happy to see non-semantic CSS when it is for the greater good.&lt;br /&gt;
&lt;br /&gt;
===Using the ID attribute===&lt;br /&gt;
&lt;br /&gt;
The situation of having a single JavaScript driven element was considered but even then it is better to style only classes and other attributes as we can&#039;t be sure what the future holds.&lt;br /&gt;
&lt;br /&gt;
There are three rules you should follow when creating an ID:&lt;br /&gt;
&lt;br /&gt;
# They should only be given to elements and HTML nodes that need to be interacted with by JavaScript.&lt;br /&gt;
# It should always start with &#039;&#039;&#039;m-&#039;&#039;&#039; &#039;&#039;(see note below)&#039;&#039;&lt;br /&gt;
# The actual ID should be descriptive of the node and contents as a whole unit. It must fully and concisely describe its purpose.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that in an ideal world ID&#039;s should not be used for styling.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Good&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-course-new-activity-chooser&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bad&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
It doesn&#039;t have the m- prefix&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This may appear OK at first but when you think about it selecting an activity within Moodle&lt;br /&gt;
is something that is done in multiple places and the this widget may not be applicable to&lt;br /&gt;
every place, as there may be other activity selector JS one day introduced having a&lt;br /&gt;
more complete ID is important&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-activity-selector&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The requirement to use m- prefix is entirely new, this has been created as this instantly reduces the chances of conflicting with present and future frontend frameworks that may be adopted by core or third party themes. Aiding our goal of being frontend framework agnostic.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will also help reduce the chance of conflicts in any third party code that may be used either by us in core, or by outside developers in their own code.&lt;br /&gt;
Moodle ID&#039;s will also be much more easily recognisable which we expect will be a benefit as JavaScript use in Moodle continues to increase.&lt;br /&gt;
&lt;br /&gt;
===Naming CSS classes===&lt;br /&gt;
&lt;br /&gt;
This is where a bit of organisation goes a long way and we want to be reasonably thorough in a consistent naming scheme and implementation.&lt;br /&gt;
&lt;br /&gt;
The very first thing to mention is that all classes in Moodle must now be prefixed by *m-*.&lt;br /&gt;
This instantly identifes a class as belonging to Moodle, it aids us in avoiding conflicts with any non-Moodle css that may be loaded, and it is part of our framework agnostic plan.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
All CSS classes must start with *m-*&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several prefix that are used within Moodle output now that should not be used as prefixs for classes unless they are serving the desired purpose.&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes are:&lt;br /&gt;
&lt;br /&gt;
; m-element : Prefix used on element classes, where m-element preceeds the name of the element, e.g. m-element-button, m-element-search&lt;br /&gt;
; m-state : Prefix used for CSS classes representing the state of an item, e.g. m-state-disabled, m-state-active, m-state-expanded.&lt;br /&gt;
; m-grid : Prefix used for creating HTML grids.&lt;br /&gt;
&lt;br /&gt;
====Elements====&lt;br /&gt;
&lt;br /&gt;
Semantic design where it gives the best result, smart design where there is a better solution.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re not already familiar with the idea of semantic CSS then Chris Coylers artical [http://css-tricks.com/semantic-class-names/ What makes for a semantic class name] is a great starting point.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve not commit to adopting any one strict approach for writing CSS. We have adopted atomic design for our HTML elements, a design style which fits nicely with the likes of OOCSS, however be very clear that we are not adopting the OOCSS approach in its entirety. The high level abstraction of the visual aspects of elements into highly reusable agnostic classes does not always lend itself well to the Moodle world in which the we wish to be frontend framework agnostic and support largescale completely customisable themes.&amp;lt;br /&amp;gt;&lt;br /&gt;
The highly reusable classes that appeal to one designer, or to one frontend framework may not apply to another.&amp;lt;br /&amp;gt;&lt;br /&gt;
This decision is also impacted by our current default theme bootstrapbase that does not use well abstracted OOCSS in its design.&lt;br /&gt;
&lt;br /&gt;
Atomic design is going to see us end up with many parent child relationships in our HTML that we must carry through to our CSS. Through atomic design we start with smalled atoms and molecules that get built into larger organisms and placed within layouts.&lt;br /&gt;
&lt;br /&gt;
Every element should have a single class that identifies it as element X.&lt;br /&gt;
&lt;br /&gt;
For instance the button atom will have the class *m-element-button*&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button class=&amp;quot;m-element-button&amp;quot;&amp;gt;I am a button&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is simply the prefix &amp;quot;m-element&amp;quot; plus the element name.&lt;br /&gt;
&lt;br /&gt;
The purpose of this class is to allow the element to be styled with ease. The class name should be applied to the root node for the element, it should never be applied any lower.&lt;br /&gt;
&lt;br /&gt;
By having one class for the element, and always and only applied to the root node it makes it very easy in HTML to see where one element belongs to another.&lt;br /&gt;
&lt;br /&gt;
The following is an example of the search molecule, which in turn contains two button atoms.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to partially adopt BEM as a CSS standard when writing CSS for elements.&lt;br /&gt;
BEM isn&#039;t a new CSS standard, but its not widely known either. Its existence fills a gap in how to style elements consistently. Through two basic notation techniques you can easily notate the purpose of structures that belong to an element and notate the intent of an element that is desired if the element has multiple versions.&lt;br /&gt;
&lt;br /&gt;
; Notating purpose : Here we use a suffix *__purpose*, the key being the two underscores.&lt;br /&gt;
; Notating intent : Here we use a suffix *--intent*, the key being the two hyphens.&lt;br /&gt;
&lt;br /&gt;
You&#039;ll notice in the example above that there is no way to style the continue button differently from the cancel button without relying on its name, something we certainly don&#039;t want to do.&lt;br /&gt;
The solution is to wrap each button in a div and give each div a class.&lt;br /&gt;
The BEM standard comes into play here in naming the classes, the following shows how you would apply BEM to show the purpose of each button in a way that can be easily interpreted and styled in CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__cancel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__continue&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now each button is wrapped in a div with a class, *m-element-confirmation__cancel* and *m-element-confirmation__continue*.&lt;br /&gt;
This class can be read by the themer and because of the __ can be easily identified as both belonging to the m-element-confirmation and serving a specific purpose, continue or cancel.&lt;br /&gt;
&lt;br /&gt;
Now to explain the idea of intents.&lt;br /&gt;
An intent is when a single element takes on a different apprearance to convey a specific meaning. A little bit like a state, but with more meaning.&lt;br /&gt;
An easy example is notifications where you will no doubt be familiar with the idea of having a error notifications, warning notifications, success notification etc. Each of error, warning, and success is a intent.&lt;br /&gt;
&lt;br /&gt;
The following shows how this would work:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- A standard notification --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- A warning --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification m-element-notification--warning&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Grids====&lt;br /&gt;
&lt;br /&gt;
We need to adopt a single grid framework.&lt;br /&gt;
&lt;br /&gt;
Personally I don&#039;t think we should use pure bootstrap or pure YUI, instead we should choose one of these and build it use our class name structures.&lt;br /&gt;
&lt;br /&gt;
All grid classes should start with m-grid.&lt;br /&gt;
&lt;br /&gt;
==CSS==&lt;br /&gt;
&lt;br /&gt;
Before we begin lets lay down some ground level goals, things that will help us achieve clear and understandable CSS in the future.&lt;br /&gt;
* Formatting, ordering, alignment, and spacing are all important in having CSS that can be easily read by others.&lt;br /&gt;
* Don&#039;t optimise your CSS, be verbose and stick to the styles in this guide. We have tools that will handle optimisation for you.&lt;br /&gt;
* Never use *!important* in your CSS unless it is absolutely impossible to avoid doing so.&lt;br /&gt;
&lt;br /&gt;
===Terminology===&lt;br /&gt;
&lt;br /&gt;
Its important that when we are speaking about CSS we are speaking the same language.&lt;br /&gt;
Lets look at the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-page .m-selector-1,&lt;br /&gt;
.m-page .m-selector-2,&lt;br /&gt;
.m-page .m-selector-3 {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
    color: #000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-1 {&lt;br /&gt;
    margin: 1em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Ruleset : Each of the two rules is a single *ruleset*.&lt;br /&gt;
; Rule: _.m-page .m-selector-1_ is a rule.&lt;br /&gt;
; Selector : _.m-selector-1_ is a *selector*, it is a single part of a rule.&lt;br /&gt;
; Declaration : _background-color: #FFF_ is a declaration.&lt;br /&gt;
; &lt;br /&gt;
&lt;br /&gt;
===Essential formatting===&lt;br /&gt;
&lt;br /&gt;
The following are the guies for writing CSS.&lt;br /&gt;
&lt;br /&gt;
* Always use spaces - never use tabs. All editors can be configured to do it.&lt;br /&gt;
* Indent by 4 spaces - never more, never less.&lt;br /&gt;
* A single empty line between rulesets to maintain consistent spacing of rules.&lt;br /&gt;
* One rule per line.&lt;br /&gt;
* A single space between each selector in a rule.&lt;br /&gt;
* No space between a rule and the comma in a ruleset.&lt;br /&gt;
* A single space between a selector and the opening brace of a ruleset.&lt;br /&gt;
* One level of indentation before each declaration.&lt;br /&gt;
* A single space the colon in a declaration.&lt;br /&gt;
* A single space after each item in a declaration containing multiple items.&lt;br /&gt;
&lt;br /&gt;
The following shows how the above rules apply:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-selector-1,&lt;br /&gt;
.m-selector-2 .m-selector-3 {&lt;br /&gt;
    background: #ffa800 url(&amp;quot;background.png&amp;quot;) no-repeat right top;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    display: inline-block;&lt;br /&gt;
    font-family: arial, sans-serif;&lt;br /&gt;
    margin: 5px 10px;&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-4 {&lt;br /&gt;
    border-radius: 3px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General rules===&lt;br /&gt;
&lt;br /&gt;
Declaration ordering is the very first thing to discuss. There is no strict rule on how to order your declarations, however there is a recommendation.&lt;br /&gt;
We recommend that you order declarations within a ruleset alphabetically.&lt;br /&gt;
If we all start doing this then when you read CSS written by someone else you will soon learn to very quickly find your way around the declarations within a rule.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Recommended **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    color: #000;&lt;br /&gt;
    display: block;&lt;br /&gt;
    margin: 5px;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do not use a measurement unit when writing a 0 value.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use lowercase and shorthand values for colours.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #ffffff;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: white;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always quote variable values.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector[attr=&amp;quot;variable&amp;quot;] {&lt;br /&gt;
    background-image: url(&amp;quot;image.png&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector[attr=variable] {&lt;br /&gt;
    background-image: url(image.png);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Commenting===&lt;br /&gt;
&lt;br /&gt;
Always comment your CSS and Less.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Styles for the button atom.&lt;br /&gt;
 */&lt;br /&gt;
.m-element-button {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rules and exceptions for less===&lt;br /&gt;
&lt;br /&gt;
Need to write some guff on Less.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45896</id>
		<title>User:Sam Hemelryk/CSS style guidelines</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45896"/>
		<updated>2014-07-22T05:07:44Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* CSS for elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45830&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
==HTML and CSS style guide==&lt;br /&gt;
&lt;br /&gt;
This is a guide to writing CSS within Moodle.&lt;br /&gt;
&lt;br /&gt;
==Why have a strict guide==&lt;br /&gt;
&lt;br /&gt;
At the time of writing this CSS within Moodle (2.7) themes is in a poor state and has been for a long time. Without previously having a guide we were finding that:&lt;br /&gt;
&lt;br /&gt;
* As there was no formal guide to creating id&#039;s or classes, each developer does there own thing.&lt;br /&gt;
* As there was no formal guide on how to write CSS there were numerous techniques used when writing CSS and no consistency.&lt;br /&gt;
* Majority of pages create uniuqe output and require unique CSS, there is very little re-use of design.&lt;br /&gt;
&lt;br /&gt;
While those points may not sound bad to you consider that in following stats from Moodle 2.7 themes:&lt;br /&gt;
&lt;br /&gt;
* Base theme contains 3802 rulesets with a total of 5800 styles.&lt;br /&gt;
* Bootstrapbase theme contains 5170 rulesets with a total of 9362 styles.&lt;br /&gt;
* Clean theme contains 5172 rulesets with a total of 9366 styles.&lt;br /&gt;
* More theme contains 5177 rulesets with a total of 9063 styles.&lt;br /&gt;
&lt;br /&gt;
You get the picture, several thousand selectors containing nearly 10000 styles.&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.8 we commited to introducing a element library to aid the reuse of design and documenting all aspects of output including a guide on writing CSS for Moodle. This is that guide.&lt;br /&gt;
&lt;br /&gt;
==Our goals==&lt;br /&gt;
&lt;br /&gt;
Its very important to understand what we are trying to achieve with this style guide and output in general.&lt;br /&gt;
&lt;br /&gt;
; Frontend framework agnostic : We want theme designers to be able to apply present and future frontend frameworks to Moodle with minimal effort.&lt;br /&gt;
; Consistent interfaces : We want Moodle to have consistency throughout its interfaces, minimising the amount of frontend design and development that is required in coding and styling an interface.&lt;br /&gt;
; Cleanly formatted HTML and CSS : to minimise both development time and to make our renderers and CSS and more maintainable.&lt;br /&gt;
&lt;br /&gt;
We plan to faciliate these with the following:&lt;br /&gt;
; Elements : Highly re-usable objects to produce HTML, these will be used consistently and relied upon by developers creating interfaces. By having these elements we create a consistent look, interface creation will be much quicker and theme designers through the re-use of a limited number of elements.&lt;br /&gt;
; Element library : A tool to show samples of each element, this can be used to view and test designs. It aids the developer by showing them the elements they can select from when creating an interface, and it aids designers by giving them a test area that doesn&#039;t require them to dig through every page in Moodle.&lt;br /&gt;
; Documentation : We will now have proper documentation on all aspects of output. Including this CSS style guide, a renderer best practices guide, and a guide to creating elements.&lt;br /&gt;
&lt;br /&gt;
==Where to put CSS in Moodle core==&lt;br /&gt;
&lt;br /&gt;
CSS can reside in a number of locations depending upon what you are styling.&lt;br /&gt;
&lt;br /&gt;
Remember it doesn&#039;t matter how many CSS files we end up with, on a production site with Theme designer mode switched off (default) all CSS files will be combined and minimised into a single file that is served to the client.&lt;br /&gt;
Excepting the case of IE where we must split the CSS into several smaller files to work around browser limitations.&lt;br /&gt;
&lt;br /&gt;
===CSS for elements===&lt;br /&gt;
As we are moving to using elements you will find that CSS for elements is where most of the effort is going to go.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should reside within themes only, you will find that elements must be styled in all core base themes, this means at least Bootstrapbase and base.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should be located within either &#039;&#039;&#039;theme/themename/style/elements/elementname.css&#039;&#039;&#039; or &#039;&#039;&#039;theme/themename/less/elements/elementname.css&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The actual CSS file should be named according to the element. As elements can be namespaced we need to ensure that that is reflected in the name of the file.&lt;br /&gt;
For instance:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Element&lt;br /&gt;
! CSS location in base&lt;br /&gt;
! CSS location in bootstrapbase&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\button&lt;br /&gt;
| style/elements/core_output_button.css&lt;br /&gt;
| less/moodle/elements/core_output_button.css&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\navigation_bar&lt;br /&gt;
| style/elements/core_output_navigation_bar.css&lt;br /&gt;
| less/moodle/elements/core_output_navigation_bar.css&lt;br /&gt;
|-&lt;br /&gt;
| \mod_assign\output\user_submission&lt;br /&gt;
| style/elements/mod_assign_output_user_submission.css&lt;br /&gt;
| less/moodle/elements/mod_assign_output_user_submission.css&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These will still need to be included in the theme, by which ever means is relevant.&lt;br /&gt;
If you are using &#039;&#039;.css&#039;&#039; files like the base theme does then you will use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// In your themes config.php&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;elements/core_output_button&#039;,&lt;br /&gt;
    &#039;elements/core_output_navigation_bar&#039;,&lt;br /&gt;
    &#039;elements/mod_assign_output_user_submission&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using less as bootstrapbase does then you will use:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** In your primary less file **/&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_button&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_navigation_bar&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/mod_assign_output_user_submission&amp;quot;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General CSS===&lt;br /&gt;
&lt;br /&gt;
This is CSS for the theme that doesn&#039;t relate to a specific element. Hopefully as we convert more and more of Moodles interfaces to use elements we should see less general CSS.&lt;br /&gt;
&lt;br /&gt;
In any case nothing has changed in regards to the location of general CSS.&lt;br /&gt;
; CSS : If your theme is using standard CSS then it must be located within the &#039;&#039;style&#039;&#039; directory of your theme and should be in logically separated files.&lt;br /&gt;
; Less : If your theme is using less then it should be located in a &#039;&#039;less/moodle&#039;&#039; directory within your theme.&lt;br /&gt;
&lt;br /&gt;
We recommend that you separate styles into files based upon the Moodle component being styled. Again as all CSS files get combined into a single file on production sites it doesn&#039;t matter how many files you end up with.&lt;br /&gt;
&lt;br /&gt;
This would lead to files named like:&lt;br /&gt;
* style/core.css&lt;br /&gt;
* style/course.css&lt;br /&gt;
* style/mod_forum.css&lt;br /&gt;
&lt;br /&gt;
===Where to put CSS in plugins===&lt;br /&gt;
&lt;br /&gt;
It is possible in Moodle to add CSS stylesheets to all plugins (including core plugins).&amp;lt;br /&amp;gt;&lt;br /&gt;
Moodle always looks for a &#039;&#039;styles.css&#039;&#039; file within your plugins directory, and it also looks for a styles_themename.css where themename is the name of the currect theme being used.&lt;br /&gt;
&lt;br /&gt;
For instance the following could be added to the forum module:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;mod/forum/styles.css&#039;&#039;: Used all the time.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_base.css&#039;&#039; : Used when the user is using the base theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_bootstrapbase.css&#039;&#039; : Used when the user is using the bootstrapbase theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_clean.css&#039;&#039; : Used when the user is using the clean theme.&lt;br /&gt;
&lt;br /&gt;
===CSS in core plugins===&lt;br /&gt;
&lt;br /&gt;
For core plugins only styles.css is permitted and it should only ever contain styles essential to the presentation of the plugin.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present styles essential for the display of the plugin are allowed here, however when the plugin interfaces have been converted to use elements this file should be nearly empty and contain only the following:&lt;br /&gt;
* Images, icons and text used for visual presentation such as icons to notify state (expanded/collapsed, warnings...)&lt;br /&gt;
* Accessiblity orientated styles required to make the interface accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Under no circumstances should it contain any visual stylings such as border, rounded corners, and background colours not associated with state.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==HTML==&lt;br /&gt;
&lt;br /&gt;
The following sections detail rules in place for writing HTML.&lt;br /&gt;
&lt;br /&gt;
Before we start a couple of general recommendations:&lt;br /&gt;
&lt;br /&gt;
; Use hyphens rather than underscores when concatenating strings in attributes : for example &#039;&#039;.course-new-activity-chooser&#039;&#039; instead of &#039;&#039;.course_new_activity_chooser&#039;&#039;. By all doing this we will have a more consistent appearance and as We use underscores as part of frankenstyle which is prominent in CSS helps us to reduce the chance of naming conflicts.&lt;br /&gt;
; Think semantics - but don&#039;t get caught up in it : Semantic CSS is beautiful CSS lending itself ultimately to the redesign that is going to happen. But enforcing a semantic design can be an arduous journey. Instead we encourage semantic CSS but are happy to see non-semantic CSS when it is for the greater good.&lt;br /&gt;
&lt;br /&gt;
===Using the ID attribute===&lt;br /&gt;
&lt;br /&gt;
The situation of having a single JavaScript driven element was considered but even then it is better to style only classes and other attributes as we can&#039;t be sure what the future holds.&lt;br /&gt;
&lt;br /&gt;
There are three rules you should follow when creating an ID:&lt;br /&gt;
&lt;br /&gt;
# They should only be given to elements and HTML nodes that need to be interacted with by JavaScript.&lt;br /&gt;
# It should always start with &#039;&#039;&#039;m-&#039;&#039;&#039; &#039;&#039;(see note below)&#039;&#039;&lt;br /&gt;
# The actual ID should be descriptive of the node and contents as a whole unit. It must fully and concisely describe its purpose.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that in an ideal world ID&#039;s should not be used for styling.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Good&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-course-new-activity-chooser&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bad&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
It doesn&#039;t have the m- prefix&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This may appear OK at first but when you think about it selecting an activity within Moodle&lt;br /&gt;
is something that is done in multiple places and the this widget may not be applicable to&lt;br /&gt;
every place, as there may be other activity selector JS one day introduced having a&lt;br /&gt;
more complete ID is important&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-activity-selector&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The requirement to use m- prefix is entirely new, this has been created as this instantly reduces the chances of conflicting with present and future frontend frameworks that may be adopted by core or third party themes. Aiding our goal of being frontend framework agnostic.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will also help reduce the chance of conflicts in any third party code that may be used either by us in core, or by outside developers in their own code.&lt;br /&gt;
Moodle ID&#039;s will also be much more easily recognisable which we expect will be a benefit as JavaScript use in Moodle continues to increase.&lt;br /&gt;
&lt;br /&gt;
===Naming CSS classes===&lt;br /&gt;
&lt;br /&gt;
This is where a bit of organisation goes a long way and we want to be reasonably thorough in a consistent naming scheme and implementation.&lt;br /&gt;
&lt;br /&gt;
The very first thing to mention is that all classes in Moodle must now be prefixed by *m-*.&lt;br /&gt;
This instantly identifes a class as belonging to Moodle, it aids us in avoiding conflicts with any non-Moodle css that may be loaded, and it is part of our framework agnostic plan.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
All CSS classes must start with *m-*&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several prefix that are used within Moodle output now that should not be used as prefixs for classes unless they are serving the desired purpose.&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes are:&lt;br /&gt;
&lt;br /&gt;
; m-element : Prefix used on element classes, where m-element preceeds the name of the element, e.g. m-element-button, m-element-search&lt;br /&gt;
; m-state : Prefix used for CSS classes representing the state of an item, e.g. m-state-disabled, m-state-active, m-state-expanded.&lt;br /&gt;
; m-grid : Prefix used for creating HTML grids.&lt;br /&gt;
&lt;br /&gt;
====Elements&lt;br /&gt;
&lt;br /&gt;
Semantic design where it gives the best result, smart design where there is a better solution.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re not already familiar with the idea of semantic CSS then Chris Coylers artical [http://css-tricks.com/semantic-class-names/ What makes for a semantic class name] is a great starting point.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve not commit to adopting any one strict approach for writing CSS. We have adopted atomic design for our HTML elements, a design style which fits nicely with the likes of OOCSS, however be very clear that we are not adopting the OOCSS approach in its entirety. The high level abstraction of the visual aspects of elements into highly reusable agnostic classes does not always lend itself well to the Moodle world in which the we wish to be frontend framework agnostic and support largescale completely customisable themes.&amp;lt;br /&amp;gt;&lt;br /&gt;
The highly reusable classes that appeal to one designer, or to one frontend framework may not apply to another.&amp;lt;br /&amp;gt;&lt;br /&gt;
This decision is also impacted by our current default theme bootstrapbase that does not use well abstracted OOCSS in its design.&lt;br /&gt;
&lt;br /&gt;
Atomic design is going to see us end up with many parent child relationships in our HTML that we must carry through to our CSS. Through atomic design we start with smalled atoms and molecules that get built into larger organisms and placed within layouts.&lt;br /&gt;
&lt;br /&gt;
Every element should have a single class that identifies it as element X.&lt;br /&gt;
&lt;br /&gt;
For instance the button atom will have the class *m-element-button*&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button class=&amp;quot;m-element-button&amp;quot;&amp;gt;I am a button&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is simply the prefix &amp;quot;m-element&amp;quot; plus the element name.&lt;br /&gt;
&lt;br /&gt;
The purpose of this class is to allow the element to be styled with ease. The class name should be applied to the root node for the element, it should never be applied any lower.&lt;br /&gt;
&lt;br /&gt;
By having one class for the element, and always and only applied to the root node it makes it very easy in HTML to see where one element belongs to another.&lt;br /&gt;
&lt;br /&gt;
The following is an example of the search molecule, which in turn contains two button atoms.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to partially adopt BEM as a CSS standard when writing CSS for elements.&lt;br /&gt;
BEM isn&#039;t a new CSS standard, but its not widely known either. Its existence fills a gap in how to style elements consistently. Through two basic notation techniques you can easily notate the purpose of structures that belong to an element and notate the intent of an element that is desired if the element has multiple versions.&lt;br /&gt;
&lt;br /&gt;
; Notating purpose : Here we use a suffix *__purpose*, the key being the two underscores.&lt;br /&gt;
; Notating intent : Here we use a suffix *--intent*, the key being the two hyphens.&lt;br /&gt;
&lt;br /&gt;
You&#039;ll notice in the example above that there is no way to style the continue button differently from the cancel button without relying on its name, something we certainly don&#039;t want to do.&lt;br /&gt;
The solution is to wrap each button in a div and give each div a class.&lt;br /&gt;
The BEM standard comes into play here in naming the classes, the following shows how you would apply BEM to show the purpose of each button in a way that can be easily interpreted and styled in CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__cancel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__continue&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now each button is wrapped in a div with a class, *m-element-confirmation__cancel* and *m-element-confirmation__continue*.&lt;br /&gt;
This class can be read by the themer and because of the __ can be easily identified as both belonging to the m-element-confirmation and serving a specific purpose, continue or cancel.&lt;br /&gt;
&lt;br /&gt;
Now to explain the idea of intents.&lt;br /&gt;
An intent is when a single element takes on a different apprearance to convey a specific meaning. A little bit like a state, but with more meaning.&lt;br /&gt;
An easy example is notifications where you will no doubt be familiar with the idea of having a error notifications, warning notifications, success notification etc. Each of error, warning, and success is a intent.&lt;br /&gt;
&lt;br /&gt;
The following shows how this would work:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- A standard notification --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- A warning --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification m-element-notification--warning&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Grids&lt;br /&gt;
&lt;br /&gt;
We need to adopt a single grid framework.&lt;br /&gt;
&lt;br /&gt;
Personally I don&#039;t think we should use pure bootstrap or pure YUI, instead we should choose one of these and build it use our class name structures.&lt;br /&gt;
&lt;br /&gt;
All grid classes should start with m-grid.&lt;br /&gt;
&lt;br /&gt;
==Writing CSS==&lt;br /&gt;
&lt;br /&gt;
Before we begin lets lay down some ground level goals, things that will help us achieve clear and understandable CSS in the future.&lt;br /&gt;
* Formatting, ordering, alignment, and spacing are all important in having CSS that can be easily read by others.&lt;br /&gt;
* Don&#039;t optimise your CSS, be verbose and stick to the styles in this guide. We have tools that will handle optimisation for you.&lt;br /&gt;
* Never use *!important* in your CSS unless it is absolutely impossible to avoid doing so.&lt;br /&gt;
&lt;br /&gt;
===Terminology===&lt;br /&gt;
&lt;br /&gt;
Its important that when we are speaking about CSS we are speaking the same language.&lt;br /&gt;
Lets look at the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-page .m-selector-1,&lt;br /&gt;
.m-page .m-selector-2,&lt;br /&gt;
.m-page .m-selector-3 {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
    color: #000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-1 {&lt;br /&gt;
    margin: 1em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Ruleset : Each of the two rules is a single *ruleset*.&lt;br /&gt;
; Rule: _.m-page .m-selector-1_ is a rule.&lt;br /&gt;
; Selector : _.m-selector-1_ is a *selector*, it is a single part of a rule.&lt;br /&gt;
; Declaration : _background-color: #FFF_ is a declaration.&lt;br /&gt;
; &lt;br /&gt;
&lt;br /&gt;
===Essential formatting===&lt;br /&gt;
&lt;br /&gt;
The following are the guies for writing CSS.&lt;br /&gt;
&lt;br /&gt;
* Always use spaces - never use tabs. All editors can be configured to do it.&lt;br /&gt;
* Indent by 4 spaces - never more, never less.&lt;br /&gt;
* A single empty line between rulesets to maintain consistent spacing of rules.&lt;br /&gt;
* One rule per line.&lt;br /&gt;
* A single space between each selector in a rule.&lt;br /&gt;
* No space between a rule and the comma in a ruleset.&lt;br /&gt;
* A single space between a selector and the opening brace of a ruleset.&lt;br /&gt;
* One level of indentation before each declaration.&lt;br /&gt;
* A single space the colon in a declaration.&lt;br /&gt;
* A single space after each item in a declaration containing multiple items.&lt;br /&gt;
&lt;br /&gt;
The following shows how the above rules apply:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-selector-1,&lt;br /&gt;
.m-selector-2 .m-selector-3 {&lt;br /&gt;
    background: #ffa800 url(&amp;quot;background.png&amp;quot;) no-repeat right top;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    display: inline-block;&lt;br /&gt;
    font-family: arial, sans-serif;&lt;br /&gt;
    margin: 5px 10px;&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-4 {&lt;br /&gt;
    border-radius: 3px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General rules===&lt;br /&gt;
&lt;br /&gt;
Declaration ordering is the very first thing to discuss. There is no strict rule on how to order your declarations, however there is a recommendation.&lt;br /&gt;
We recommend that you order declarations within a ruleset alphabetically.&lt;br /&gt;
If we all start doing this then when you read CSS written by someone else you will soon learn to very quickly find your way around the declarations within a rule.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Recommended **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    color: #000;&lt;br /&gt;
    display: block;&lt;br /&gt;
    margin: 5px;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do not use a measurement unit when writing a 0 value.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use lowercase and shorthand values for colours.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #ffffff;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: white;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always quote variable values.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector[attr=&amp;quot;variable&amp;quot;] {&lt;br /&gt;
    background-image: url(&amp;quot;image.png&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector[attr=variable] {&lt;br /&gt;
    background-image: url(image.png);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Commenting===&lt;br /&gt;
&lt;br /&gt;
Always comment your CSS and Less.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Styles for the button atom.&lt;br /&gt;
 */&lt;br /&gt;
.m-element-button {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rules and exceptions for less===&lt;br /&gt;
&lt;br /&gt;
Need to write some guff on Less.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45895</id>
		<title>User:Sam Hemelryk/CSS style guidelines</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45895"/>
		<updated>2014-07-22T05:07:09Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Writing HTML */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45830&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
==HTML and CSS style guide==&lt;br /&gt;
&lt;br /&gt;
This is a guide to writing CSS within Moodle.&lt;br /&gt;
&lt;br /&gt;
==Why have a strict guide==&lt;br /&gt;
&lt;br /&gt;
At the time of writing this CSS within Moodle (2.7) themes is in a poor state and has been for a long time. Without previously having a guide we were finding that:&lt;br /&gt;
&lt;br /&gt;
* As there was no formal guide to creating id&#039;s or classes, each developer does there own thing.&lt;br /&gt;
* As there was no formal guide on how to write CSS there were numerous techniques used when writing CSS and no consistency.&lt;br /&gt;
* Majority of pages create uniuqe output and require unique CSS, there is very little re-use of design.&lt;br /&gt;
&lt;br /&gt;
While those points may not sound bad to you consider that in following stats from Moodle 2.7 themes:&lt;br /&gt;
&lt;br /&gt;
* Base theme contains 3802 rulesets with a total of 5800 styles.&lt;br /&gt;
* Bootstrapbase theme contains 5170 rulesets with a total of 9362 styles.&lt;br /&gt;
* Clean theme contains 5172 rulesets with a total of 9366 styles.&lt;br /&gt;
* More theme contains 5177 rulesets with a total of 9063 styles.&lt;br /&gt;
&lt;br /&gt;
You get the picture, several thousand selectors containing nearly 10000 styles.&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.8 we commited to introducing a element library to aid the reuse of design and documenting all aspects of output including a guide on writing CSS for Moodle. This is that guide.&lt;br /&gt;
&lt;br /&gt;
==Our goals==&lt;br /&gt;
&lt;br /&gt;
Its very important to understand what we are trying to achieve with this style guide and output in general.&lt;br /&gt;
&lt;br /&gt;
; Frontend framework agnostic : We want theme designers to be able to apply present and future frontend frameworks to Moodle with minimal effort.&lt;br /&gt;
; Consistent interfaces : We want Moodle to have consistency throughout its interfaces, minimising the amount of frontend design and development that is required in coding and styling an interface.&lt;br /&gt;
; Cleanly formatted HTML and CSS : to minimise both development time and to make our renderers and CSS and more maintainable.&lt;br /&gt;
&lt;br /&gt;
We plan to faciliate these with the following:&lt;br /&gt;
; Elements : Highly re-usable objects to produce HTML, these will be used consistently and relied upon by developers creating interfaces. By having these elements we create a consistent look, interface creation will be much quicker and theme designers through the re-use of a limited number of elements.&lt;br /&gt;
; Element library : A tool to show samples of each element, this can be used to view and test designs. It aids the developer by showing them the elements they can select from when creating an interface, and it aids designers by giving them a test area that doesn&#039;t require them to dig through every page in Moodle.&lt;br /&gt;
; Documentation : We will now have proper documentation on all aspects of output. Including this CSS style guide, a renderer best practices guide, and a guide to creating elements.&lt;br /&gt;
&lt;br /&gt;
==Where to put CSS in Moodle core==&lt;br /&gt;
&lt;br /&gt;
CSS can reside in a number of locations depending upon what you are styling.&lt;br /&gt;
&lt;br /&gt;
Remember it doesn&#039;t matter how many CSS files we end up with, on a production site with Theme designer mode switched off (default) all CSS files will be combined and minimised into a single file that is served to the client.&lt;br /&gt;
Excepting the case of IE where we must split the CSS into several smaller files to work around browser limitations.&lt;br /&gt;
&lt;br /&gt;
===CSS for elements===&lt;br /&gt;
As we are moving to using elements you will find that CSS for elements is where most of the effort is going to go.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should reside within themes only, you will find that elements must be styled in all core base themes, this means at least Bootstrapbase and base.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should be located within either &#039;&#039;&#039;theme/themename/style/elements/elementname.css&#039;&#039;&#039; or &#039;&#039;&#039;theme/themename/less/elements/elementname.css&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The actual CSS file should be named according to the element. As elements can be namespaced we need to ensure that that is reflected in the name of the file.&lt;br /&gt;
For instance:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Element&lt;br /&gt;
! CSS location in base&lt;br /&gt;
! CSS location in bootstrapbase&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\button&lt;br /&gt;
| style/elements/core_output_button.css&lt;br /&gt;
| less/moodle/elements/core_output_button.css&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\navigation_bar&lt;br /&gt;
| style/elements/core_output_navigation_bar.css&lt;br /&gt;
| less/moodle/elements/core_output_navigation_bar.css&lt;br /&gt;
|-&lt;br /&gt;
| \mod_assign\output\user_submission&lt;br /&gt;
| style/elements/mod_assign_output_user_submission.css&lt;br /&gt;
| less/moodle/elements/mod_assign_output_user_submission.css&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These will still need to be included in the theme, by which ever means is relevant.&lt;br /&gt;
If you are using &#039;&#039;.css&#039;&#039; files like the base theme does then you will use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// In your themes config.php&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;elements/core_output_button&#039;,&lt;br /&gt;
    &#039;elements/core_output_navigation_bar&#039;,&lt;br /&gt;
    &#039;elements/mod_assign_output_user_submission&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using less as bootstrapbase does then you will use:&lt;br /&gt;
&amp;lt;code CSS&amp;gt;&lt;br /&gt;
/** In your primary less file **/&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_button&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_navigation_bar&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/mod_assign_output_user_submission&amp;quot;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General CSS===&lt;br /&gt;
&lt;br /&gt;
This is CSS for the theme that doesn&#039;t relate to a specific element. Hopefully as we convert more and more of Moodles interfaces to use elements we should see less general CSS.&lt;br /&gt;
&lt;br /&gt;
In any case nothing has changed in regards to the location of general CSS.&lt;br /&gt;
; CSS : If your theme is using standard CSS then it must be located within the &#039;&#039;style&#039;&#039; directory of your theme and should be in logically separated files.&lt;br /&gt;
; Less : If your theme is using less then it should be located in a &#039;&#039;less/moodle&#039;&#039; directory within your theme.&lt;br /&gt;
&lt;br /&gt;
We recommend that you separate styles into files based upon the Moodle component being styled. Again as all CSS files get combined into a single file on production sites it doesn&#039;t matter how many files you end up with.&lt;br /&gt;
&lt;br /&gt;
This would lead to files named like:&lt;br /&gt;
* style/core.css&lt;br /&gt;
* style/course.css&lt;br /&gt;
* style/mod_forum.css&lt;br /&gt;
&lt;br /&gt;
===Where to put CSS in plugins===&lt;br /&gt;
&lt;br /&gt;
It is possible in Moodle to add CSS stylesheets to all plugins (including core plugins).&amp;lt;br /&amp;gt;&lt;br /&gt;
Moodle always looks for a &#039;&#039;styles.css&#039;&#039; file within your plugins directory, and it also looks for a styles_themename.css where themename is the name of the currect theme being used.&lt;br /&gt;
&lt;br /&gt;
For instance the following could be added to the forum module:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;mod/forum/styles.css&#039;&#039;: Used all the time.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_base.css&#039;&#039; : Used when the user is using the base theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_bootstrapbase.css&#039;&#039; : Used when the user is using the bootstrapbase theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_clean.css&#039;&#039; : Used when the user is using the clean theme.&lt;br /&gt;
&lt;br /&gt;
===CSS in core plugins===&lt;br /&gt;
&lt;br /&gt;
For core plugins only styles.css is permitted and it should only ever contain styles essential to the presentation of the plugin.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present styles essential for the display of the plugin are allowed here, however when the plugin interfaces have been converted to use elements this file should be nearly empty and contain only the following:&lt;br /&gt;
* Images, icons and text used for visual presentation such as icons to notify state (expanded/collapsed, warnings...)&lt;br /&gt;
* Accessiblity orientated styles required to make the interface accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Under no circumstances should it contain any visual stylings such as border, rounded corners, and background colours not associated with state.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==HTML==&lt;br /&gt;
&lt;br /&gt;
The following sections detail rules in place for writing HTML.&lt;br /&gt;
&lt;br /&gt;
Before we start a couple of general recommendations:&lt;br /&gt;
&lt;br /&gt;
; Use hyphens rather than underscores when concatenating strings in attributes : for example &#039;&#039;.course-new-activity-chooser&#039;&#039; instead of &#039;&#039;.course_new_activity_chooser&#039;&#039;. By all doing this we will have a more consistent appearance and as We use underscores as part of frankenstyle which is prominent in CSS helps us to reduce the chance of naming conflicts.&lt;br /&gt;
; Think semantics - but don&#039;t get caught up in it : Semantic CSS is beautiful CSS lending itself ultimately to the redesign that is going to happen. But enforcing a semantic design can be an arduous journey. Instead we encourage semantic CSS but are happy to see non-semantic CSS when it is for the greater good.&lt;br /&gt;
&lt;br /&gt;
===Using the ID attribute===&lt;br /&gt;
&lt;br /&gt;
The situation of having a single JavaScript driven element was considered but even then it is better to style only classes and other attributes as we can&#039;t be sure what the future holds.&lt;br /&gt;
&lt;br /&gt;
There are three rules you should follow when creating an ID:&lt;br /&gt;
&lt;br /&gt;
# They should only be given to elements and HTML nodes that need to be interacted with by JavaScript.&lt;br /&gt;
# It should always start with &#039;&#039;&#039;m-&#039;&#039;&#039; &#039;&#039;(see note below)&#039;&#039;&lt;br /&gt;
# The actual ID should be descriptive of the node and contents as a whole unit. It must fully and concisely describe its purpose.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that in an ideal world ID&#039;s should not be used for styling.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Good&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-course-new-activity-chooser&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bad&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
It doesn&#039;t have the m- prefix&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This may appear OK at first but when you think about it selecting an activity within Moodle&lt;br /&gt;
is something that is done in multiple places and the this widget may not be applicable to&lt;br /&gt;
every place, as there may be other activity selector JS one day introduced having a&lt;br /&gt;
more complete ID is important&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-activity-selector&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The requirement to use m- prefix is entirely new, this has been created as this instantly reduces the chances of conflicting with present and future frontend frameworks that may be adopted by core or third party themes. Aiding our goal of being frontend framework agnostic.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will also help reduce the chance of conflicts in any third party code that may be used either by us in core, or by outside developers in their own code.&lt;br /&gt;
Moodle ID&#039;s will also be much more easily recognisable which we expect will be a benefit as JavaScript use in Moodle continues to increase.&lt;br /&gt;
&lt;br /&gt;
===Naming CSS classes===&lt;br /&gt;
&lt;br /&gt;
This is where a bit of organisation goes a long way and we want to be reasonably thorough in a consistent naming scheme and implementation.&lt;br /&gt;
&lt;br /&gt;
The very first thing to mention is that all classes in Moodle must now be prefixed by *m-*.&lt;br /&gt;
This instantly identifes a class as belonging to Moodle, it aids us in avoiding conflicts with any non-Moodle css that may be loaded, and it is part of our framework agnostic plan.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
All CSS classes must start with *m-*&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several prefix that are used within Moodle output now that should not be used as prefixs for classes unless they are serving the desired purpose.&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes are:&lt;br /&gt;
&lt;br /&gt;
; m-element : Prefix used on element classes, where m-element preceeds the name of the element, e.g. m-element-button, m-element-search&lt;br /&gt;
; m-state : Prefix used for CSS classes representing the state of an item, e.g. m-state-disabled, m-state-active, m-state-expanded.&lt;br /&gt;
; m-grid : Prefix used for creating HTML grids.&lt;br /&gt;
&lt;br /&gt;
====Elements&lt;br /&gt;
&lt;br /&gt;
Semantic design where it gives the best result, smart design where there is a better solution.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re not already familiar with the idea of semantic CSS then Chris Coylers artical [http://css-tricks.com/semantic-class-names/ What makes for a semantic class name] is a great starting point.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve not commit to adopting any one strict approach for writing CSS. We have adopted atomic design for our HTML elements, a design style which fits nicely with the likes of OOCSS, however be very clear that we are not adopting the OOCSS approach in its entirety. The high level abstraction of the visual aspects of elements into highly reusable agnostic classes does not always lend itself well to the Moodle world in which the we wish to be frontend framework agnostic and support largescale completely customisable themes.&amp;lt;br /&amp;gt;&lt;br /&gt;
The highly reusable classes that appeal to one designer, or to one frontend framework may not apply to another.&amp;lt;br /&amp;gt;&lt;br /&gt;
This decision is also impacted by our current default theme bootstrapbase that does not use well abstracted OOCSS in its design.&lt;br /&gt;
&lt;br /&gt;
Atomic design is going to see us end up with many parent child relationships in our HTML that we must carry through to our CSS. Through atomic design we start with smalled atoms and molecules that get built into larger organisms and placed within layouts.&lt;br /&gt;
&lt;br /&gt;
Every element should have a single class that identifies it as element X.&lt;br /&gt;
&lt;br /&gt;
For instance the button atom will have the class *m-element-button*&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button class=&amp;quot;m-element-button&amp;quot;&amp;gt;I am a button&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is simply the prefix &amp;quot;m-element&amp;quot; plus the element name.&lt;br /&gt;
&lt;br /&gt;
The purpose of this class is to allow the element to be styled with ease. The class name should be applied to the root node for the element, it should never be applied any lower.&lt;br /&gt;
&lt;br /&gt;
By having one class for the element, and always and only applied to the root node it makes it very easy in HTML to see where one element belongs to another.&lt;br /&gt;
&lt;br /&gt;
The following is an example of the search molecule, which in turn contains two button atoms.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to partially adopt BEM as a CSS standard when writing CSS for elements.&lt;br /&gt;
BEM isn&#039;t a new CSS standard, but its not widely known either. Its existence fills a gap in how to style elements consistently. Through two basic notation techniques you can easily notate the purpose of structures that belong to an element and notate the intent of an element that is desired if the element has multiple versions.&lt;br /&gt;
&lt;br /&gt;
; Notating purpose : Here we use a suffix *__purpose*, the key being the two underscores.&lt;br /&gt;
; Notating intent : Here we use a suffix *--intent*, the key being the two hyphens.&lt;br /&gt;
&lt;br /&gt;
You&#039;ll notice in the example above that there is no way to style the continue button differently from the cancel button without relying on its name, something we certainly don&#039;t want to do.&lt;br /&gt;
The solution is to wrap each button in a div and give each div a class.&lt;br /&gt;
The BEM standard comes into play here in naming the classes, the following shows how you would apply BEM to show the purpose of each button in a way that can be easily interpreted and styled in CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__cancel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__continue&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now each button is wrapped in a div with a class, *m-element-confirmation__cancel* and *m-element-confirmation__continue*.&lt;br /&gt;
This class can be read by the themer and because of the __ can be easily identified as both belonging to the m-element-confirmation and serving a specific purpose, continue or cancel.&lt;br /&gt;
&lt;br /&gt;
Now to explain the idea of intents.&lt;br /&gt;
An intent is when a single element takes on a different apprearance to convey a specific meaning. A little bit like a state, but with more meaning.&lt;br /&gt;
An easy example is notifications where you will no doubt be familiar with the idea of having a error notifications, warning notifications, success notification etc. Each of error, warning, and success is a intent.&lt;br /&gt;
&lt;br /&gt;
The following shows how this would work:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- A standard notification --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- A warning --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification m-element-notification--warning&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Grids&lt;br /&gt;
&lt;br /&gt;
We need to adopt a single grid framework.&lt;br /&gt;
&lt;br /&gt;
Personally I don&#039;t think we should use pure bootstrap or pure YUI, instead we should choose one of these and build it use our class name structures.&lt;br /&gt;
&lt;br /&gt;
All grid classes should start with m-grid.&lt;br /&gt;
&lt;br /&gt;
==Writing CSS==&lt;br /&gt;
&lt;br /&gt;
Before we begin lets lay down some ground level goals, things that will help us achieve clear and understandable CSS in the future.&lt;br /&gt;
* Formatting, ordering, alignment, and spacing are all important in having CSS that can be easily read by others.&lt;br /&gt;
* Don&#039;t optimise your CSS, be verbose and stick to the styles in this guide. We have tools that will handle optimisation for you.&lt;br /&gt;
* Never use *!important* in your CSS unless it is absolutely impossible to avoid doing so.&lt;br /&gt;
&lt;br /&gt;
===Terminology===&lt;br /&gt;
&lt;br /&gt;
Its important that when we are speaking about CSS we are speaking the same language.&lt;br /&gt;
Lets look at the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-page .m-selector-1,&lt;br /&gt;
.m-page .m-selector-2,&lt;br /&gt;
.m-page .m-selector-3 {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
    color: #000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-1 {&lt;br /&gt;
    margin: 1em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Ruleset : Each of the two rules is a single *ruleset*.&lt;br /&gt;
; Rule: _.m-page .m-selector-1_ is a rule.&lt;br /&gt;
; Selector : _.m-selector-1_ is a *selector*, it is a single part of a rule.&lt;br /&gt;
; Declaration : _background-color: #FFF_ is a declaration.&lt;br /&gt;
; &lt;br /&gt;
&lt;br /&gt;
===Essential formatting===&lt;br /&gt;
&lt;br /&gt;
The following are the guies for writing CSS.&lt;br /&gt;
&lt;br /&gt;
* Always use spaces - never use tabs. All editors can be configured to do it.&lt;br /&gt;
* Indent by 4 spaces - never more, never less.&lt;br /&gt;
* A single empty line between rulesets to maintain consistent spacing of rules.&lt;br /&gt;
* One rule per line.&lt;br /&gt;
* A single space between each selector in a rule.&lt;br /&gt;
* No space between a rule and the comma in a ruleset.&lt;br /&gt;
* A single space between a selector and the opening brace of a ruleset.&lt;br /&gt;
* One level of indentation before each declaration.&lt;br /&gt;
* A single space the colon in a declaration.&lt;br /&gt;
* A single space after each item in a declaration containing multiple items.&lt;br /&gt;
&lt;br /&gt;
The following shows how the above rules apply:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-selector-1,&lt;br /&gt;
.m-selector-2 .m-selector-3 {&lt;br /&gt;
    background: #ffa800 url(&amp;quot;background.png&amp;quot;) no-repeat right top;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    display: inline-block;&lt;br /&gt;
    font-family: arial, sans-serif;&lt;br /&gt;
    margin: 5px 10px;&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-4 {&lt;br /&gt;
    border-radius: 3px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General rules===&lt;br /&gt;
&lt;br /&gt;
Declaration ordering is the very first thing to discuss. There is no strict rule on how to order your declarations, however there is a recommendation.&lt;br /&gt;
We recommend that you order declarations within a ruleset alphabetically.&lt;br /&gt;
If we all start doing this then when you read CSS written by someone else you will soon learn to very quickly find your way around the declarations within a rule.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Recommended **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    color: #000;&lt;br /&gt;
    display: block;&lt;br /&gt;
    margin: 5px;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do not use a measurement unit when writing a 0 value.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use lowercase and shorthand values for colours.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #ffffff;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: white;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always quote variable values.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector[attr=&amp;quot;variable&amp;quot;] {&lt;br /&gt;
    background-image: url(&amp;quot;image.png&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector[attr=variable] {&lt;br /&gt;
    background-image: url(image.png);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Commenting===&lt;br /&gt;
&lt;br /&gt;
Always comment your CSS and Less.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Styles for the button atom.&lt;br /&gt;
 */&lt;br /&gt;
.m-element-button {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rules and exceptions for less===&lt;br /&gt;
&lt;br /&gt;
Need to write some guff on Less.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45894</id>
		<title>User:Sam Hemelryk/CSS style guidelines</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45894"/>
		<updated>2014-07-22T05:06:52Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* CSS in core plugins= */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45830&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
==HTML and CSS style guide==&lt;br /&gt;
&lt;br /&gt;
This is a guide to writing CSS within Moodle.&lt;br /&gt;
&lt;br /&gt;
==Why have a strict guide==&lt;br /&gt;
&lt;br /&gt;
At the time of writing this CSS within Moodle (2.7) themes is in a poor state and has been for a long time. Without previously having a guide we were finding that:&lt;br /&gt;
&lt;br /&gt;
* As there was no formal guide to creating id&#039;s or classes, each developer does there own thing.&lt;br /&gt;
* As there was no formal guide on how to write CSS there were numerous techniques used when writing CSS and no consistency.&lt;br /&gt;
* Majority of pages create uniuqe output and require unique CSS, there is very little re-use of design.&lt;br /&gt;
&lt;br /&gt;
While those points may not sound bad to you consider that in following stats from Moodle 2.7 themes:&lt;br /&gt;
&lt;br /&gt;
* Base theme contains 3802 rulesets with a total of 5800 styles.&lt;br /&gt;
* Bootstrapbase theme contains 5170 rulesets with a total of 9362 styles.&lt;br /&gt;
* Clean theme contains 5172 rulesets with a total of 9366 styles.&lt;br /&gt;
* More theme contains 5177 rulesets with a total of 9063 styles.&lt;br /&gt;
&lt;br /&gt;
You get the picture, several thousand selectors containing nearly 10000 styles.&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.8 we commited to introducing a element library to aid the reuse of design and documenting all aspects of output including a guide on writing CSS for Moodle. This is that guide.&lt;br /&gt;
&lt;br /&gt;
==Our goals==&lt;br /&gt;
&lt;br /&gt;
Its very important to understand what we are trying to achieve with this style guide and output in general.&lt;br /&gt;
&lt;br /&gt;
; Frontend framework agnostic : We want theme designers to be able to apply present and future frontend frameworks to Moodle with minimal effort.&lt;br /&gt;
; Consistent interfaces : We want Moodle to have consistency throughout its interfaces, minimising the amount of frontend design and development that is required in coding and styling an interface.&lt;br /&gt;
; Cleanly formatted HTML and CSS : to minimise both development time and to make our renderers and CSS and more maintainable.&lt;br /&gt;
&lt;br /&gt;
We plan to faciliate these with the following:&lt;br /&gt;
; Elements : Highly re-usable objects to produce HTML, these will be used consistently and relied upon by developers creating interfaces. By having these elements we create a consistent look, interface creation will be much quicker and theme designers through the re-use of a limited number of elements.&lt;br /&gt;
; Element library : A tool to show samples of each element, this can be used to view and test designs. It aids the developer by showing them the elements they can select from when creating an interface, and it aids designers by giving them a test area that doesn&#039;t require them to dig through every page in Moodle.&lt;br /&gt;
; Documentation : We will now have proper documentation on all aspects of output. Including this CSS style guide, a renderer best practices guide, and a guide to creating elements.&lt;br /&gt;
&lt;br /&gt;
==Where to put CSS in Moodle core==&lt;br /&gt;
&lt;br /&gt;
CSS can reside in a number of locations depending upon what you are styling.&lt;br /&gt;
&lt;br /&gt;
Remember it doesn&#039;t matter how many CSS files we end up with, on a production site with Theme designer mode switched off (default) all CSS files will be combined and minimised into a single file that is served to the client.&lt;br /&gt;
Excepting the case of IE where we must split the CSS into several smaller files to work around browser limitations.&lt;br /&gt;
&lt;br /&gt;
===CSS for elements===&lt;br /&gt;
As we are moving to using elements you will find that CSS for elements is where most of the effort is going to go.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should reside within themes only, you will find that elements must be styled in all core base themes, this means at least Bootstrapbase and base.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should be located within either &#039;&#039;&#039;theme/themename/style/elements/elementname.css&#039;&#039;&#039; or &#039;&#039;&#039;theme/themename/less/elements/elementname.css&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The actual CSS file should be named according to the element. As elements can be namespaced we need to ensure that that is reflected in the name of the file.&lt;br /&gt;
For instance:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Element&lt;br /&gt;
! CSS location in base&lt;br /&gt;
! CSS location in bootstrapbase&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\button&lt;br /&gt;
| style/elements/core_output_button.css&lt;br /&gt;
| less/moodle/elements/core_output_button.css&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\navigation_bar&lt;br /&gt;
| style/elements/core_output_navigation_bar.css&lt;br /&gt;
| less/moodle/elements/core_output_navigation_bar.css&lt;br /&gt;
|-&lt;br /&gt;
| \mod_assign\output\user_submission&lt;br /&gt;
| style/elements/mod_assign_output_user_submission.css&lt;br /&gt;
| less/moodle/elements/mod_assign_output_user_submission.css&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These will still need to be included in the theme, by which ever means is relevant.&lt;br /&gt;
If you are using &#039;&#039;.css&#039;&#039; files like the base theme does then you will use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// In your themes config.php&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;elements/core_output_button&#039;,&lt;br /&gt;
    &#039;elements/core_output_navigation_bar&#039;,&lt;br /&gt;
    &#039;elements/mod_assign_output_user_submission&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using less as bootstrapbase does then you will use:&lt;br /&gt;
&amp;lt;code CSS&amp;gt;&lt;br /&gt;
/** In your primary less file **/&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_button&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_navigation_bar&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/mod_assign_output_user_submission&amp;quot;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General CSS===&lt;br /&gt;
&lt;br /&gt;
This is CSS for the theme that doesn&#039;t relate to a specific element. Hopefully as we convert more and more of Moodles interfaces to use elements we should see less general CSS.&lt;br /&gt;
&lt;br /&gt;
In any case nothing has changed in regards to the location of general CSS.&lt;br /&gt;
; CSS : If your theme is using standard CSS then it must be located within the &#039;&#039;style&#039;&#039; directory of your theme and should be in logically separated files.&lt;br /&gt;
; Less : If your theme is using less then it should be located in a &#039;&#039;less/moodle&#039;&#039; directory within your theme.&lt;br /&gt;
&lt;br /&gt;
We recommend that you separate styles into files based upon the Moodle component being styled. Again as all CSS files get combined into a single file on production sites it doesn&#039;t matter how many files you end up with.&lt;br /&gt;
&lt;br /&gt;
This would lead to files named like:&lt;br /&gt;
* style/core.css&lt;br /&gt;
* style/course.css&lt;br /&gt;
* style/mod_forum.css&lt;br /&gt;
&lt;br /&gt;
===Where to put CSS in plugins===&lt;br /&gt;
&lt;br /&gt;
It is possible in Moodle to add CSS stylesheets to all plugins (including core plugins).&amp;lt;br /&amp;gt;&lt;br /&gt;
Moodle always looks for a &#039;&#039;styles.css&#039;&#039; file within your plugins directory, and it also looks for a styles_themename.css where themename is the name of the currect theme being used.&lt;br /&gt;
&lt;br /&gt;
For instance the following could be added to the forum module:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;mod/forum/styles.css&#039;&#039;: Used all the time.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_base.css&#039;&#039; : Used when the user is using the base theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_bootstrapbase.css&#039;&#039; : Used when the user is using the bootstrapbase theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_clean.css&#039;&#039; : Used when the user is using the clean theme.&lt;br /&gt;
&lt;br /&gt;
===CSS in core plugins===&lt;br /&gt;
&lt;br /&gt;
For core plugins only styles.css is permitted and it should only ever contain styles essential to the presentation of the plugin.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present styles essential for the display of the plugin are allowed here, however when the plugin interfaces have been converted to use elements this file should be nearly empty and contain only the following:&lt;br /&gt;
* Images, icons and text used for visual presentation such as icons to notify state (expanded/collapsed, warnings...)&lt;br /&gt;
* Accessiblity orientated styles required to make the interface accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Under no circumstances should it contain any visual stylings such as border, rounded corners, and background colours not associated with state.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Writing HTML==&lt;br /&gt;
&lt;br /&gt;
The following sections detail rules in place for writing HTML.&lt;br /&gt;
&lt;br /&gt;
Before we start a couple of general recommendations:&lt;br /&gt;
&lt;br /&gt;
; Use hyphens rather than underscores when concatenating strings in attributes : for example &#039;&#039;.course-new-activity-chooser&#039;&#039; instead of &#039;&#039;.course_new_activity_chooser&#039;&#039;. By all doing this we will have a more consistent appearance and as We use underscores as part of frankenstyle which is prominent in CSS helps us to reduce the chance of naming conflicts.&lt;br /&gt;
; Think semantics - but don&#039;t get caught up in it : Semantic CSS is beautiful CSS lending itself ultimately to the redesign that is going to happen. But enforcing a semantic design can be an arduous journey. Instead we encourage semantic CSS but are happy to see non-semantic CSS when it is for the greater good.&lt;br /&gt;
&lt;br /&gt;
===Using the ID attribute===&lt;br /&gt;
&lt;br /&gt;
The situation of having a single JavaScript driven element was considered but even then it is better to style only classes and other attributes as we can&#039;t be sure what the future holds.&lt;br /&gt;
&lt;br /&gt;
There are three rules you should follow when creating an ID:&lt;br /&gt;
&lt;br /&gt;
# They should only be given to elements and HTML nodes that need to be interacted with by JavaScript.&lt;br /&gt;
# It should always start with &#039;&#039;&#039;m-&#039;&#039;&#039; &#039;&#039;(see note below)&#039;&#039;&lt;br /&gt;
# The actual ID should be descriptive of the node and contents as a whole unit. It must fully and concisely describe its purpose.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that in an ideal world ID&#039;s should not be used for styling.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Good&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-course-new-activity-chooser&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bad&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
It doesn&#039;t have the m- prefix&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This may appear OK at first but when you think about it selecting an activity within Moodle&lt;br /&gt;
is something that is done in multiple places and the this widget may not be applicable to&lt;br /&gt;
every place, as there may be other activity selector JS one day introduced having a&lt;br /&gt;
more complete ID is important&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-activity-selector&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The requirement to use m- prefix is entirely new, this has been created as this instantly reduces the chances of conflicting with present and future frontend frameworks that may be adopted by core or third party themes. Aiding our goal of being frontend framework agnostic.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will also help reduce the chance of conflicts in any third party code that may be used either by us in core, or by outside developers in their own code.&lt;br /&gt;
Moodle ID&#039;s will also be much more easily recognisable which we expect will be a benefit as JavaScript use in Moodle continues to increase.&lt;br /&gt;
&lt;br /&gt;
===Naming CSS classes===&lt;br /&gt;
&lt;br /&gt;
This is where a bit of organisation goes a long way and we want to be reasonably thorough in a consistent naming scheme and implementation.&lt;br /&gt;
&lt;br /&gt;
The very first thing to mention is that all classes in Moodle must now be prefixed by *m-*.&lt;br /&gt;
This instantly identifes a class as belonging to Moodle, it aids us in avoiding conflicts with any non-Moodle css that may be loaded, and it is part of our framework agnostic plan.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
All CSS classes must start with *m-*&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several prefix that are used within Moodle output now that should not be used as prefixs for classes unless they are serving the desired purpose.&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes are:&lt;br /&gt;
&lt;br /&gt;
; m-element : Prefix used on element classes, where m-element preceeds the name of the element, e.g. m-element-button, m-element-search&lt;br /&gt;
; m-state : Prefix used for CSS classes representing the state of an item, e.g. m-state-disabled, m-state-active, m-state-expanded.&lt;br /&gt;
; m-grid : Prefix used for creating HTML grids.&lt;br /&gt;
&lt;br /&gt;
====Elements&lt;br /&gt;
&lt;br /&gt;
Semantic design where it gives the best result, smart design where there is a better solution.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re not already familiar with the idea of semantic CSS then Chris Coylers artical [http://css-tricks.com/semantic-class-names/ What makes for a semantic class name] is a great starting point.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve not commit to adopting any one strict approach for writing CSS. We have adopted atomic design for our HTML elements, a design style which fits nicely with the likes of OOCSS, however be very clear that we are not adopting the OOCSS approach in its entirety. The high level abstraction of the visual aspects of elements into highly reusable agnostic classes does not always lend itself well to the Moodle world in which the we wish to be frontend framework agnostic and support largescale completely customisable themes.&amp;lt;br /&amp;gt;&lt;br /&gt;
The highly reusable classes that appeal to one designer, or to one frontend framework may not apply to another.&amp;lt;br /&amp;gt;&lt;br /&gt;
This decision is also impacted by our current default theme bootstrapbase that does not use well abstracted OOCSS in its design.&lt;br /&gt;
&lt;br /&gt;
Atomic design is going to see us end up with many parent child relationships in our HTML that we must carry through to our CSS. Through atomic design we start with smalled atoms and molecules that get built into larger organisms and placed within layouts.&lt;br /&gt;
&lt;br /&gt;
Every element should have a single class that identifies it as element X.&lt;br /&gt;
&lt;br /&gt;
For instance the button atom will have the class *m-element-button*&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button class=&amp;quot;m-element-button&amp;quot;&amp;gt;I am a button&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is simply the prefix &amp;quot;m-element&amp;quot; plus the element name.&lt;br /&gt;
&lt;br /&gt;
The purpose of this class is to allow the element to be styled with ease. The class name should be applied to the root node for the element, it should never be applied any lower.&lt;br /&gt;
&lt;br /&gt;
By having one class for the element, and always and only applied to the root node it makes it very easy in HTML to see where one element belongs to another.&lt;br /&gt;
&lt;br /&gt;
The following is an example of the search molecule, which in turn contains two button atoms.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to partially adopt BEM as a CSS standard when writing CSS for elements.&lt;br /&gt;
BEM isn&#039;t a new CSS standard, but its not widely known either. Its existence fills a gap in how to style elements consistently. Through two basic notation techniques you can easily notate the purpose of structures that belong to an element and notate the intent of an element that is desired if the element has multiple versions.&lt;br /&gt;
&lt;br /&gt;
; Notating purpose : Here we use a suffix *__purpose*, the key being the two underscores.&lt;br /&gt;
; Notating intent : Here we use a suffix *--intent*, the key being the two hyphens.&lt;br /&gt;
&lt;br /&gt;
You&#039;ll notice in the example above that there is no way to style the continue button differently from the cancel button without relying on its name, something we certainly don&#039;t want to do.&lt;br /&gt;
The solution is to wrap each button in a div and give each div a class.&lt;br /&gt;
The BEM standard comes into play here in naming the classes, the following shows how you would apply BEM to show the purpose of each button in a way that can be easily interpreted and styled in CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__cancel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__continue&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now each button is wrapped in a div with a class, *m-element-confirmation__cancel* and *m-element-confirmation__continue*.&lt;br /&gt;
This class can be read by the themer and because of the __ can be easily identified as both belonging to the m-element-confirmation and serving a specific purpose, continue or cancel.&lt;br /&gt;
&lt;br /&gt;
Now to explain the idea of intents.&lt;br /&gt;
An intent is when a single element takes on a different apprearance to convey a specific meaning. A little bit like a state, but with more meaning.&lt;br /&gt;
An easy example is notifications where you will no doubt be familiar with the idea of having a error notifications, warning notifications, success notification etc. Each of error, warning, and success is a intent.&lt;br /&gt;
&lt;br /&gt;
The following shows how this would work:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- A standard notification --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- A warning --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification m-element-notification--warning&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Grids&lt;br /&gt;
&lt;br /&gt;
We need to adopt a single grid framework.&lt;br /&gt;
&lt;br /&gt;
Personally I don&#039;t think we should use pure bootstrap or pure YUI, instead we should choose one of these and build it use our class name structures.&lt;br /&gt;
&lt;br /&gt;
All grid classes should start with m-grid.&lt;br /&gt;
&lt;br /&gt;
==Writing CSS==&lt;br /&gt;
&lt;br /&gt;
Before we begin lets lay down some ground level goals, things that will help us achieve clear and understandable CSS in the future.&lt;br /&gt;
* Formatting, ordering, alignment, and spacing are all important in having CSS that can be easily read by others.&lt;br /&gt;
* Don&#039;t optimise your CSS, be verbose and stick to the styles in this guide. We have tools that will handle optimisation for you.&lt;br /&gt;
* Never use *!important* in your CSS unless it is absolutely impossible to avoid doing so.&lt;br /&gt;
&lt;br /&gt;
===Terminology===&lt;br /&gt;
&lt;br /&gt;
Its important that when we are speaking about CSS we are speaking the same language.&lt;br /&gt;
Lets look at the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-page .m-selector-1,&lt;br /&gt;
.m-page .m-selector-2,&lt;br /&gt;
.m-page .m-selector-3 {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
    color: #000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-1 {&lt;br /&gt;
    margin: 1em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Ruleset : Each of the two rules is a single *ruleset*.&lt;br /&gt;
; Rule: _.m-page .m-selector-1_ is a rule.&lt;br /&gt;
; Selector : _.m-selector-1_ is a *selector*, it is a single part of a rule.&lt;br /&gt;
; Declaration : _background-color: #FFF_ is a declaration.&lt;br /&gt;
; &lt;br /&gt;
&lt;br /&gt;
===Essential formatting===&lt;br /&gt;
&lt;br /&gt;
The following are the guies for writing CSS.&lt;br /&gt;
&lt;br /&gt;
* Always use spaces - never use tabs. All editors can be configured to do it.&lt;br /&gt;
* Indent by 4 spaces - never more, never less.&lt;br /&gt;
* A single empty line between rulesets to maintain consistent spacing of rules.&lt;br /&gt;
* One rule per line.&lt;br /&gt;
* A single space between each selector in a rule.&lt;br /&gt;
* No space between a rule and the comma in a ruleset.&lt;br /&gt;
* A single space between a selector and the opening brace of a ruleset.&lt;br /&gt;
* One level of indentation before each declaration.&lt;br /&gt;
* A single space the colon in a declaration.&lt;br /&gt;
* A single space after each item in a declaration containing multiple items.&lt;br /&gt;
&lt;br /&gt;
The following shows how the above rules apply:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-selector-1,&lt;br /&gt;
.m-selector-2 .m-selector-3 {&lt;br /&gt;
    background: #ffa800 url(&amp;quot;background.png&amp;quot;) no-repeat right top;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    display: inline-block;&lt;br /&gt;
    font-family: arial, sans-serif;&lt;br /&gt;
    margin: 5px 10px;&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-4 {&lt;br /&gt;
    border-radius: 3px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General rules===&lt;br /&gt;
&lt;br /&gt;
Declaration ordering is the very first thing to discuss. There is no strict rule on how to order your declarations, however there is a recommendation.&lt;br /&gt;
We recommend that you order declarations within a ruleset alphabetically.&lt;br /&gt;
If we all start doing this then when you read CSS written by someone else you will soon learn to very quickly find your way around the declarations within a rule.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Recommended **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    color: #000;&lt;br /&gt;
    display: block;&lt;br /&gt;
    margin: 5px;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do not use a measurement unit when writing a 0 value.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use lowercase and shorthand values for colours.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #ffffff;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: white;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always quote variable values.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector[attr=&amp;quot;variable&amp;quot;] {&lt;br /&gt;
    background-image: url(&amp;quot;image.png&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector[attr=variable] {&lt;br /&gt;
    background-image: url(image.png);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Commenting===&lt;br /&gt;
&lt;br /&gt;
Always comment your CSS and Less.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Styles for the button atom.&lt;br /&gt;
 */&lt;br /&gt;
.m-element-button {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rules and exceptions for less===&lt;br /&gt;
&lt;br /&gt;
Need to write some guff on Less.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45893</id>
		<title>User:Sam Hemelryk/CSS style guidelines</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45893"/>
		<updated>2014-07-22T05:06:28Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Why have a strict guide */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45830&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
==HTML and CSS style guide==&lt;br /&gt;
&lt;br /&gt;
This is a guide to writing CSS within Moodle.&lt;br /&gt;
&lt;br /&gt;
==Why have a strict guide==&lt;br /&gt;
&lt;br /&gt;
At the time of writing this CSS within Moodle (2.7) themes is in a poor state and has been for a long time. Without previously having a guide we were finding that:&lt;br /&gt;
&lt;br /&gt;
* As there was no formal guide to creating id&#039;s or classes, each developer does there own thing.&lt;br /&gt;
* As there was no formal guide on how to write CSS there were numerous techniques used when writing CSS and no consistency.&lt;br /&gt;
* Majority of pages create uniuqe output and require unique CSS, there is very little re-use of design.&lt;br /&gt;
&lt;br /&gt;
While those points may not sound bad to you consider that in following stats from Moodle 2.7 themes:&lt;br /&gt;
&lt;br /&gt;
* Base theme contains 3802 rulesets with a total of 5800 styles.&lt;br /&gt;
* Bootstrapbase theme contains 5170 rulesets with a total of 9362 styles.&lt;br /&gt;
* Clean theme contains 5172 rulesets with a total of 9366 styles.&lt;br /&gt;
* More theme contains 5177 rulesets with a total of 9063 styles.&lt;br /&gt;
&lt;br /&gt;
You get the picture, several thousand selectors containing nearly 10000 styles.&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.8 we commited to introducing a element library to aid the reuse of design and documenting all aspects of output including a guide on writing CSS for Moodle. This is that guide.&lt;br /&gt;
&lt;br /&gt;
==Our goals==&lt;br /&gt;
&lt;br /&gt;
Its very important to understand what we are trying to achieve with this style guide and output in general.&lt;br /&gt;
&lt;br /&gt;
; Frontend framework agnostic : We want theme designers to be able to apply present and future frontend frameworks to Moodle with minimal effort.&lt;br /&gt;
; Consistent interfaces : We want Moodle to have consistency throughout its interfaces, minimising the amount of frontend design and development that is required in coding and styling an interface.&lt;br /&gt;
; Cleanly formatted HTML and CSS : to minimise both development time and to make our renderers and CSS and more maintainable.&lt;br /&gt;
&lt;br /&gt;
We plan to faciliate these with the following:&lt;br /&gt;
; Elements : Highly re-usable objects to produce HTML, these will be used consistently and relied upon by developers creating interfaces. By having these elements we create a consistent look, interface creation will be much quicker and theme designers through the re-use of a limited number of elements.&lt;br /&gt;
; Element library : A tool to show samples of each element, this can be used to view and test designs. It aids the developer by showing them the elements they can select from when creating an interface, and it aids designers by giving them a test area that doesn&#039;t require them to dig through every page in Moodle.&lt;br /&gt;
; Documentation : We will now have proper documentation on all aspects of output. Including this CSS style guide, a renderer best practices guide, and a guide to creating elements.&lt;br /&gt;
&lt;br /&gt;
==Where to put CSS in Moodle core==&lt;br /&gt;
&lt;br /&gt;
CSS can reside in a number of locations depending upon what you are styling.&lt;br /&gt;
&lt;br /&gt;
Remember it doesn&#039;t matter how many CSS files we end up with, on a production site with Theme designer mode switched off (default) all CSS files will be combined and minimised into a single file that is served to the client.&lt;br /&gt;
Excepting the case of IE where we must split the CSS into several smaller files to work around browser limitations.&lt;br /&gt;
&lt;br /&gt;
===CSS for elements===&lt;br /&gt;
As we are moving to using elements you will find that CSS for elements is where most of the effort is going to go.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should reside within themes only, you will find that elements must be styled in all core base themes, this means at least Bootstrapbase and base.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should be located within either &#039;&#039;&#039;theme/themename/style/elements/elementname.css&#039;&#039;&#039; or &#039;&#039;&#039;theme/themename/less/elements/elementname.css&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The actual CSS file should be named according to the element. As elements can be namespaced we need to ensure that that is reflected in the name of the file.&lt;br /&gt;
For instance:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Element&lt;br /&gt;
! CSS location in base&lt;br /&gt;
! CSS location in bootstrapbase&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\button&lt;br /&gt;
| style/elements/core_output_button.css&lt;br /&gt;
| less/moodle/elements/core_output_button.css&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\navigation_bar&lt;br /&gt;
| style/elements/core_output_navigation_bar.css&lt;br /&gt;
| less/moodle/elements/core_output_navigation_bar.css&lt;br /&gt;
|-&lt;br /&gt;
| \mod_assign\output\user_submission&lt;br /&gt;
| style/elements/mod_assign_output_user_submission.css&lt;br /&gt;
| less/moodle/elements/mod_assign_output_user_submission.css&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These will still need to be included in the theme, by which ever means is relevant.&lt;br /&gt;
If you are using &#039;&#039;.css&#039;&#039; files like the base theme does then you will use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// In your themes config.php&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;elements/core_output_button&#039;,&lt;br /&gt;
    &#039;elements/core_output_navigation_bar&#039;,&lt;br /&gt;
    &#039;elements/mod_assign_output_user_submission&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using less as bootstrapbase does then you will use:&lt;br /&gt;
&amp;lt;code CSS&amp;gt;&lt;br /&gt;
/** In your primary less file **/&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_button&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_navigation_bar&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/mod_assign_output_user_submission&amp;quot;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General CSS===&lt;br /&gt;
&lt;br /&gt;
This is CSS for the theme that doesn&#039;t relate to a specific element. Hopefully as we convert more and more of Moodles interfaces to use elements we should see less general CSS.&lt;br /&gt;
&lt;br /&gt;
In any case nothing has changed in regards to the location of general CSS.&lt;br /&gt;
; CSS : If your theme is using standard CSS then it must be located within the &#039;&#039;style&#039;&#039; directory of your theme and should be in logically separated files.&lt;br /&gt;
; Less : If your theme is using less then it should be located in a &#039;&#039;less/moodle&#039;&#039; directory within your theme.&lt;br /&gt;
&lt;br /&gt;
We recommend that you separate styles into files based upon the Moodle component being styled. Again as all CSS files get combined into a single file on production sites it doesn&#039;t matter how many files you end up with.&lt;br /&gt;
&lt;br /&gt;
This would lead to files named like:&lt;br /&gt;
* style/core.css&lt;br /&gt;
* style/course.css&lt;br /&gt;
* style/mod_forum.css&lt;br /&gt;
&lt;br /&gt;
===Where to put CSS in plugins===&lt;br /&gt;
&lt;br /&gt;
It is possible in Moodle to add CSS stylesheets to all plugins (including core plugins).&amp;lt;br /&amp;gt;&lt;br /&gt;
Moodle always looks for a &#039;&#039;styles.css&#039;&#039; file within your plugins directory, and it also looks for a styles_themename.css where themename is the name of the currect theme being used.&lt;br /&gt;
&lt;br /&gt;
For instance the following could be added to the forum module:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;mod/forum/styles.css&#039;&#039;: Used all the time.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_base.css&#039;&#039; : Used when the user is using the base theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_bootstrapbase.css&#039;&#039; : Used when the user is using the bootstrapbase theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_clean.css&#039;&#039; : Used when the user is using the clean theme.&lt;br /&gt;
&lt;br /&gt;
==CSS in core plugins===&lt;br /&gt;
&lt;br /&gt;
For core plugins only styles.css is permitted and it should only ever contain styles essential to the presentation of the plugin.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present styles essential for the display of the plugin are allowed here, however when the plugin interfaces have been converted to use elements this file should be nearly empty and contain only the following:&lt;br /&gt;
* Images, icons and text used for visual presentation such as icons to notify state (expanded/collapsed, warnings...)&lt;br /&gt;
* Accessiblity orientated styles required to make the interface accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Under no circumstances should it contain any visual stylings such as border, rounded corners, and background colours not associated with state.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Writing HTML==&lt;br /&gt;
&lt;br /&gt;
The following sections detail rules in place for writing HTML.&lt;br /&gt;
&lt;br /&gt;
Before we start a couple of general recommendations:&lt;br /&gt;
&lt;br /&gt;
; Use hyphens rather than underscores when concatenating strings in attributes : for example &#039;&#039;.course-new-activity-chooser&#039;&#039; instead of &#039;&#039;.course_new_activity_chooser&#039;&#039;. By all doing this we will have a more consistent appearance and as We use underscores as part of frankenstyle which is prominent in CSS helps us to reduce the chance of naming conflicts.&lt;br /&gt;
; Think semantics - but don&#039;t get caught up in it : Semantic CSS is beautiful CSS lending itself ultimately to the redesign that is going to happen. But enforcing a semantic design can be an arduous journey. Instead we encourage semantic CSS but are happy to see non-semantic CSS when it is for the greater good.&lt;br /&gt;
&lt;br /&gt;
===Using the ID attribute===&lt;br /&gt;
&lt;br /&gt;
The situation of having a single JavaScript driven element was considered but even then it is better to style only classes and other attributes as we can&#039;t be sure what the future holds.&lt;br /&gt;
&lt;br /&gt;
There are three rules you should follow when creating an ID:&lt;br /&gt;
&lt;br /&gt;
# They should only be given to elements and HTML nodes that need to be interacted with by JavaScript.&lt;br /&gt;
# It should always start with &#039;&#039;&#039;m-&#039;&#039;&#039; &#039;&#039;(see note below)&#039;&#039;&lt;br /&gt;
# The actual ID should be descriptive of the node and contents as a whole unit. It must fully and concisely describe its purpose.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that in an ideal world ID&#039;s should not be used for styling.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Good&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-course-new-activity-chooser&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bad&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
It doesn&#039;t have the m- prefix&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This may appear OK at first but when you think about it selecting an activity within Moodle&lt;br /&gt;
is something that is done in multiple places and the this widget may not be applicable to&lt;br /&gt;
every place, as there may be other activity selector JS one day introduced having a&lt;br /&gt;
more complete ID is important&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-activity-selector&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The requirement to use m- prefix is entirely new, this has been created as this instantly reduces the chances of conflicting with present and future frontend frameworks that may be adopted by core or third party themes. Aiding our goal of being frontend framework agnostic.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will also help reduce the chance of conflicts in any third party code that may be used either by us in core, or by outside developers in their own code.&lt;br /&gt;
Moodle ID&#039;s will also be much more easily recognisable which we expect will be a benefit as JavaScript use in Moodle continues to increase.&lt;br /&gt;
&lt;br /&gt;
===Naming CSS classes===&lt;br /&gt;
&lt;br /&gt;
This is where a bit of organisation goes a long way and we want to be reasonably thorough in a consistent naming scheme and implementation.&lt;br /&gt;
&lt;br /&gt;
The very first thing to mention is that all classes in Moodle must now be prefixed by *m-*.&lt;br /&gt;
This instantly identifes a class as belonging to Moodle, it aids us in avoiding conflicts with any non-Moodle css that may be loaded, and it is part of our framework agnostic plan.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
All CSS classes must start with *m-*&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several prefix that are used within Moodle output now that should not be used as prefixs for classes unless they are serving the desired purpose.&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes are:&lt;br /&gt;
&lt;br /&gt;
; m-element : Prefix used on element classes, where m-element preceeds the name of the element, e.g. m-element-button, m-element-search&lt;br /&gt;
; m-state : Prefix used for CSS classes representing the state of an item, e.g. m-state-disabled, m-state-active, m-state-expanded.&lt;br /&gt;
; m-grid : Prefix used for creating HTML grids.&lt;br /&gt;
&lt;br /&gt;
====Elements&lt;br /&gt;
&lt;br /&gt;
Semantic design where it gives the best result, smart design where there is a better solution.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re not already familiar with the idea of semantic CSS then Chris Coylers artical [http://css-tricks.com/semantic-class-names/ What makes for a semantic class name] is a great starting point.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve not commit to adopting any one strict approach for writing CSS. We have adopted atomic design for our HTML elements, a design style which fits nicely with the likes of OOCSS, however be very clear that we are not adopting the OOCSS approach in its entirety. The high level abstraction of the visual aspects of elements into highly reusable agnostic classes does not always lend itself well to the Moodle world in which the we wish to be frontend framework agnostic and support largescale completely customisable themes.&amp;lt;br /&amp;gt;&lt;br /&gt;
The highly reusable classes that appeal to one designer, or to one frontend framework may not apply to another.&amp;lt;br /&amp;gt;&lt;br /&gt;
This decision is also impacted by our current default theme bootstrapbase that does not use well abstracted OOCSS in its design.&lt;br /&gt;
&lt;br /&gt;
Atomic design is going to see us end up with many parent child relationships in our HTML that we must carry through to our CSS. Through atomic design we start with smalled atoms and molecules that get built into larger organisms and placed within layouts.&lt;br /&gt;
&lt;br /&gt;
Every element should have a single class that identifies it as element X.&lt;br /&gt;
&lt;br /&gt;
For instance the button atom will have the class *m-element-button*&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button class=&amp;quot;m-element-button&amp;quot;&amp;gt;I am a button&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is simply the prefix &amp;quot;m-element&amp;quot; plus the element name.&lt;br /&gt;
&lt;br /&gt;
The purpose of this class is to allow the element to be styled with ease. The class name should be applied to the root node for the element, it should never be applied any lower.&lt;br /&gt;
&lt;br /&gt;
By having one class for the element, and always and only applied to the root node it makes it very easy in HTML to see where one element belongs to another.&lt;br /&gt;
&lt;br /&gt;
The following is an example of the search molecule, which in turn contains two button atoms.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to partially adopt BEM as a CSS standard when writing CSS for elements.&lt;br /&gt;
BEM isn&#039;t a new CSS standard, but its not widely known either. Its existence fills a gap in how to style elements consistently. Through two basic notation techniques you can easily notate the purpose of structures that belong to an element and notate the intent of an element that is desired if the element has multiple versions.&lt;br /&gt;
&lt;br /&gt;
; Notating purpose : Here we use a suffix *__purpose*, the key being the two underscores.&lt;br /&gt;
; Notating intent : Here we use a suffix *--intent*, the key being the two hyphens.&lt;br /&gt;
&lt;br /&gt;
You&#039;ll notice in the example above that there is no way to style the continue button differently from the cancel button without relying on its name, something we certainly don&#039;t want to do.&lt;br /&gt;
The solution is to wrap each button in a div and give each div a class.&lt;br /&gt;
The BEM standard comes into play here in naming the classes, the following shows how you would apply BEM to show the purpose of each button in a way that can be easily interpreted and styled in CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__cancel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__continue&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now each button is wrapped in a div with a class, *m-element-confirmation__cancel* and *m-element-confirmation__continue*.&lt;br /&gt;
This class can be read by the themer and because of the __ can be easily identified as both belonging to the m-element-confirmation and serving a specific purpose, continue or cancel.&lt;br /&gt;
&lt;br /&gt;
Now to explain the idea of intents.&lt;br /&gt;
An intent is when a single element takes on a different apprearance to convey a specific meaning. A little bit like a state, but with more meaning.&lt;br /&gt;
An easy example is notifications where you will no doubt be familiar with the idea of having a error notifications, warning notifications, success notification etc. Each of error, warning, and success is a intent.&lt;br /&gt;
&lt;br /&gt;
The following shows how this would work:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- A standard notification --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- A warning --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification m-element-notification--warning&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Grids&lt;br /&gt;
&lt;br /&gt;
We need to adopt a single grid framework.&lt;br /&gt;
&lt;br /&gt;
Personally I don&#039;t think we should use pure bootstrap or pure YUI, instead we should choose one of these and build it use our class name structures.&lt;br /&gt;
&lt;br /&gt;
All grid classes should start with m-grid.&lt;br /&gt;
&lt;br /&gt;
==Writing CSS==&lt;br /&gt;
&lt;br /&gt;
Before we begin lets lay down some ground level goals, things that will help us achieve clear and understandable CSS in the future.&lt;br /&gt;
* Formatting, ordering, alignment, and spacing are all important in having CSS that can be easily read by others.&lt;br /&gt;
* Don&#039;t optimise your CSS, be verbose and stick to the styles in this guide. We have tools that will handle optimisation for you.&lt;br /&gt;
* Never use *!important* in your CSS unless it is absolutely impossible to avoid doing so.&lt;br /&gt;
&lt;br /&gt;
===Terminology===&lt;br /&gt;
&lt;br /&gt;
Its important that when we are speaking about CSS we are speaking the same language.&lt;br /&gt;
Lets look at the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-page .m-selector-1,&lt;br /&gt;
.m-page .m-selector-2,&lt;br /&gt;
.m-page .m-selector-3 {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
    color: #000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-1 {&lt;br /&gt;
    margin: 1em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Ruleset : Each of the two rules is a single *ruleset*.&lt;br /&gt;
; Rule: _.m-page .m-selector-1_ is a rule.&lt;br /&gt;
; Selector : _.m-selector-1_ is a *selector*, it is a single part of a rule.&lt;br /&gt;
; Declaration : _background-color: #FFF_ is a declaration.&lt;br /&gt;
; &lt;br /&gt;
&lt;br /&gt;
===Essential formatting===&lt;br /&gt;
&lt;br /&gt;
The following are the guies for writing CSS.&lt;br /&gt;
&lt;br /&gt;
* Always use spaces - never use tabs. All editors can be configured to do it.&lt;br /&gt;
* Indent by 4 spaces - never more, never less.&lt;br /&gt;
* A single empty line between rulesets to maintain consistent spacing of rules.&lt;br /&gt;
* One rule per line.&lt;br /&gt;
* A single space between each selector in a rule.&lt;br /&gt;
* No space between a rule and the comma in a ruleset.&lt;br /&gt;
* A single space between a selector and the opening brace of a ruleset.&lt;br /&gt;
* One level of indentation before each declaration.&lt;br /&gt;
* A single space the colon in a declaration.&lt;br /&gt;
* A single space after each item in a declaration containing multiple items.&lt;br /&gt;
&lt;br /&gt;
The following shows how the above rules apply:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-selector-1,&lt;br /&gt;
.m-selector-2 .m-selector-3 {&lt;br /&gt;
    background: #ffa800 url(&amp;quot;background.png&amp;quot;) no-repeat right top;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    display: inline-block;&lt;br /&gt;
    font-family: arial, sans-serif;&lt;br /&gt;
    margin: 5px 10px;&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-4 {&lt;br /&gt;
    border-radius: 3px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General rules===&lt;br /&gt;
&lt;br /&gt;
Declaration ordering is the very first thing to discuss. There is no strict rule on how to order your declarations, however there is a recommendation.&lt;br /&gt;
We recommend that you order declarations within a ruleset alphabetically.&lt;br /&gt;
If we all start doing this then when you read CSS written by someone else you will soon learn to very quickly find your way around the declarations within a rule.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Recommended **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    color: #000;&lt;br /&gt;
    display: block;&lt;br /&gt;
    margin: 5px;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do not use a measurement unit when writing a 0 value.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use lowercase and shorthand values for colours.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #ffffff;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: white;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always quote variable values.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector[attr=&amp;quot;variable&amp;quot;] {&lt;br /&gt;
    background-image: url(&amp;quot;image.png&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector[attr=variable] {&lt;br /&gt;
    background-image: url(image.png);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Commenting===&lt;br /&gt;
&lt;br /&gt;
Always comment your CSS and Less.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Styles for the button atom.&lt;br /&gt;
 */&lt;br /&gt;
.m-element-button {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rules and exceptions for less===&lt;br /&gt;
&lt;br /&gt;
Need to write some guff on Less.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45892</id>
		<title>User:Sam Hemelryk/CSS style guidelines</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/CSS_style_guidelines&amp;diff=45892"/>
		<updated>2014-07-22T05:06:01Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: Share the love&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45830&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
==HTML and CSS style guide==&lt;br /&gt;
&lt;br /&gt;
This is a guide to writing CSS within Moodle.&lt;br /&gt;
&lt;br /&gt;
==Why have a strict guide==&lt;br /&gt;
&lt;br /&gt;
At the time of writing this CSS within Moodle (2.7) themes is in a poor state and has been for a long time. Without previously having a guide we were finding that:&lt;br /&gt;
&lt;br /&gt;
* As there was no formal guide to creating id&#039;s or classes, each developer does there own thing.&lt;br /&gt;
* As there was no formal guide on how to write CSS there were numerous techniques used when writing CSS and no consistency.&lt;br /&gt;
* Majority of pages create uniuqe output and require unique CSS, there is very little re-use of design.&lt;br /&gt;
&lt;br /&gt;
While those points may not sound bad to you consider that in following stats from Moodle 2.7 themes:&lt;br /&gt;
&lt;br /&gt;
* Base theme contains 3802 selectors with a total of 5800 styles.&lt;br /&gt;
* Bootstrapbase theme contains 5170 selectors with a total of 9362 styles.&lt;br /&gt;
* Clean theme contains 5172 selectors with a total of 9366 styles.&lt;br /&gt;
* More theme contains 5177 selectors with a total of 9063 styles.&lt;br /&gt;
&lt;br /&gt;
You get the picture, several thousand selectors containing nearly 10000 styles.&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.8 we commited to introducing a element library to aid the reuse of design and documenting all aspects of output including a guide on writing CSS for Moodle. This is that guide.&lt;br /&gt;
&lt;br /&gt;
==Our goals==&lt;br /&gt;
&lt;br /&gt;
Its very important to understand what we are trying to achieve with this style guide and output in general.&lt;br /&gt;
&lt;br /&gt;
; Frontend framework agnostic : We want theme designers to be able to apply present and future frontend frameworks to Moodle with minimal effort.&lt;br /&gt;
; Consistent interfaces : We want Moodle to have consistency throughout its interfaces, minimising the amount of frontend design and development that is required in coding and styling an interface.&lt;br /&gt;
; Cleanly formatted HTML and CSS : to minimise both development time and to make our renderers and CSS and more maintainable.&lt;br /&gt;
&lt;br /&gt;
We plan to faciliate these with the following:&lt;br /&gt;
; Elements : Highly re-usable objects to produce HTML, these will be used consistently and relied upon by developers creating interfaces. By having these elements we create a consistent look, interface creation will be much quicker and theme designers through the re-use of a limited number of elements.&lt;br /&gt;
; Element library : A tool to show samples of each element, this can be used to view and test designs. It aids the developer by showing them the elements they can select from when creating an interface, and it aids designers by giving them a test area that doesn&#039;t require them to dig through every page in Moodle.&lt;br /&gt;
; Documentation : We will now have proper documentation on all aspects of output. Including this CSS style guide, a renderer best practices guide, and a guide to creating elements.&lt;br /&gt;
&lt;br /&gt;
==Where to put CSS in Moodle core==&lt;br /&gt;
&lt;br /&gt;
CSS can reside in a number of locations depending upon what you are styling.&lt;br /&gt;
&lt;br /&gt;
Remember it doesn&#039;t matter how many CSS files we end up with, on a production site with Theme designer mode switched off (default) all CSS files will be combined and minimised into a single file that is served to the client.&lt;br /&gt;
Excepting the case of IE where we must split the CSS into several smaller files to work around browser limitations.&lt;br /&gt;
&lt;br /&gt;
===CSS for elements===&lt;br /&gt;
As we are moving to using elements you will find that CSS for elements is where most of the effort is going to go.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should reside within themes only, you will find that elements must be styled in all core base themes, this means at least Bootstrapbase and base.&lt;br /&gt;
&lt;br /&gt;
CSS for elements should be located within either &#039;&#039;&#039;theme/themename/style/elements/elementname.css&#039;&#039;&#039; or &#039;&#039;&#039;theme/themename/less/elements/elementname.css&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The actual CSS file should be named according to the element. As elements can be namespaced we need to ensure that that is reflected in the name of the file.&lt;br /&gt;
For instance:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Element&lt;br /&gt;
! CSS location in base&lt;br /&gt;
! CSS location in bootstrapbase&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\button&lt;br /&gt;
| style/elements/core_output_button.css&lt;br /&gt;
| less/moodle/elements/core_output_button.css&lt;br /&gt;
|-&lt;br /&gt;
| \core\output\navigation_bar&lt;br /&gt;
| style/elements/core_output_navigation_bar.css&lt;br /&gt;
| less/moodle/elements/core_output_navigation_bar.css&lt;br /&gt;
|-&lt;br /&gt;
| \mod_assign\output\user_submission&lt;br /&gt;
| style/elements/mod_assign_output_user_submission.css&lt;br /&gt;
| less/moodle/elements/mod_assign_output_user_submission.css&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These will still need to be included in the theme, by which ever means is relevant.&lt;br /&gt;
If you are using &#039;&#039;.css&#039;&#039; files like the base theme does then you will use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// In your themes config.php&lt;br /&gt;
$THEME-&amp;gt;sheets = array(&lt;br /&gt;
    &#039;elements/core_output_button&#039;,&lt;br /&gt;
    &#039;elements/core_output_navigation_bar&#039;,&lt;br /&gt;
    &#039;elements/mod_assign_output_user_submission&#039;&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are using less as bootstrapbase does then you will use:&lt;br /&gt;
&amp;lt;code CSS&amp;gt;&lt;br /&gt;
/** In your primary less file **/&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_button&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/core_output_navigation_bar&amp;quot;;&lt;br /&gt;
@import &amp;quot;moodle/elements/mod_assign_output_user_submission&amp;quot;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General CSS===&lt;br /&gt;
&lt;br /&gt;
This is CSS for the theme that doesn&#039;t relate to a specific element. Hopefully as we convert more and more of Moodles interfaces to use elements we should see less general CSS.&lt;br /&gt;
&lt;br /&gt;
In any case nothing has changed in regards to the location of general CSS.&lt;br /&gt;
; CSS : If your theme is using standard CSS then it must be located within the &#039;&#039;style&#039;&#039; directory of your theme and should be in logically separated files.&lt;br /&gt;
; Less : If your theme is using less then it should be located in a &#039;&#039;less/moodle&#039;&#039; directory within your theme.&lt;br /&gt;
&lt;br /&gt;
We recommend that you separate styles into files based upon the Moodle component being styled. Again as all CSS files get combined into a single file on production sites it doesn&#039;t matter how many files you end up with.&lt;br /&gt;
&lt;br /&gt;
This would lead to files named like:&lt;br /&gt;
* style/core.css&lt;br /&gt;
* style/course.css&lt;br /&gt;
* style/mod_forum.css&lt;br /&gt;
&lt;br /&gt;
===Where to put CSS in plugins===&lt;br /&gt;
&lt;br /&gt;
It is possible in Moodle to add CSS stylesheets to all plugins (including core plugins).&amp;lt;br /&amp;gt;&lt;br /&gt;
Moodle always looks for a &#039;&#039;styles.css&#039;&#039; file within your plugins directory, and it also looks for a styles_themename.css where themename is the name of the currect theme being used.&lt;br /&gt;
&lt;br /&gt;
For instance the following could be added to the forum module:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;mod/forum/styles.css&#039;&#039;: Used all the time.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_base.css&#039;&#039; : Used when the user is using the base theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_bootstrapbase.css&#039;&#039; : Used when the user is using the bootstrapbase theme.&lt;br /&gt;
* &#039;&#039;mod/forum/styles_clean.css&#039;&#039; : Used when the user is using the clean theme.&lt;br /&gt;
&lt;br /&gt;
==CSS in core plugins===&lt;br /&gt;
&lt;br /&gt;
For core plugins only styles.css is permitted and it should only ever contain styles essential to the presentation of the plugin.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present styles essential for the display of the plugin are allowed here, however when the plugin interfaces have been converted to use elements this file should be nearly empty and contain only the following:&lt;br /&gt;
* Images, icons and text used for visual presentation such as icons to notify state (expanded/collapsed, warnings...)&lt;br /&gt;
* Accessiblity orientated styles required to make the interface accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Under no circumstances should it contain any visual stylings such as border, rounded corners, and background colours not associated with state.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Writing HTML==&lt;br /&gt;
&lt;br /&gt;
The following sections detail rules in place for writing HTML.&lt;br /&gt;
&lt;br /&gt;
Before we start a couple of general recommendations:&lt;br /&gt;
&lt;br /&gt;
; Use hyphens rather than underscores when concatenating strings in attributes : for example &#039;&#039;.course-new-activity-chooser&#039;&#039; instead of &#039;&#039;.course_new_activity_chooser&#039;&#039;. By all doing this we will have a more consistent appearance and as We use underscores as part of frankenstyle which is prominent in CSS helps us to reduce the chance of naming conflicts.&lt;br /&gt;
; Think semantics - but don&#039;t get caught up in it : Semantic CSS is beautiful CSS lending itself ultimately to the redesign that is going to happen. But enforcing a semantic design can be an arduous journey. Instead we encourage semantic CSS but are happy to see non-semantic CSS when it is for the greater good.&lt;br /&gt;
&lt;br /&gt;
===Using the ID attribute===&lt;br /&gt;
&lt;br /&gt;
The situation of having a single JavaScript driven element was considered but even then it is better to style only classes and other attributes as we can&#039;t be sure what the future holds.&lt;br /&gt;
&lt;br /&gt;
There are three rules you should follow when creating an ID:&lt;br /&gt;
&lt;br /&gt;
# They should only be given to elements and HTML nodes that need to be interacted with by JavaScript.&lt;br /&gt;
# It should always start with &#039;&#039;&#039;m-&#039;&#039;&#039; &#039;&#039;(see note below)&#039;&#039;&lt;br /&gt;
# The actual ID should be descriptive of the node and contents as a whole unit. It must fully and concisely describe its purpose.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that in an ideal world ID&#039;s should not be used for styling.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Good&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-course-new-activity-chooser&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bad&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
It doesn&#039;t have the m- prefix&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;dock&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
This may appear OK at first but when you think about it selecting an activity within Moodle&lt;br /&gt;
is something that is done in multiple places and the this widget may not be applicable to&lt;br /&gt;
every place, as there may be other activity selector JS one day introduced having a&lt;br /&gt;
more complete ID is important&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;m-activity-selector&amp;quot;&amp;gt; ... &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The requirement to use m- prefix is entirely new, this has been created as this instantly reduces the chances of conflicting with present and future frontend frameworks that may be adopted by core or third party themes. Aiding our goal of being frontend framework agnostic.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will also help reduce the chance of conflicts in any third party code that may be used either by us in core, or by outside developers in their own code.&lt;br /&gt;
Moodle ID&#039;s will also be much more easily recognisable which we expect will be a benefit as JavaScript use in Moodle continues to increase.&lt;br /&gt;
&lt;br /&gt;
===Naming CSS classes===&lt;br /&gt;
&lt;br /&gt;
This is where a bit of organisation goes a long way and we want to be reasonably thorough in a consistent naming scheme and implementation.&lt;br /&gt;
&lt;br /&gt;
The very first thing to mention is that all classes in Moodle must now be prefixed by *m-*.&lt;br /&gt;
This instantly identifes a class as belonging to Moodle, it aids us in avoiding conflicts with any non-Moodle css that may be loaded, and it is part of our framework agnostic plan.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
All CSS classes must start with *m-*&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are several prefix that are used within Moodle output now that should not be used as prefixs for classes unless they are serving the desired purpose.&lt;br /&gt;
&lt;br /&gt;
Reserved prefixes are:&lt;br /&gt;
&lt;br /&gt;
; m-element : Prefix used on element classes, where m-element preceeds the name of the element, e.g. m-element-button, m-element-search&lt;br /&gt;
; m-state : Prefix used for CSS classes representing the state of an item, e.g. m-state-disabled, m-state-active, m-state-expanded.&lt;br /&gt;
; m-grid : Prefix used for creating HTML grids.&lt;br /&gt;
&lt;br /&gt;
====Elements&lt;br /&gt;
&lt;br /&gt;
Semantic design where it gives the best result, smart design where there is a better solution.&lt;br /&gt;
&lt;br /&gt;
If you&#039;re not already familiar with the idea of semantic CSS then Chris Coylers artical [http://css-tricks.com/semantic-class-names/ What makes for a semantic class name] is a great starting point.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve not commit to adopting any one strict approach for writing CSS. We have adopted atomic design for our HTML elements, a design style which fits nicely with the likes of OOCSS, however be very clear that we are not adopting the OOCSS approach in its entirety. The high level abstraction of the visual aspects of elements into highly reusable agnostic classes does not always lend itself well to the Moodle world in which the we wish to be frontend framework agnostic and support largescale completely customisable themes.&amp;lt;br /&amp;gt;&lt;br /&gt;
The highly reusable classes that appeal to one designer, or to one frontend framework may not apply to another.&amp;lt;br /&amp;gt;&lt;br /&gt;
This decision is also impacted by our current default theme bootstrapbase that does not use well abstracted OOCSS in its design.&lt;br /&gt;
&lt;br /&gt;
Atomic design is going to see us end up with many parent child relationships in our HTML that we must carry through to our CSS. Through atomic design we start with smalled atoms and molecules that get built into larger organisms and placed within layouts.&lt;br /&gt;
&lt;br /&gt;
Every element should have a single class that identifies it as element X.&lt;br /&gt;
&lt;br /&gt;
For instance the button atom will have the class *m-element-button*&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button class=&amp;quot;m-element-button&amp;quot;&amp;gt;I am a button&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is simply the prefix &amp;quot;m-element&amp;quot; plus the element name.&lt;br /&gt;
&lt;br /&gt;
The purpose of this class is to allow the element to be styled with ease. The class name should be applied to the root node for the element, it should never be applied any lower.&lt;br /&gt;
&lt;br /&gt;
By having one class for the element, and always and only applied to the root node it makes it very easy in HTML to see where one element belongs to another.&lt;br /&gt;
&lt;br /&gt;
The following is an example of the search molecule, which in turn contains two button atoms.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We&#039;ve chosen to partially adopt BEM as a CSS standard when writing CSS for elements.&lt;br /&gt;
BEM isn&#039;t a new CSS standard, but its not widely known either. Its existence fills a gap in how to style elements consistently. Through two basic notation techniques you can easily notate the purpose of structures that belong to an element and notate the intent of an element that is desired if the element has multiple versions.&lt;br /&gt;
&lt;br /&gt;
; Notating purpose : Here we use a suffix *__purpose*, the key being the two underscores.&lt;br /&gt;
; Notating intent : Here we use a suffix *--intent*, the key being the two hyphens.&lt;br /&gt;
&lt;br /&gt;
You&#039;ll notice in the example above that there is no way to style the continue button differently from the cancel button without relying on its name, something we certainly don&#039;t want to do.&lt;br /&gt;
The solution is to wrap each button in a div and give each div a class.&lt;br /&gt;
The BEM standard comes into play here in naming the classes, the following shows how you would apply BEM to show the purpose of each button in a way that can be easily interpreted and styled in CSS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;form class=&amp;quot;m-element-confirmation&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;h3&amp;gt;Are you sure?&amp;lt;/h3&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;Are you sure you want to perform this action?&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__cancel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;cancel&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Cancel&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;m-element-confirmation__continue&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;input type=&amp;quot;submit&amp;quot; name=&amp;quot;continue&amp;quot; class=&amp;quot;m-element-button&amp;quot; value=&amp;quot;Continue&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now each button is wrapped in a div with a class, *m-element-confirmation__cancel* and *m-element-confirmation__continue*.&lt;br /&gt;
This class can be read by the themer and because of the __ can be easily identified as both belonging to the m-element-confirmation and serving a specific purpose, continue or cancel.&lt;br /&gt;
&lt;br /&gt;
Now to explain the idea of intents.&lt;br /&gt;
An intent is when a single element takes on a different apprearance to convey a specific meaning. A little bit like a state, but with more meaning.&lt;br /&gt;
An easy example is notifications where you will no doubt be familiar with the idea of having a error notifications, warning notifications, success notification etc. Each of error, warning, and success is a intent.&lt;br /&gt;
&lt;br /&gt;
The following shows how this would work:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- A standard notification --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- A warning --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;m-element-notification m-element-notification--warning&amp;quot;&amp;gt;You have not changed your password in the past 60 days&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Grids&lt;br /&gt;
&lt;br /&gt;
We need to adopt a single grid framework.&lt;br /&gt;
&lt;br /&gt;
Personally I don&#039;t think we should use pure bootstrap or pure YUI, instead we should choose one of these and build it use our class name structures.&lt;br /&gt;
&lt;br /&gt;
All grid classes should start with m-grid.&lt;br /&gt;
&lt;br /&gt;
==Writing CSS==&lt;br /&gt;
&lt;br /&gt;
Before we begin lets lay down some ground level goals, things that will help us achieve clear and understandable CSS in the future.&lt;br /&gt;
* Formatting, ordering, alignment, and spacing are all important in having CSS that can be easily read by others.&lt;br /&gt;
* Don&#039;t optimise your CSS, be verbose and stick to the styles in this guide. We have tools that will handle optimisation for you.&lt;br /&gt;
* Never use *!important* in your CSS unless it is absolutely impossible to avoid doing so.&lt;br /&gt;
&lt;br /&gt;
===Terminology===&lt;br /&gt;
&lt;br /&gt;
Its important that when we are speaking about CSS we are speaking the same language.&lt;br /&gt;
Lets look at the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-page .m-selector-1,&lt;br /&gt;
.m-page .m-selector-2,&lt;br /&gt;
.m-page .m-selector-3 {&lt;br /&gt;
    background-color: #FFF;&lt;br /&gt;
    color: #000;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-1 {&lt;br /&gt;
    margin: 1em;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Ruleset : Each of the two rules is a single *ruleset*.&lt;br /&gt;
; Rule: _.m-page .m-selector-1_ is a rule.&lt;br /&gt;
; Selector : _.m-selector-1_ is a *selector*, it is a single part of a rule.&lt;br /&gt;
; Declaration : _background-color: #FFF_ is a declaration.&lt;br /&gt;
; &lt;br /&gt;
&lt;br /&gt;
===Essential formatting===&lt;br /&gt;
&lt;br /&gt;
The following are the guies for writing CSS.&lt;br /&gt;
&lt;br /&gt;
* Always use spaces - never use tabs. All editors can be configured to do it.&lt;br /&gt;
* Indent by 4 spaces - never more, never less.&lt;br /&gt;
* A single empty line between rulesets to maintain consistent spacing of rules.&lt;br /&gt;
* One rule per line.&lt;br /&gt;
* A single space between each selector in a rule.&lt;br /&gt;
* No space between a rule and the comma in a ruleset.&lt;br /&gt;
* A single space between a selector and the opening brace of a ruleset.&lt;br /&gt;
* One level of indentation before each declaration.&lt;br /&gt;
* A single space the colon in a declaration.&lt;br /&gt;
* A single space after each item in a declaration containing multiple items.&lt;br /&gt;
&lt;br /&gt;
The following shows how the above rules apply:&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
.m-selector-1,&lt;br /&gt;
.m-selector-2 .m-selector-3 {&lt;br /&gt;
    background: #ffa800 url(&amp;quot;background.png&amp;quot;) no-repeat right top;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    display: inline-block;&lt;br /&gt;
    font-family: arial, sans-serif;&lt;br /&gt;
    margin: 5px 10px;&lt;br /&gt;
    padding: 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.m-selector-4 {&lt;br /&gt;
    border-radius: 3px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===General rules===&lt;br /&gt;
&lt;br /&gt;
Declaration ordering is the very first thing to discuss. There is no strict rule on how to order your declarations, however there is a recommendation.&lt;br /&gt;
We recommend that you order declarations within a ruleset alphabetically.&lt;br /&gt;
If we all start doing this then when you read CSS written by someone else you will soon learn to very quickly find your way around the declarations within a rule.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Recommended **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
    border: 1px solid #000;&lt;br /&gt;
    color: #000;&lt;br /&gt;
    display: block;&lt;br /&gt;
    margin: 5px;&lt;br /&gt;
    padding: 5px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Do not use a measurement unit when writing a 0 value.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    margin: 5px 0px;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use lowercase and shorthand values for colours.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #fff;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #ffffff;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: #FFFFFF;&lt;br /&gt;
}&lt;br /&gt;
.m-selector {&lt;br /&gt;
    background-color: white;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Always quote variable values.&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/** Good **/&lt;br /&gt;
.m-selector[attr=&amp;quot;variable&amp;quot;] {&lt;br /&gt;
    background-image: url(&amp;quot;image.png&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/** Bad **/&lt;br /&gt;
.m-selector[attr=variable] {&lt;br /&gt;
    background-image: url(image.png);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Commenting===&lt;br /&gt;
&lt;br /&gt;
Always comment your CSS and Less.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Styles for the button atom.&lt;br /&gt;
 */&lt;br /&gt;
.m-element-button {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Rules and exceptions for less===&lt;br /&gt;
&lt;br /&gt;
Need to write some guff on Less.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Developer_meeting_July_2014&amp;diff=45790</id>
		<title>Developer meeting July 2014</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Developer_meeting_July_2014&amp;diff=45790"/>
		<updated>2014-07-14T02:44:35Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Developer meetings]] &amp;gt; July 2014 meeting notes&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Time&lt;br /&gt;
| [http://timeanddate.com/worldclock/fixedtime.html?year=2014&amp;amp;month=7&amp;amp;day=22&amp;amp;hour=13&amp;amp;min=0&amp;amp;sec=0 13:00 UTC on Tuesday, 22 July 2014]&lt;br /&gt;
|-&lt;br /&gt;
| Meeting room&lt;br /&gt;
| [http://www.youtube.com/user/moodlehq/videos Moodle HQ YouTube channel]&lt;br /&gt;
|-&lt;br /&gt;
| Chat&lt;br /&gt;
| [https://moodle.org/local/chatlogs/info.php Regular Dev chat]&lt;br /&gt;
|-&lt;br /&gt;
| Twitter&lt;br /&gt;
| [https://twitter.com/search?q=%23moodledev #moodledev]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This meeting will focus on development happening outside of Moodle HQ&lt;br /&gt;
&lt;br /&gt;
The meeting was streamed live on YouTube with chat through the regular Dev chat room and comments on Twitter.&lt;br /&gt;
&lt;br /&gt;
== Agenda ==&lt;br /&gt;
* Invited speaker from community.&lt;br /&gt;
* Progress on Moodle 2.8&lt;br /&gt;
** Prototypes&lt;br /&gt;
** Gradebook changes&lt;br /&gt;
** Output plan (Sam Hemelryk/Damyon perhaps?)&lt;br /&gt;
* ???&lt;br /&gt;
&lt;br /&gt;
If you have something you&#039;d like to add to this page, please [https://docs.moodle.org/dev/index.php?title=Developer_meeting_July_2014&amp;amp;action=edit edit this page] or contact [http://moodle.org/user/profile.php?id=381842 Michael d].&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Renderer_best_practices&amp;diff=45621</id>
		<title>User:Sam Hemelryk/Renderer best practices</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Renderer_best_practices&amp;diff=45621"/>
		<updated>2014-07-06T22:15:37Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45853&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
&lt;br /&gt;
This page documents renderer best practices.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&lt;br /&gt;
* Must mention atomic design and how the concept of &amp;quot;templates&amp;quot; should be applied. Relates to the next note. A forth method type for renderers?&lt;br /&gt;
* Within a component or plugin that has a renderer use the renderer for EVERYTHING within that area. [https://moodle.org/mod/forum/discuss.php?d=262817#p1138926 forum post that ignited this]&lt;br /&gt;
* Reference and probably copy the three render methods from [Guide to creating output elements]&lt;br /&gt;
&lt;br /&gt;
==Renderer best practices==&lt;br /&gt;
&lt;br /&gt;
This document discusses the recommended practises to follow when writing renderers for Moodle. It was created in Moodle 2.8 as part of the element library specification that took place.&lt;br /&gt;
&lt;br /&gt;
Renderers provide an abstraction of logic and display. They serve Moodle to both encourage us to properly structure our code and to provide a means by which themes can take control of output to completely customise the look of Moodle.&lt;br /&gt;
Elements and the element library provide us a set of building blocks to use when creating output. These provide us a consistent and manageable look that also minimising the amount of customisation required by a theme to change the look and feel of Moodle.&lt;br /&gt;
Here we make a recommendation on how to write renderers to maximise the benefits to both yourself as a developer and to designers who have to customise the interfaces you create.&lt;br /&gt;
&lt;br /&gt;
==Goals==&lt;br /&gt;
&lt;br /&gt;
Its important to understand the goals for output before you start looking at renderers as they are just one part of the output plan.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output in Moodle is designed to:&#039;&#039;&#039;&lt;br /&gt;
* Aid developers in properly abstracting output from logic.&lt;br /&gt;
* Allow designers to take complete control of output from within a theme if they wish.&lt;br /&gt;
* Provide a consisten look and feel for Moodle user.&lt;br /&gt;
* Allow developers to more rapidly create interfaces by having a set of elements at their finger tips.&lt;br /&gt;
* Minimise the efforts designers must extrude in order to customise the look and feel of Moodle by limiting the output to a set of elements.&lt;br /&gt;
* Aid designers by providing tools to support styling Moodle such as the element library.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Renderers in Moodle:&#039;&#039;&#039;&lt;br /&gt;
* Are the link between Moodle and a theme through which all output is generated.&lt;br /&gt;
* Are organised for the benefit of designers, and should be written following this document.&lt;br /&gt;
* Most importantly allow designers to override the HTML that wraps the data being displayed in turn allowing designers to re-design output in a theme.&lt;br /&gt;
* Allow designers to change the information being displayed by providing not just what is initially required but that which that may require.&lt;br /&gt;
&lt;br /&gt;
==A simple set of rules for a good renderer==&lt;br /&gt;
&lt;br /&gt;
Summarising what will be discussed further in this document a good renderer can be summarised as:&lt;br /&gt;
&lt;br /&gt;
* Think in elements. We have an element library, when planning the output for your plugin/component start with the elements in the element library and the markup they provide.&lt;br /&gt;
* Containing only methods confroming to the four method types discussed below.&lt;br /&gt;
* Encapsulated data is given, maximising the information available to the renderer and minimising the number of arguments.&lt;br /&gt;
* Free of logic relating to anything except output. This includes not calculating the likes of links and capabilities.&lt;br /&gt;
* Uses helper methods to manipulate data where manipulate is absolutely required, essentially abstracting logic to conform to the above rule.&lt;br /&gt;
* Utilise the core elements as much as is possible.&lt;br /&gt;
* Recognise unique output needs and create element(s) for it.&lt;br /&gt;
* The render method should be used as often as possible to maximise consistent look.&lt;br /&gt;
&lt;br /&gt;
==The don&#039;ts==&lt;br /&gt;
&lt;br /&gt;
The following are things that should not be done within a renderer.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DO NOT:&#039;&#039;&#039;&lt;br /&gt;
* design interfaces from scratch when desiging output for your plugin/component. Always start with the elements found in the element library.&lt;br /&gt;
* Use logic that isn&#039;t essential to producing output. This includes but is not limited to the following:&lt;br /&gt;
** Database interaction of any kind.&lt;br /&gt;
** Access or capability checks.&lt;br /&gt;
** Generation of data such as producing URL&#039;s, that should be owned by the plugin/component and made available preferably through the given arguments or failing that through a helper method.&lt;br /&gt;
* Generate HTML for something that should be an element, convert it to an element and call render on it.&lt;br /&gt;
* Create custom elements for everything you plan to output, instead try to maximise the core elements that you use.&lt;br /&gt;
* Write your own render methods for subelements of the elements you create. Only do this if you absolutely must change the markup from that produced by the natural render method for the element.&lt;br /&gt;
&lt;br /&gt;
==Creating a renderer==&lt;br /&gt;
&lt;br /&gt;
===Location and naming===&lt;br /&gt;
As of Moodle 2.8 renderers can be put into the output namespace. This is the recommended placement for Renderers in Moodle 2.8 and up, however the alternatives will also be listed here.&lt;br /&gt;
&lt;br /&gt;
Recommended:&lt;br /&gt;
* Put your renderer in &#039;&#039;&#039;mod/yourplugin/output/renderer.php&#039;&#039;&#039; use the namespace &#039;&#039;&#039;mod_yourplugin\output&#039;&#039;&#039; and call your class &#039;&#039;&#039;renderer&#039;&#039;&#039;.&lt;br /&gt;
* To get an instance of your renderer &#039;&#039;$PAGE-&amp;gt;get_renderer(&#039;mod_yourplugin&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This is how mod/yourplugin/output/renderer.php will look:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
namespace mod_yourplugin\output;&lt;br /&gt;
&lt;br /&gt;
class renderer extends \plugin_renderer_base {&lt;br /&gt;
    // Your renderer methods in here.&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also available but not recommended:&lt;br /&gt;
* Put your renderer in &#039;&#039;&#039;mod/yourplugin/renderer.php&#039;&#039;&#039; do NOT namespace it, and call your class &#039;&#039;&#039;mod_yourplugin_renderer&#039;&#039;&#039;.&lt;br /&gt;
* To get an instance of your renderer &#039;&#039;$PAGE-&amp;gt;get_renderer(&#039;mod_yourplugin&#039;)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This was how things were done in earlier versions of Moodle (2.7 and below).&lt;br /&gt;
&lt;br /&gt;
===Render methods===&lt;br /&gt;
&lt;br /&gt;
Renderers can be well structured, the purpose of them is the same across all plugins and components.&lt;br /&gt;
There are four distinct types of render methods that you can expect to find in a renderer, and these four can be categorised into one of two categories.&lt;br /&gt;
&lt;br /&gt;
The four types of render methods:&lt;br /&gt;
# Layout methods&lt;br /&gt;
# Translator methods&lt;br /&gt;
# Render methods&lt;br /&gt;
# Convenience methods&lt;br /&gt;
&lt;br /&gt;
These four methods can then be categorised in two ways:&lt;br /&gt;
; Plugin|Component method : The layout and translator methods are plugin or component methods. They take data for a plugin or component and meld it into renderables. These methods relate to and can be said to be owned by the plugin or component. &lt;br /&gt;
; Element methods :  The render and convenience methods relate only to elements. They take already encapsulated abstracted data and simply output HTML structure around it. They pay no regard to the plugin or component and are completely and solely bound to the output of an element.&lt;br /&gt;
&lt;br /&gt;
====Layout methods====&lt;br /&gt;
&lt;br /&gt;
====Translator methods====&lt;br /&gt;
&lt;br /&gt;
====Render methods====&lt;br /&gt;
If you&#039;ve spent any time working with renderers in the past you will already be familiar with the concept of a render method.&lt;br /&gt;
All elements within Moodle inherit the renderable interface. To produce output for them you call the renderers render method and give the element.&lt;br /&gt;
The render method looks at what is given and looks &lt;br /&gt;
&lt;br /&gt;
====Convenience methods====&lt;br /&gt;
These are very simple. A convenience method is simply an easy way to build and output an element in a single step.&lt;br /&gt;
If you take an element, likely an atom or molecule, a convenience method would have the same arguments as the constructor for the element, build an instance of the element and call render on it.&lt;br /&gt;
The following is a simple example using heading:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A convenience method to render a heading.&lt;br /&gt;
 */&lt;br /&gt;
public function heading($content, $level = 2) {&lt;br /&gt;
    $heading = new \core\output\heading($content, $level);&lt;br /&gt;
    return $this-&amp;gt;render($heading);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating output elements==&lt;br /&gt;
This is a big field and as such a dedicated document has been writen as a [[Guide to creating output elements]].&lt;br /&gt;
&lt;br /&gt;
==Tips on properly structuring your plugin==&lt;br /&gt;
Talk here about OO structuring of code, ensuring a traversable heirarchy that enables maximum movement of code structure to obtain data and in turn minimises necessary arguments for layout methods.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Render library specification]]&lt;br /&gt;
* [[Guide to creating output elements]]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=261202 Render library specification discussion]&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Render_library_element_planning&amp;diff=45560</id>
		<title>User:Sam Hemelryk/Render library element planning</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Render_library_element_planning&amp;diff=45560"/>
		<updated>2014-06-27T02:06:17Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* User content */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45829&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
This page documents the proposed core elements, variations of them, what we expect they will contain, and the core_renderer block.&lt;br /&gt;
&lt;br /&gt;
==The user action==&lt;br /&gt;
&lt;br /&gt;
An action in this sense is a collection of data that all pertains to one action that can be taken by the user.&lt;br /&gt;
The action, once populated with data can be rendered as is required for the job it is going to fulfil, usually with some relation to the frontend framework in use.&lt;br /&gt;
In this way the action could be a link, or a button; it could even be interpreted into a more complex structure.&lt;br /&gt;
&lt;br /&gt;
An action has the following properties:&lt;br /&gt;
; content [string]: text content for the link or button.&lt;br /&gt;
; url [moodle_url] : the url for the action to take when the user interacts with this action.&lt;br /&gt;
; description : a description of the action. Typically used within a title or alt attribute.&lt;br /&gt;
; active : True if this is the action the user is current performing.&lt;br /&gt;
; enabled : True if the action is possible, false if it is not possible and should be shown as disabled.&lt;br /&gt;
; dimmed : True if the action should be shown as dimmed, usually used to the action is hidden to other users.&lt;br /&gt;
; method : The preferred method of submitting this action, typically GET but can be set to POST.&lt;br /&gt;
&lt;br /&gt;
It is also possible to add JavaScript actions (component_action objects) to an action. These attach a JS listener to the action that gets executed when the user interacts with the action.&lt;br /&gt;
Attached JavaScript actions get initialised when the properties for the action are retrieved so any events must be attached BEFORE the action is rendered, and all renderers must ensure they use the get_attributes() call. &lt;br /&gt;
&lt;br /&gt;
==Grids==&lt;br /&gt;
&lt;br /&gt;
We need to come up with some way to include grids in core, it is desirable to keep it framework agnostic so perhaps a grid object that allows for items to be added and a &amp;quot;width&amp;quot; specified when that occurs. The width would be either a fixed number or a percentage. Steps of 12 seems pretty common.&lt;br /&gt;
&lt;br /&gt;
==Design requirements==&lt;br /&gt;
The following concepts need to be accounted for in core, or decisions made on how we choose to support these and where.&lt;br /&gt;
&lt;br /&gt;
===Clearfix===&lt;br /&gt;
We have this in core already, bootstrap has it, pretty much every front end framework has it.&lt;br /&gt;
Clearfix is more of a design decision, should only be used when require, and only ever applied by a renderer.&lt;br /&gt;
This gets special mention as being important, support is already 100%.&lt;br /&gt;
&lt;br /&gt;
===Floats===&lt;br /&gt;
Pull left, pull right etc. These are a design decisions and should be implemented by the renderer. Bootstrap caters for these and as such they will be easily catered for in bootstrapbase, however work may be required to get them operational in base.&lt;br /&gt;
&lt;br /&gt;
==Discarded ideas==&lt;br /&gt;
The following things are ideas that came up during discussions on what elements are, and what elements we want in core that have being discarded.&lt;br /&gt;
&lt;br /&gt;
==Core atoms, molecules, and organisms==&lt;br /&gt;
&lt;br /&gt;
The following is the atoms, molecules and organisms we believe should be created initially. Of course there will be many more that are required - however this should give us a good grounding of elements to work with for the first conversions.&lt;br /&gt;
&lt;br /&gt;
===Action {atom}===&lt;br /&gt;
See the section above about [[#The user action]]&lt;br /&gt;
&lt;br /&gt;
Actions are special atoms the represent an action the user can make.&lt;br /&gt;
They can be rendered by a theme as a link, a button or I suppose anything else.&lt;br /&gt;
There should be a default for when it is not specified and the renderer in change of producing the current thing can decide whether to use the default and just call &#039;&#039;render&#039;&#039; or if it requires something specific &#039;&#039;render_link&#039;&#039; or &#039;&#039;render_button&#039;&#039; as required.&lt;br /&gt;
&lt;br /&gt;
===Action group {molecule}===&lt;br /&gt;
A group of actions, to be rendered to reflect a relation. I suppose the easiest way to think about this is how buttons in the atto editor are grouped together. It is a requirement that may seem a tad absrtracted and irrelevant at first but I think will pop up in several places throughout Moodle when we start converting.&lt;br /&gt;
&lt;br /&gt;
It is basically a collection of actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#buttonGroups Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/components/#btn-groups Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/button_groups.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
===Block {atom}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle. This represents a block on the page, and is displayed within a [[#Block region]].&lt;br /&gt;
It accepts two arguments, the first is a &#039;&#039;block_contents&#039;&#039; object instance, and the second is the region name the block instance is being shown within.&lt;br /&gt;
&lt;br /&gt;
At present a block is rendered using the &#039;&#039;&#039;&#039;&#039;core_render::block&#039;&#039;&#039;&#039;&#039; method. Internally this calls several renderer methods to produce the different parts of a block.&lt;br /&gt;
* core_renderer::block_header - Produces a header&lt;br /&gt;
** core_renderer::block_controls - Produces controls to display within the header.&lt;br /&gt;
* core_renderer::block_content - Produces the actual content of the block.&lt;br /&gt;
** core_renderer::block_controls - Used to check if block controls were rendered. PUKE!!!&lt;br /&gt;
** core_renderer::block_footer - Produces a footer that actually resides within the content.&lt;br /&gt;
* core_renderer::block_annotation - Produces an annotation, used VERY rarely.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output when called for a navigation block with a bit of extra added to show how a footer is displayed and an annotation.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#sb-1&amp;quot; class=&amp;quot;skip-block&amp;quot;&amp;gt;Skip Navigation&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;inst4&amp;quot; class=&amp;quot;block_navigation  block&amp;quot; role=&amp;quot;navigation&amp;quot; data-block=&amp;quot;navigation&amp;quot; data-instanceid=&amp;quot;4&amp;quot; aria-labelledby=&amp;quot;instance-4-header&amp;quot; data-dockable=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;block_action&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;!-- Block actions go here, they are images with JS or anchors--&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;h2 id=&amp;quot;instance-4-header&amp;quot;&amp;gt;Navigation&amp;lt;/h2&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;content&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;!-- Block content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;div class=&amp;quot;footer&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;!-- Block footer content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;blockannotation&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Block annotation content goes here --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;sb-1&amp;quot; class=&amp;quot;skip-block-to&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Block region {molecule}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle, the block region is a contain for all of the blocks in one location.&lt;br /&gt;
We currently have two methods that produce a block region within Moodle, the first is &#039;&#039;&#039;&#039;&#039;core_renderer::blocks_for_region&#039;&#039;&#039;&#039;&#039; which adds no surrounding content.&lt;br /&gt;
The preferred method &#039;&#039;&#039;&#039;&#039;core_renderer::blocks&#039;&#039;&#039;&#039;&#039; adds some embedded information to a common structure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the structure of the &#039;&#039;core_renderer::blocks()&#039;&#039; method.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function blocks($region, $classes = array(), $tag = &#039;aside&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following is the html output is $region was &#039;&#039;pre&#039;&#039; and the default tag and classes were used.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot; data-blockregion=&amp;quot;pre&amp;quot; data-droptarget=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Thoughts on this&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The blocks method is a convenience method and serves an important purpose. However it should not take classes and tag as arguments.&amp;lt;br /&amp;gt;&lt;br /&gt;
These should certainly only settable within the renderer itself, and if themes wish to change this without wrapping the call they should override the renderer.&lt;br /&gt;
&lt;br /&gt;
Both the data attributes relate to servicing JavaScript functionality. Perhaps they should be moved to a component_action or somehow else integrated with JS rather than with the renderer directly.&lt;br /&gt;
&lt;br /&gt;
Internally it is calling blocks for region, however this should change it should request a array of blocks, convert the array to [[#Block]] elements and call render on each.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Proposed HTML structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Much like the current structure but with the data attributes coming through a JS mechanism.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Breadcrumb {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently called the navbar within Moodle, controlled by the &#039;&#039;&#039;&#039;&#039;navbar&#039;&#039;&#039;&#039;&#039; class located in lib/navigationlib.php and rendered by &#039;&#039;&#039;&#039;&#039;core_renderer::navbar()&#039;&#039;&#039;&#039;&#039;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Internally it calls moodle_page-&amp;gt;navbar-&amp;gt;get_items() to get an array containing navigation node items to display in the navigation bar.&amp;lt;br /&amp;gt;&lt;br /&gt;
It produces a bit of surrounding structure before calling render on each item.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following shows the structure for two items in the navigation bar presently within Moodle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;Page path&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;nav class=&amp;quot;breadcrumb-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/nav&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the excessive amount of markup to make the separator accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#breadcrumbs Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#breadcrumbs Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/breadcrumbs.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The currently active page should be marked with a class.&lt;br /&gt;
* The current item should probably not be a link MDL-46037&lt;br /&gt;
* [http://www.w3.org/TR/2007/WD-aria-role-20070601/#breadcrumbs wia-aria breadcrumb role]&lt;br /&gt;
* The divider perhaps could come through CSS with these changes to avoid markup necessary to make it accessible (in combination with the above).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation thoughts&#039;&#039;&#039;&lt;br /&gt;
* Owns an array of [#Action {atoms}]&lt;br /&gt;
&lt;br /&gt;
===Buttons {atom}===&lt;br /&gt;
&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&amp;lt;br /&amp;gt;&lt;br /&gt;
Obviously buttons can serve different purposes and roles so have several easily reachable customisations is probably a wise idea.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
None, presently you produce a button when you need it so there are several throughout Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/base-css.html#buttons Bootstrap 2.3.2] and [http://getbootstrap.com/css/#buttons Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;btn btn-default&amp;quot;&amp;gt;Default&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;btn btn-default btn-lg active&amp;quot; role=&amp;quot;button&amp;quot;&amp;gt;Link&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;input class=&amp;quot;btn btn-default&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Input&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Bootstrap:&lt;br /&gt;
* Purposes: default, primary, success, info, warning, danger, link&lt;br /&gt;
* Sizes: large, default, small, extra-small&lt;br /&gt;
* Block level (wider)&lt;br /&gt;
* States: Active, disabled.&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/buttons.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;button&amp;quot;&amp;gt;Default Button&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Zurb Foundation:&lt;br /&gt;
* Purposes: default, secondary, success, alert&lt;br /&gt;
* Sizes: large, default, small, tiny&lt;br /&gt;
* Corner style: radius, round&lt;br /&gt;
* Expanded (wider)&lt;br /&gt;
* States: disabled&lt;br /&gt;
&lt;br /&gt;
===Calendar {organism}===&lt;br /&gt;
&lt;br /&gt;
A simple idea really, apparently not already covered by the frontend frameworks being referenced during the creation of the doc.&lt;br /&gt;
The display of the calendar is fixed, but it can contain content for each day shown.&lt;br /&gt;
&lt;br /&gt;
The calendar should have several views, perhaps these are separate organisms, perhaps not.&lt;br /&gt;
&lt;br /&gt;
* Compact month&lt;br /&gt;
* Month&lt;br /&gt;
* Week&lt;br /&gt;
* Day&lt;br /&gt;
&lt;br /&gt;
Each day could:&lt;br /&gt;
* Contain an action with an icon for events, and link to the fullday display.&lt;br /&gt;
* Have an associated action to load and display the events in a tooltip.&lt;br /&gt;
&lt;br /&gt;
===Collapsible region {molecule}===&lt;br /&gt;
&lt;br /&gt;
We use these in several places within Moodle. I could not find a reference to this concept in any of the frontend frameworks I looked at.&lt;br /&gt;
The concept is simple - you have a heading and an icon with content. By default the content is hidden, when the user clicks the heading and/or the icon the content is revealed.&lt;br /&gt;
&lt;br /&gt;
As noted we do this in several places within Moodle, it would be good to have a single way of displaying this idea of a collapsible region.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
* It should support an optional collapse/expand all trigger action.&lt;br /&gt;
* We want to be able to use it both inside and outside of forms.&lt;br /&gt;
* It should be usable in situations like the combo list frontpage component as well.&lt;br /&gt;
* Will obviously have a JS component as without JS it would not work.&lt;br /&gt;
&lt;br /&gt;
===Confirmation {molecule}===&lt;br /&gt;
&lt;br /&gt;
A simple concept used regularly in Moodle to confirm a users intention to perform an actions. Most commonly seeing when deleting content.&lt;br /&gt;
The structure is relatively basic in Moodle at present.&lt;br /&gt;
* A message&lt;br /&gt;
* A forwards button&lt;br /&gt;
* A back button&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The method &#039;&#039;&#039;&#039;&#039;core_renderer::confirm&#039;&#039;&#039;&#039;&#039; does the rendering at present. Its signature is as follows:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function confirm($message, $continue, $cancel);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output it produces is like:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;generalbox&amp;quot; id=&amp;quot;notice&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;The message goes here&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Two buttons produced by core_renderer::render_single_button() --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design throughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This component does not have a title. I believe at present some pages use &#039;&#039;core_renderer::heading&#039;&#039; to produce a title if they wish. Obviously we want consistency of style so I believe it would be wise to add a title property that can be optionally set and then in our documentation for this element recommend that a title is always provided.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will mean re-factoring our uses to set a title and if a heading is being manually added remove it.&lt;br /&gt;
&lt;br /&gt;
===Continue {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is much like the confirmation molecule but with a single button.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present we have &#039;&#039;&#039;&#039;&#039;core_renderer::continue_button&#039;&#039;&#039;&#039;&#039; that produces a single button. However this design is very poor as more often than not a message is included in the page to describe the purpose of the continue button. This is really an integral part of the continue button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Currently we have &#039;&#039;core_renderer::continue_button&#039;&#039; to render a single continue button.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function continue_button($url);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally it creates a single_button component and then calls render on that.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
Our element should have a message and a button. To make it easy to migrate the constructor should accept a URL instead of a button and do the same conversion as the current method is doing.&lt;br /&gt;
&lt;br /&gt;
===Choice {molecule}===&lt;br /&gt;
Not sure about this one quite yet.&lt;br /&gt;
A description with 2 or more actions allowing the user to select the next step.&lt;br /&gt;
Think of it like when editing a module you get: Cancel, Save and return to course, Save and display&lt;br /&gt;
&lt;br /&gt;
Perhaps both [#Confirmation {molecule}] and [#Continue {molecule}] should be just instances of this.&lt;br /&gt;
&lt;br /&gt;
Hmm perhaps that would not be as clear as this and we should have this separate choice molecule.&lt;br /&gt;
&lt;br /&gt;
===Divider {atom}===&lt;br /&gt;
Think horizontal rule.&lt;br /&gt;
&lt;br /&gt;
===Dropdowns {molecule}===&lt;br /&gt;
&lt;br /&gt;
So this is a pretty simple concept, but you&#039;ve got to think of it as a separate entity. A dropdown is a menu that appears when the user interacts with an action.&lt;br /&gt;
 &lt;br /&gt;
The action could take one of three forms:&lt;br /&gt;
* From button&lt;br /&gt;
* From link&lt;br /&gt;
* From icon&lt;br /&gt;
&lt;br /&gt;
Of course that is handled by the [#Action {atom}] noted above. Worth noting is that we will need some way to toggle these actions as dropdowns. Perhaps it is worth making that a property of the action atom.&lt;br /&gt;
&lt;br /&gt;
The dropdown itself will likely contain more actions, and I suppose additional dropdowns to form sub menus. Sub-menus in my mind are required. We don&#039;t use them in core, but they are functionally possible through things like the custom menu and I know for a fact that many sites have sub menus.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#dropdowns Bootstrap 2.3.2]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Link or button to toggle dropdown --&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dLabel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#dropdowns Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;button class=&amp;quot;btn dropdown-toggle sr-only&amp;quot; type=&amp;quot;button&amp;quot; id=&amp;quot;dropdownMenu1&amp;quot; data-toggle=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
        Dropdown&lt;br /&gt;
        &amp;lt;span class=&amp;quot;caret&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/button&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dropdownMenu1&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot; class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/dropdown.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; data-dropdown=&amp;quot;drop1&amp;quot;&amp;gt;Has Dropdown&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;ul id=&amp;quot;drop1&amp;quot; class=&amp;quot;f-dropdown&amp;quot; data-dropdown-content&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is a link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Yet another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forms {organism}===&lt;br /&gt;
&lt;br /&gt;
This is an advanced  organism and would be quite a bit of work to create in Moodle as we&#039;d need to translate from QuickForms to elements for rendering.&lt;br /&gt;
It would be worthwhile doing this however, and would be a good way of quickly showing our new work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework structures&#039;&#039;&#039;&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/base-css.html#forms Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/css/#forms Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/forms.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
All of those are quite in-depth and offer a range of configurations.&lt;br /&gt;
We should carefully consider these when analysing our work here.&lt;br /&gt;
&lt;br /&gt;
===Headings {atom}===&lt;br /&gt;
&lt;br /&gt;
Currently handled by &#039;&#039;&#039;core_renderer::heading&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* h1 - h6&lt;br /&gt;
* Optional icon&lt;br /&gt;
* Optional help icon&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method is currently:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function heading($text, $level = 2, $classes = null, $id = null);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output generated by this is, assuming we use the default level, classes, and id.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;I am a heading&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Whats worth noting is that the render method should not accept level and classes as arguments.&lt;br /&gt;
These should only be set by the render method and should not be directly influenced.&lt;br /&gt;
&lt;br /&gt;
===Image {atom}===&lt;br /&gt;
&lt;br /&gt;
There are really two types of images to focus on here, or really two ways to display an image to focus on here.&amp;lt;br /&amp;gt;&lt;br /&gt;
# Standard images&lt;br /&gt;
# Thumbnail images&lt;br /&gt;
&lt;br /&gt;
Each of these would share some common properties:&lt;br /&gt;
* Image&lt;br /&gt;
* Description (alt/title)&lt;br /&gt;
* Size&lt;br /&gt;
* Action (making it a link) - This would actually make it a molecule, we would have to consider this and either have a new element, drop the ability to wrap in an action, or simply ignore this inconsistency.&lt;br /&gt;
&lt;br /&gt;
===Image - Icon {atom}===&lt;br /&gt;
&lt;br /&gt;
This covers the display of an icon. Should be a separate element from image as really they should be treated individually.&lt;br /&gt;
Within Moodle there are a few classifications of icons to consider:&lt;br /&gt;
* Standard icons&lt;br /&gt;
* Help icon (popup, tooltip)&lt;br /&gt;
* Loading icon (really regular icon but worth showing separately as its only seen when required)&lt;br /&gt;
&lt;br /&gt;
===Image - Logo {molecule}===&lt;br /&gt;
&lt;br /&gt;
We don&#039;t have this within core Moodle at present, however just about every theme I have seen uses a logo. I think it is about time we considered having a logo element.&lt;br /&gt;
I imagine it would become a sort of hero element, likely with an associated action (back home by default).&lt;br /&gt;
&lt;br /&gt;
===Image - Profile picture {molecule}===&lt;br /&gt;
&lt;br /&gt;
We already have a user_picture component within Moodle. It can be found in lib/outputcomponents.php.&amp;lt;br /&amp;gt;&lt;br /&gt;
It has two render methods, &#039;&#039;&#039;&#039;&#039;core_renderer::user_picture&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;core_renderer::render_user_picture&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output structure for the user picture:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; id=&amp;quot;userpicture_randomid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;img src=&amp;quot;#&amp;quot; alt=&amp;quot;Picture of Joe&amp;quot; title=&amp;quot;Picture of Joe&amp;quot; class=&amp;quot;userpicture&amp;quot; width=&amp;quot;[35, 100, XX]&amp;quot; height=&amp;quot;[35, 100, XX]&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What you&#039;ll notice about this is that the link has no attributes marking it as a user picture link.&lt;br /&gt;
&lt;br /&gt;
The PHP code for the user_picture object itself is really quite in depth and complex. The component serves the user profile fields required to render a user picture. This is good in the scope of the component but would be bad within the scope of an element.&amp;lt;br /&amp;gt;&lt;br /&gt;
Don&#039;t you wish we had a proper user object!&lt;br /&gt;
&lt;br /&gt;
===Link {atom}===&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&lt;br /&gt;
&lt;br /&gt;
Theres not too much more to explain about links, they don&#039;t tend to take states other than the default active, enabled and dimmed.&amp;lt;br /&amp;gt;&lt;br /&gt;
It is worth mentioning that devs will be encouraged to use actions and not links unless absolutely necessary.&amp;lt;br /&amp;gt;&lt;br /&gt;
The render method for this atom must typehint an action rather than a link.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prototype example&#039;&#039;&#039;&lt;br /&gt;
* The atom: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/link.php&lt;br /&gt;
* The convenience method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L149&lt;br /&gt;
* The render method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L211&lt;br /&gt;
&lt;br /&gt;
===List {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is a pretty simple example and something I am sure you are all familiar with. A list is simply a collection of items. Usually represented using a UL or OL tag in markup although worth noting can be styled completely differently to the default.&lt;br /&gt;
There are three main types of lists used within Moodle:&lt;br /&gt;
* Ordered list&lt;br /&gt;
* Unordered list&lt;br /&gt;
* Presentation list (currently our unlist)&lt;br /&gt;
&lt;br /&gt;
The list is a molecule because it should be able to accept other elements as items. E.g. it should be content independent.&lt;br /&gt;
&lt;br /&gt;
===Menu {molecule}===&lt;br /&gt;
&lt;br /&gt;
A menu is a familiar concept for any site. Probably the first thing that pops to mind for many is the navbar, but I want to consider that a separate component as a navbar can consist of more than just menu items.&lt;br /&gt;
I think a menu should be a collection of actions the user can perform. Perhaps with some form of hierarchy.&lt;br /&gt;
&lt;br /&gt;
We have different types of menus within Moodle:&lt;br /&gt;
* The custom menu is one users can directly create, with dropdown downs and sub dropdowns.&lt;br /&gt;
* The action_menu component we have in core uses icons as actions and can have a dropdown.&lt;br /&gt;
&lt;br /&gt;
These should be combined into a single menu element that takes items as an argument, likely actions + dropdowns + dividers to start with would be perfect.&lt;br /&gt;
&lt;br /&gt;
We would likely need to deal with the display of the menu with properties to allow constructing code to &#039;&#039;request&#039;&#039; a particular style of menu. The renderer should be what actually gets to decide, but for the purposes of re-use having properties and a single render_method is better than having multiple render methods.&amp;lt;br /&amp;gt;&lt;br /&gt;
The following is my initial thoughts on menu structure:&lt;br /&gt;
* Direction: Horizontal, Vertical&lt;br /&gt;
* Design: Default, Tabs, &lt;br /&gt;
* Style: Default, Links, Buttons, Icons&lt;br /&gt;
&lt;br /&gt;
===Notification {atom}===&lt;br /&gt;
* Info&lt;br /&gt;
* Success&lt;br /&gt;
* Warning&lt;br /&gt;
* Danger&lt;br /&gt;
&lt;br /&gt;
===Navigation bar {organism}===&lt;br /&gt;
Formerly navbar, can&#039;t be called that because the render method would conflict.&lt;br /&gt;
&lt;br /&gt;
The navigation bar is just that, it is becoming increasingly common on the web and usually contains a title or logo, a menu, and information pertaining to the user state (login, language etc).&lt;br /&gt;
&lt;br /&gt;
===Page header {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently being produced by &#039;&#039;&#039;core_renderer::page_heading&#039;&#039;&#039; this is simply a header for the page, by default the only h1 element on the page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method has the following signature:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function page_heading($tag = &#039;h1&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output from the above method is:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;The page heading (from moodle_page::heading)&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The core_renderer method should not allow the tag to be set. The page heading should always be H1.&lt;br /&gt;
If its not an H1 then page header should not be used.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework examples&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#typography Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;hero-unit&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Heading&amp;lt;/h1&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;Tagline&amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
    &amp;lt;a class=&amp;quot;btn btn-primary btn-large&amp;quot;&amp;gt;&lt;br /&gt;
      Learn more&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#page-header Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Example page header &amp;lt;small&amp;gt;Subtext for header&amp;lt;/small&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Foundation doesn&#039;t appear to have a page header component.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* In Moodle all page headings are set as a single string, we won&#039;t be changing this.&lt;br /&gt;
* Usually just a plain string sometimes an icon is used, and sometimes a help icon is used.&lt;br /&gt;
&lt;br /&gt;
===Pagination {molecule}===&lt;br /&gt;
&lt;br /&gt;
I like the idea of this being separate to a menu, and to other navigation oriented elements because it should be something that can easily be constructed with a few basic parameters and allow us to achieve consistent pagination throughout Moodle.&amp;lt;br /&amp;gt;&lt;br /&gt;
It also appeals because this is something that people may want to style differently to their navigation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#pagination Bootstrap 2.3.2 pagination]&lt;br /&gt;
* [http://getbootstrap.com/components/#pagination Bootstrap 3 pagination]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/pagination.html Zurb foundation pagination]&lt;br /&gt;
&lt;br /&gt;
===Progress bars {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty simple concept, we already have a couple of ways of producing progress bars within Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#progress Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;bar&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 2.3.2:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#progress Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- With label --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60% Complete&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Label is hidden but accessible --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60%&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 3:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/progress_bars.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;span class=&amp;quot;meter&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Zurb foundation:&lt;br /&gt;
* Width &lt;br /&gt;
* Colours: default (blue), secondary (grey), success (green), alert (red)&lt;br /&gt;
* Corner style: default (square), radius (slight rounding), round&lt;br /&gt;
&lt;br /&gt;
===Search {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty common interface molecule, and in fact used as an example in the atomic design blog post we keep referencing.&amp;lt;br /&amp;gt;&lt;br /&gt;
We don&#039;t have a component for searching yet, however we&#039;ve several search boxes throughout Moodle. The admin setting search box is the first to come to mind for me, followed by the forum search box and course search box.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Constructed of the following items:&lt;br /&gt;
* Text input&lt;br /&gt;
* Action (must be a button for submit I imagine)&lt;br /&gt;
* Label or short description (optional)&lt;br /&gt;
* Collapsible region containing settings etc (optional)&lt;br /&gt;
&lt;br /&gt;
===Table {organism}===&lt;br /&gt;
&lt;br /&gt;
We&#039;ve two primary table components within Moodle presently &#039;&#039;&#039;html_table&#039;&#039;&#039; and &#039;&#039;&#039;flexible_table&#039;&#039;&#039; both of which offer different advantages and disadvantages. This will be a challenge and will really require some proper research and community interaction.&lt;br /&gt;
&lt;br /&gt;
===Timer {atom|molecule}===&lt;br /&gt;
&lt;br /&gt;
... not sure about this one, but we do use it in a couple of places, and we use it on all core sites that have hourly resets so in a way it makes sense to support it and allow it to be styled nicely and easily.&lt;br /&gt;
&lt;br /&gt;
===Tree {organism}===&lt;br /&gt;
&lt;br /&gt;
===User content {organism}===&lt;br /&gt;
&lt;br /&gt;
Think of this like the forum post. We need a common structure in which to display content entered by the user along with information on the user. The users name, picture, date perhaps, title, content, footer (attachments, badges, what ever).&lt;br /&gt;
It could be applied to things like forum posts, calendar events etc.&lt;br /&gt;
&lt;br /&gt;
At present we have no abstraction for this.&lt;br /&gt;
&lt;br /&gt;
==Existing renderables and what they will become==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Existing renderable&lt;br /&gt;
! Description&lt;br /&gt;
! Future renderable&lt;br /&gt;
! Convenience method (if different)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu&lt;br /&gt;
| UI component for a drop down edit menu&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link&lt;br /&gt;
| UI component for a menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_filler&lt;br /&gt;
| UI component for a filler menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_primary&lt;br /&gt;
| UI component for a primary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_secondary&lt;br /&gt;
| UI component for a secondary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_link&lt;br /&gt;
| Link with alt text, and an icon&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_button&lt;br /&gt;
| A form with a single button&lt;br /&gt;
| button (action with post method)&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| confirm&lt;br /&gt;
| A form with a message and cancel/confirm buttons&lt;br /&gt;
| confirmation&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_select&lt;br /&gt;
| A form with a single drop down list that submits on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| url_select&lt;br /&gt;
| A navigation element consisting of a single drop down list of urls that navigates on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| doc_link&lt;br /&gt;
| A link to the Moodle docs&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pix_icon&lt;br /&gt;
| A small icon&lt;br /&gt;
| icon&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| emoticon_icon&lt;br /&gt;
| A small emoticon&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading_with_help&lt;br /&gt;
| A page heading with a link to help docs&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| icon_help&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon_scale&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_picture&lt;br /&gt;
| A user profile picture which links to their profile&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| container&lt;br /&gt;
| A block level element used to surround something. Can have a class to allow specific targeting with CSS.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| error_text&lt;br /&gt;
| An error to show to the user.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| notification&lt;br /&gt;
| A message for the user&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| continue_button&lt;br /&gt;
| A message and a button to continue to the next page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| paging_bar&lt;br /&gt;
| A list of next previous and specific page links&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_to&lt;br /&gt;
| A link to a section on the page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_target&lt;br /&gt;
| A target for a matching skip_link_to call&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading&lt;br /&gt;
| A page heading&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| box&lt;br /&gt;
| A page section with a border&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rarrow&lt;br /&gt;
| A right arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| larrow&lt;br /&gt;
| A left arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| tabtree&lt;br /&gt;
| A list of tabs&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| tabobject&lt;br /&gt;
| A single tab panel&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Render_library_element_planning&amp;diff=45559</id>
		<title>User:Sam Hemelryk/Render library element planning</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Render_library_element_planning&amp;diff=45559"/>
		<updated>2014-06-27T02:05:56Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* User badge */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45829&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
This page documents the proposed core elements, variations of them, what we expect they will contain, and the core_renderer block.&lt;br /&gt;
&lt;br /&gt;
==The user action==&lt;br /&gt;
&lt;br /&gt;
An action in this sense is a collection of data that all pertains to one action that can be taken by the user.&lt;br /&gt;
The action, once populated with data can be rendered as is required for the job it is going to fulfil, usually with some relation to the frontend framework in use.&lt;br /&gt;
In this way the action could be a link, or a button; it could even be interpreted into a more complex structure.&lt;br /&gt;
&lt;br /&gt;
An action has the following properties:&lt;br /&gt;
; content [string]: text content for the link or button.&lt;br /&gt;
; url [moodle_url] : the url for the action to take when the user interacts with this action.&lt;br /&gt;
; description : a description of the action. Typically used within a title or alt attribute.&lt;br /&gt;
; active : True if this is the action the user is current performing.&lt;br /&gt;
; enabled : True if the action is possible, false if it is not possible and should be shown as disabled.&lt;br /&gt;
; dimmed : True if the action should be shown as dimmed, usually used to the action is hidden to other users.&lt;br /&gt;
; method : The preferred method of submitting this action, typically GET but can be set to POST.&lt;br /&gt;
&lt;br /&gt;
It is also possible to add JavaScript actions (component_action objects) to an action. These attach a JS listener to the action that gets executed when the user interacts with the action.&lt;br /&gt;
Attached JavaScript actions get initialised when the properties for the action are retrieved so any events must be attached BEFORE the action is rendered, and all renderers must ensure they use the get_attributes() call. &lt;br /&gt;
&lt;br /&gt;
==Grids==&lt;br /&gt;
&lt;br /&gt;
We need to come up with some way to include grids in core, it is desirable to keep it framework agnostic so perhaps a grid object that allows for items to be added and a &amp;quot;width&amp;quot; specified when that occurs. The width would be either a fixed number or a percentage. Steps of 12 seems pretty common.&lt;br /&gt;
&lt;br /&gt;
==Design requirements==&lt;br /&gt;
The following concepts need to be accounted for in core, or decisions made on how we choose to support these and where.&lt;br /&gt;
&lt;br /&gt;
===Clearfix===&lt;br /&gt;
We have this in core already, bootstrap has it, pretty much every front end framework has it.&lt;br /&gt;
Clearfix is more of a design decision, should only be used when require, and only ever applied by a renderer.&lt;br /&gt;
This gets special mention as being important, support is already 100%.&lt;br /&gt;
&lt;br /&gt;
===Floats===&lt;br /&gt;
Pull left, pull right etc. These are a design decisions and should be implemented by the renderer. Bootstrap caters for these and as such they will be easily catered for in bootstrapbase, however work may be required to get them operational in base.&lt;br /&gt;
&lt;br /&gt;
==Discarded ideas==&lt;br /&gt;
The following things are ideas that came up during discussions on what elements are, and what elements we want in core that have being discarded.&lt;br /&gt;
&lt;br /&gt;
==Core atoms, molecules, and organisms==&lt;br /&gt;
&lt;br /&gt;
The following is the atoms, molecules and organisms we believe should be created initially. Of course there will be many more that are required - however this should give us a good grounding of elements to work with for the first conversions.&lt;br /&gt;
&lt;br /&gt;
===Action {atom}===&lt;br /&gt;
See the section above about [[#The user action]]&lt;br /&gt;
&lt;br /&gt;
Actions are special atoms the represent an action the user can make.&lt;br /&gt;
They can be rendered by a theme as a link, a button or I suppose anything else.&lt;br /&gt;
There should be a default for when it is not specified and the renderer in change of producing the current thing can decide whether to use the default and just call &#039;&#039;render&#039;&#039; or if it requires something specific &#039;&#039;render_link&#039;&#039; or &#039;&#039;render_button&#039;&#039; as required.&lt;br /&gt;
&lt;br /&gt;
===Action group {molecule}===&lt;br /&gt;
A group of actions, to be rendered to reflect a relation. I suppose the easiest way to think about this is how buttons in the atto editor are grouped together. It is a requirement that may seem a tad absrtracted and irrelevant at first but I think will pop up in several places throughout Moodle when we start converting.&lt;br /&gt;
&lt;br /&gt;
It is basically a collection of actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#buttonGroups Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/components/#btn-groups Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/button_groups.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
===Block {atom}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle. This represents a block on the page, and is displayed within a [[#Block region]].&lt;br /&gt;
It accepts two arguments, the first is a &#039;&#039;block_contents&#039;&#039; object instance, and the second is the region name the block instance is being shown within.&lt;br /&gt;
&lt;br /&gt;
At present a block is rendered using the &#039;&#039;&#039;&#039;&#039;core_render::block&#039;&#039;&#039;&#039;&#039; method. Internally this calls several renderer methods to produce the different parts of a block.&lt;br /&gt;
* core_renderer::block_header - Produces a header&lt;br /&gt;
** core_renderer::block_controls - Produces controls to display within the header.&lt;br /&gt;
* core_renderer::block_content - Produces the actual content of the block.&lt;br /&gt;
** core_renderer::block_controls - Used to check if block controls were rendered. PUKE!!!&lt;br /&gt;
** core_renderer::block_footer - Produces a footer that actually resides within the content.&lt;br /&gt;
* core_renderer::block_annotation - Produces an annotation, used VERY rarely.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output when called for a navigation block with a bit of extra added to show how a footer is displayed and an annotation.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#sb-1&amp;quot; class=&amp;quot;skip-block&amp;quot;&amp;gt;Skip Navigation&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;inst4&amp;quot; class=&amp;quot;block_navigation  block&amp;quot; role=&amp;quot;navigation&amp;quot; data-block=&amp;quot;navigation&amp;quot; data-instanceid=&amp;quot;4&amp;quot; aria-labelledby=&amp;quot;instance-4-header&amp;quot; data-dockable=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;block_action&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;!-- Block actions go here, they are images with JS or anchors--&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;h2 id=&amp;quot;instance-4-header&amp;quot;&amp;gt;Navigation&amp;lt;/h2&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;content&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;!-- Block content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;div class=&amp;quot;footer&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;!-- Block footer content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;blockannotation&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Block annotation content goes here --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;sb-1&amp;quot; class=&amp;quot;skip-block-to&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Block region {molecule}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle, the block region is a contain for all of the blocks in one location.&lt;br /&gt;
We currently have two methods that produce a block region within Moodle, the first is &#039;&#039;&#039;&#039;&#039;core_renderer::blocks_for_region&#039;&#039;&#039;&#039;&#039; which adds no surrounding content.&lt;br /&gt;
The preferred method &#039;&#039;&#039;&#039;&#039;core_renderer::blocks&#039;&#039;&#039;&#039;&#039; adds some embedded information to a common structure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the structure of the &#039;&#039;core_renderer::blocks()&#039;&#039; method.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function blocks($region, $classes = array(), $tag = &#039;aside&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following is the html output is $region was &#039;&#039;pre&#039;&#039; and the default tag and classes were used.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot; data-blockregion=&amp;quot;pre&amp;quot; data-droptarget=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Thoughts on this&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The blocks method is a convenience method and serves an important purpose. However it should not take classes and tag as arguments.&amp;lt;br /&amp;gt;&lt;br /&gt;
These should certainly only settable within the renderer itself, and if themes wish to change this without wrapping the call they should override the renderer.&lt;br /&gt;
&lt;br /&gt;
Both the data attributes relate to servicing JavaScript functionality. Perhaps they should be moved to a component_action or somehow else integrated with JS rather than with the renderer directly.&lt;br /&gt;
&lt;br /&gt;
Internally it is calling blocks for region, however this should change it should request a array of blocks, convert the array to [[#Block]] elements and call render on each.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Proposed HTML structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Much like the current structure but with the data attributes coming through a JS mechanism.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Breadcrumb {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently called the navbar within Moodle, controlled by the &#039;&#039;&#039;&#039;&#039;navbar&#039;&#039;&#039;&#039;&#039; class located in lib/navigationlib.php and rendered by &#039;&#039;&#039;&#039;&#039;core_renderer::navbar()&#039;&#039;&#039;&#039;&#039;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Internally it calls moodle_page-&amp;gt;navbar-&amp;gt;get_items() to get an array containing navigation node items to display in the navigation bar.&amp;lt;br /&amp;gt;&lt;br /&gt;
It produces a bit of surrounding structure before calling render on each item.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following shows the structure for two items in the navigation bar presently within Moodle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;Page path&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;nav class=&amp;quot;breadcrumb-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/nav&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the excessive amount of markup to make the separator accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#breadcrumbs Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#breadcrumbs Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/breadcrumbs.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The currently active page should be marked with a class.&lt;br /&gt;
* The current item should probably not be a link MDL-46037&lt;br /&gt;
* [http://www.w3.org/TR/2007/WD-aria-role-20070601/#breadcrumbs wia-aria breadcrumb role]&lt;br /&gt;
* The divider perhaps could come through CSS with these changes to avoid markup necessary to make it accessible (in combination with the above).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation thoughts&#039;&#039;&#039;&lt;br /&gt;
* Owns an array of [#Action {atoms}]&lt;br /&gt;
&lt;br /&gt;
===Buttons {atom}===&lt;br /&gt;
&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&amp;lt;br /&amp;gt;&lt;br /&gt;
Obviously buttons can serve different purposes and roles so have several easily reachable customisations is probably a wise idea.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
None, presently you produce a button when you need it so there are several throughout Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/base-css.html#buttons Bootstrap 2.3.2] and [http://getbootstrap.com/css/#buttons Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;btn btn-default&amp;quot;&amp;gt;Default&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;btn btn-default btn-lg active&amp;quot; role=&amp;quot;button&amp;quot;&amp;gt;Link&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;input class=&amp;quot;btn btn-default&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Input&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Bootstrap:&lt;br /&gt;
* Purposes: default, primary, success, info, warning, danger, link&lt;br /&gt;
* Sizes: large, default, small, extra-small&lt;br /&gt;
* Block level (wider)&lt;br /&gt;
* States: Active, disabled.&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/buttons.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;button&amp;quot;&amp;gt;Default Button&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Zurb Foundation:&lt;br /&gt;
* Purposes: default, secondary, success, alert&lt;br /&gt;
* Sizes: large, default, small, tiny&lt;br /&gt;
* Corner style: radius, round&lt;br /&gt;
* Expanded (wider)&lt;br /&gt;
* States: disabled&lt;br /&gt;
&lt;br /&gt;
===Calendar {organism}===&lt;br /&gt;
&lt;br /&gt;
A simple idea really, apparently not already covered by the frontend frameworks being referenced during the creation of the doc.&lt;br /&gt;
The display of the calendar is fixed, but it can contain content for each day shown.&lt;br /&gt;
&lt;br /&gt;
The calendar should have several views, perhaps these are separate organisms, perhaps not.&lt;br /&gt;
&lt;br /&gt;
* Compact month&lt;br /&gt;
* Month&lt;br /&gt;
* Week&lt;br /&gt;
* Day&lt;br /&gt;
&lt;br /&gt;
Each day could:&lt;br /&gt;
* Contain an action with an icon for events, and link to the fullday display.&lt;br /&gt;
* Have an associated action to load and display the events in a tooltip.&lt;br /&gt;
&lt;br /&gt;
===Collapsible region {molecule}===&lt;br /&gt;
&lt;br /&gt;
We use these in several places within Moodle. I could not find a reference to this concept in any of the frontend frameworks I looked at.&lt;br /&gt;
The concept is simple - you have a heading and an icon with content. By default the content is hidden, when the user clicks the heading and/or the icon the content is revealed.&lt;br /&gt;
&lt;br /&gt;
As noted we do this in several places within Moodle, it would be good to have a single way of displaying this idea of a collapsible region.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
* It should support an optional collapse/expand all trigger action.&lt;br /&gt;
* We want to be able to use it both inside and outside of forms.&lt;br /&gt;
* It should be usable in situations like the combo list frontpage component as well.&lt;br /&gt;
* Will obviously have a JS component as without JS it would not work.&lt;br /&gt;
&lt;br /&gt;
===Confirmation {molecule}===&lt;br /&gt;
&lt;br /&gt;
A simple concept used regularly in Moodle to confirm a users intention to perform an actions. Most commonly seeing when deleting content.&lt;br /&gt;
The structure is relatively basic in Moodle at present.&lt;br /&gt;
* A message&lt;br /&gt;
* A forwards button&lt;br /&gt;
* A back button&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The method &#039;&#039;&#039;&#039;&#039;core_renderer::confirm&#039;&#039;&#039;&#039;&#039; does the rendering at present. Its signature is as follows:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function confirm($message, $continue, $cancel);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output it produces is like:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;generalbox&amp;quot; id=&amp;quot;notice&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;The message goes here&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Two buttons produced by core_renderer::render_single_button() --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design throughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This component does not have a title. I believe at present some pages use &#039;&#039;core_renderer::heading&#039;&#039; to produce a title if they wish. Obviously we want consistency of style so I believe it would be wise to add a title property that can be optionally set and then in our documentation for this element recommend that a title is always provided.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will mean re-factoring our uses to set a title and if a heading is being manually added remove it.&lt;br /&gt;
&lt;br /&gt;
===Continue {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is much like the confirmation molecule but with a single button.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present we have &#039;&#039;&#039;&#039;&#039;core_renderer::continue_button&#039;&#039;&#039;&#039;&#039; that produces a single button. However this design is very poor as more often than not a message is included in the page to describe the purpose of the continue button. This is really an integral part of the continue button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Currently we have &#039;&#039;core_renderer::continue_button&#039;&#039; to render a single continue button.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function continue_button($url);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally it creates a single_button component and then calls render on that.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
Our element should have a message and a button. To make it easy to migrate the constructor should accept a URL instead of a button and do the same conversion as the current method is doing.&lt;br /&gt;
&lt;br /&gt;
===Choice {molecule}===&lt;br /&gt;
Not sure about this one quite yet.&lt;br /&gt;
A description with 2 or more actions allowing the user to select the next step.&lt;br /&gt;
Think of it like when editing a module you get: Cancel, Save and return to course, Save and display&lt;br /&gt;
&lt;br /&gt;
Perhaps both [#Confirmation {molecule}] and [#Continue {molecule}] should be just instances of this.&lt;br /&gt;
&lt;br /&gt;
Hmm perhaps that would not be as clear as this and we should have this separate choice molecule.&lt;br /&gt;
&lt;br /&gt;
===Divider {atom}===&lt;br /&gt;
Think horizontal rule.&lt;br /&gt;
&lt;br /&gt;
===Dropdowns {molecule}===&lt;br /&gt;
&lt;br /&gt;
So this is a pretty simple concept, but you&#039;ve got to think of it as a separate entity. A dropdown is a menu that appears when the user interacts with an action.&lt;br /&gt;
 &lt;br /&gt;
The action could take one of three forms:&lt;br /&gt;
* From button&lt;br /&gt;
* From link&lt;br /&gt;
* From icon&lt;br /&gt;
&lt;br /&gt;
Of course that is handled by the [#Action {atom}] noted above. Worth noting is that we will need some way to toggle these actions as dropdowns. Perhaps it is worth making that a property of the action atom.&lt;br /&gt;
&lt;br /&gt;
The dropdown itself will likely contain more actions, and I suppose additional dropdowns to form sub menus. Sub-menus in my mind are required. We don&#039;t use them in core, but they are functionally possible through things like the custom menu and I know for a fact that many sites have sub menus.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#dropdowns Bootstrap 2.3.2]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Link or button to toggle dropdown --&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dLabel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#dropdowns Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;button class=&amp;quot;btn dropdown-toggle sr-only&amp;quot; type=&amp;quot;button&amp;quot; id=&amp;quot;dropdownMenu1&amp;quot; data-toggle=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
        Dropdown&lt;br /&gt;
        &amp;lt;span class=&amp;quot;caret&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/button&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dropdownMenu1&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot; class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/dropdown.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; data-dropdown=&amp;quot;drop1&amp;quot;&amp;gt;Has Dropdown&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;ul id=&amp;quot;drop1&amp;quot; class=&amp;quot;f-dropdown&amp;quot; data-dropdown-content&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is a link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Yet another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forms {organism}===&lt;br /&gt;
&lt;br /&gt;
This is an advanced  organism and would be quite a bit of work to create in Moodle as we&#039;d need to translate from QuickForms to elements for rendering.&lt;br /&gt;
It would be worthwhile doing this however, and would be a good way of quickly showing our new work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework structures&#039;&#039;&#039;&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/base-css.html#forms Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/css/#forms Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/forms.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
All of those are quite in-depth and offer a range of configurations.&lt;br /&gt;
We should carefully consider these when analysing our work here.&lt;br /&gt;
&lt;br /&gt;
===Headings {atom}===&lt;br /&gt;
&lt;br /&gt;
Currently handled by &#039;&#039;&#039;core_renderer::heading&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* h1 - h6&lt;br /&gt;
* Optional icon&lt;br /&gt;
* Optional help icon&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method is currently:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function heading($text, $level = 2, $classes = null, $id = null);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output generated by this is, assuming we use the default level, classes, and id.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;I am a heading&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Whats worth noting is that the render method should not accept level and classes as arguments.&lt;br /&gt;
These should only be set by the render method and should not be directly influenced.&lt;br /&gt;
&lt;br /&gt;
===Image {atom}===&lt;br /&gt;
&lt;br /&gt;
There are really two types of images to focus on here, or really two ways to display an image to focus on here.&amp;lt;br /&amp;gt;&lt;br /&gt;
# Standard images&lt;br /&gt;
# Thumbnail images&lt;br /&gt;
&lt;br /&gt;
Each of these would share some common properties:&lt;br /&gt;
* Image&lt;br /&gt;
* Description (alt/title)&lt;br /&gt;
* Size&lt;br /&gt;
* Action (making it a link) - This would actually make it a molecule, we would have to consider this and either have a new element, drop the ability to wrap in an action, or simply ignore this inconsistency.&lt;br /&gt;
&lt;br /&gt;
===Image - Icon {atom}===&lt;br /&gt;
&lt;br /&gt;
This covers the display of an icon. Should be a separate element from image as really they should be treated individually.&lt;br /&gt;
Within Moodle there are a few classifications of icons to consider:&lt;br /&gt;
* Standard icons&lt;br /&gt;
* Help icon (popup, tooltip)&lt;br /&gt;
* Loading icon (really regular icon but worth showing separately as its only seen when required)&lt;br /&gt;
&lt;br /&gt;
===Image - Logo {molecule}===&lt;br /&gt;
&lt;br /&gt;
We don&#039;t have this within core Moodle at present, however just about every theme I have seen uses a logo. I think it is about time we considered having a logo element.&lt;br /&gt;
I imagine it would become a sort of hero element, likely with an associated action (back home by default).&lt;br /&gt;
&lt;br /&gt;
===Image - Profile picture {molecule}===&lt;br /&gt;
&lt;br /&gt;
We already have a user_picture component within Moodle. It can be found in lib/outputcomponents.php.&amp;lt;br /&amp;gt;&lt;br /&gt;
It has two render methods, &#039;&#039;&#039;&#039;&#039;core_renderer::user_picture&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;core_renderer::render_user_picture&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output structure for the user picture:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; id=&amp;quot;userpicture_randomid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;img src=&amp;quot;#&amp;quot; alt=&amp;quot;Picture of Joe&amp;quot; title=&amp;quot;Picture of Joe&amp;quot; class=&amp;quot;userpicture&amp;quot; width=&amp;quot;[35, 100, XX]&amp;quot; height=&amp;quot;[35, 100, XX]&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What you&#039;ll notice about this is that the link has no attributes marking it as a user picture link.&lt;br /&gt;
&lt;br /&gt;
The PHP code for the user_picture object itself is really quite in depth and complex. The component serves the user profile fields required to render a user picture. This is good in the scope of the component but would be bad within the scope of an element.&amp;lt;br /&amp;gt;&lt;br /&gt;
Don&#039;t you wish we had a proper user object!&lt;br /&gt;
&lt;br /&gt;
===Link {atom}===&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&lt;br /&gt;
&lt;br /&gt;
Theres not too much more to explain about links, they don&#039;t tend to take states other than the default active, enabled and dimmed.&amp;lt;br /&amp;gt;&lt;br /&gt;
It is worth mentioning that devs will be encouraged to use actions and not links unless absolutely necessary.&amp;lt;br /&amp;gt;&lt;br /&gt;
The render method for this atom must typehint an action rather than a link.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prototype example&#039;&#039;&#039;&lt;br /&gt;
* The atom: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/link.php&lt;br /&gt;
* The convenience method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L149&lt;br /&gt;
* The render method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L211&lt;br /&gt;
&lt;br /&gt;
===List {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is a pretty simple example and something I am sure you are all familiar with. A list is simply a collection of items. Usually represented using a UL or OL tag in markup although worth noting can be styled completely differently to the default.&lt;br /&gt;
There are three main types of lists used within Moodle:&lt;br /&gt;
* Ordered list&lt;br /&gt;
* Unordered list&lt;br /&gt;
* Presentation list (currently our unlist)&lt;br /&gt;
&lt;br /&gt;
The list is a molecule because it should be able to accept other elements as items. E.g. it should be content independent.&lt;br /&gt;
&lt;br /&gt;
===Menu {molecule}===&lt;br /&gt;
&lt;br /&gt;
A menu is a familiar concept for any site. Probably the first thing that pops to mind for many is the navbar, but I want to consider that a separate component as a navbar can consist of more than just menu items.&lt;br /&gt;
I think a menu should be a collection of actions the user can perform. Perhaps with some form of hierarchy.&lt;br /&gt;
&lt;br /&gt;
We have different types of menus within Moodle:&lt;br /&gt;
* The custom menu is one users can directly create, with dropdown downs and sub dropdowns.&lt;br /&gt;
* The action_menu component we have in core uses icons as actions and can have a dropdown.&lt;br /&gt;
&lt;br /&gt;
These should be combined into a single menu element that takes items as an argument, likely actions + dropdowns + dividers to start with would be perfect.&lt;br /&gt;
&lt;br /&gt;
We would likely need to deal with the display of the menu with properties to allow constructing code to &#039;&#039;request&#039;&#039; a particular style of menu. The renderer should be what actually gets to decide, but for the purposes of re-use having properties and a single render_method is better than having multiple render methods.&amp;lt;br /&amp;gt;&lt;br /&gt;
The following is my initial thoughts on menu structure:&lt;br /&gt;
* Direction: Horizontal, Vertical&lt;br /&gt;
* Design: Default, Tabs, &lt;br /&gt;
* Style: Default, Links, Buttons, Icons&lt;br /&gt;
&lt;br /&gt;
===Notification {atom}===&lt;br /&gt;
* Info&lt;br /&gt;
* Success&lt;br /&gt;
* Warning&lt;br /&gt;
* Danger&lt;br /&gt;
&lt;br /&gt;
===Navigation bar {organism}===&lt;br /&gt;
Formerly navbar, can&#039;t be called that because the render method would conflict.&lt;br /&gt;
&lt;br /&gt;
The navigation bar is just that, it is becoming increasingly common on the web and usually contains a title or logo, a menu, and information pertaining to the user state (login, language etc).&lt;br /&gt;
&lt;br /&gt;
===Page header {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently being produced by &#039;&#039;&#039;core_renderer::page_heading&#039;&#039;&#039; this is simply a header for the page, by default the only h1 element on the page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method has the following signature:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function page_heading($tag = &#039;h1&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output from the above method is:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;The page heading (from moodle_page::heading)&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The core_renderer method should not allow the tag to be set. The page heading should always be H1.&lt;br /&gt;
If its not an H1 then page header should not be used.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework examples&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#typography Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;hero-unit&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Heading&amp;lt;/h1&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;Tagline&amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
    &amp;lt;a class=&amp;quot;btn btn-primary btn-large&amp;quot;&amp;gt;&lt;br /&gt;
      Learn more&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#page-header Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Example page header &amp;lt;small&amp;gt;Subtext for header&amp;lt;/small&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Foundation doesn&#039;t appear to have a page header component.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* In Moodle all page headings are set as a single string, we won&#039;t be changing this.&lt;br /&gt;
* Usually just a plain string sometimes an icon is used, and sometimes a help icon is used.&lt;br /&gt;
&lt;br /&gt;
===Pagination {molecule}===&lt;br /&gt;
&lt;br /&gt;
I like the idea of this being separate to a menu, and to other navigation oriented elements because it should be something that can easily be constructed with a few basic parameters and allow us to achieve consistent pagination throughout Moodle.&amp;lt;br /&amp;gt;&lt;br /&gt;
It also appeals because this is something that people may want to style differently to their navigation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#pagination Bootstrap 2.3.2 pagination]&lt;br /&gt;
* [http://getbootstrap.com/components/#pagination Bootstrap 3 pagination]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/pagination.html Zurb foundation pagination]&lt;br /&gt;
&lt;br /&gt;
===Progress bars {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty simple concept, we already have a couple of ways of producing progress bars within Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#progress Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;bar&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 2.3.2:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#progress Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- With label --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60% Complete&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Label is hidden but accessible --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60%&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 3:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/progress_bars.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;span class=&amp;quot;meter&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Zurb foundation:&lt;br /&gt;
* Width &lt;br /&gt;
* Colours: default (blue), secondary (grey), success (green), alert (red)&lt;br /&gt;
* Corner style: default (square), radius (slight rounding), round&lt;br /&gt;
&lt;br /&gt;
===Search {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty common interface molecule, and in fact used as an example in the atomic design blog post we keep referencing.&amp;lt;br /&amp;gt;&lt;br /&gt;
We don&#039;t have a component for searching yet, however we&#039;ve several search boxes throughout Moodle. The admin setting search box is the first to come to mind for me, followed by the forum search box and course search box.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Constructed of the following items:&lt;br /&gt;
* Text input&lt;br /&gt;
* Action (must be a button for submit I imagine)&lt;br /&gt;
* Label or short description (optional)&lt;br /&gt;
* Collapsible region containing settings etc (optional)&lt;br /&gt;
&lt;br /&gt;
===Table {organism}===&lt;br /&gt;
&lt;br /&gt;
We&#039;ve two primary table components within Moodle presently &#039;&#039;&#039;html_table&#039;&#039;&#039; and &#039;&#039;&#039;flexible_table&#039;&#039;&#039; both of which offer different advantages and disadvantages. This will be a challenge and will really require some proper research and community interaction.&lt;br /&gt;
&lt;br /&gt;
===Timer {atom|molecule}===&lt;br /&gt;
&lt;br /&gt;
... not sure about this one, but we do use it in a couple of places, and we use it on all core sites that have hourly resets so in a way it makes sense to support it and allow it to be styled nicely and easily.&lt;br /&gt;
&lt;br /&gt;
===Tree {organism}===&lt;br /&gt;
&lt;br /&gt;
===User content===&lt;br /&gt;
&lt;br /&gt;
Think of this like the forum post. We need a common structure in which to display content entered by the user along with information on the user. The users name, picture, date perhaps, title, content, footer (attachments, badges, what ever).&lt;br /&gt;
It could be applied to things like forum posts, calendar events etc.&lt;br /&gt;
&lt;br /&gt;
At present we have no abstraction for this.&lt;br /&gt;
&lt;br /&gt;
==Existing renderables and what they will become==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Existing renderable&lt;br /&gt;
! Description&lt;br /&gt;
! Future renderable&lt;br /&gt;
! Convenience method (if different)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu&lt;br /&gt;
| UI component for a drop down edit menu&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link&lt;br /&gt;
| UI component for a menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_filler&lt;br /&gt;
| UI component for a filler menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_primary&lt;br /&gt;
| UI component for a primary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_secondary&lt;br /&gt;
| UI component for a secondary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_link&lt;br /&gt;
| Link with alt text, and an icon&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_button&lt;br /&gt;
| A form with a single button&lt;br /&gt;
| button (action with post method)&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| confirm&lt;br /&gt;
| A form with a message and cancel/confirm buttons&lt;br /&gt;
| confirmation&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_select&lt;br /&gt;
| A form with a single drop down list that submits on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| url_select&lt;br /&gt;
| A navigation element consisting of a single drop down list of urls that navigates on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| doc_link&lt;br /&gt;
| A link to the Moodle docs&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pix_icon&lt;br /&gt;
| A small icon&lt;br /&gt;
| icon&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| emoticon_icon&lt;br /&gt;
| A small emoticon&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading_with_help&lt;br /&gt;
| A page heading with a link to help docs&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| icon_help&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon_scale&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_picture&lt;br /&gt;
| A user profile picture which links to their profile&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| container&lt;br /&gt;
| A block level element used to surround something. Can have a class to allow specific targeting with CSS.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| error_text&lt;br /&gt;
| An error to show to the user.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| notification&lt;br /&gt;
| A message for the user&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| continue_button&lt;br /&gt;
| A message and a button to continue to the next page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| paging_bar&lt;br /&gt;
| A list of next previous and specific page links&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_to&lt;br /&gt;
| A link to a section on the page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_target&lt;br /&gt;
| A target for a matching skip_link_to call&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading&lt;br /&gt;
| A page heading&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| box&lt;br /&gt;
| A page section with a border&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rarrow&lt;br /&gt;
| A right arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| larrow&lt;br /&gt;
| A left arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| tabtree&lt;br /&gt;
| A list of tabs&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| tabobject&lt;br /&gt;
| A single tab panel&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Render_library_element_planning&amp;diff=45558</id>
		<title>User:Sam Hemelryk/Render library element planning</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Render_library_element_planning&amp;diff=45558"/>
		<updated>2014-06-27T02:05:40Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Tree */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45829&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
This page documents the proposed core elements, variations of them, what we expect they will contain, and the core_renderer block.&lt;br /&gt;
&lt;br /&gt;
==The user action==&lt;br /&gt;
&lt;br /&gt;
An action in this sense is a collection of data that all pertains to one action that can be taken by the user.&lt;br /&gt;
The action, once populated with data can be rendered as is required for the job it is going to fulfil, usually with some relation to the frontend framework in use.&lt;br /&gt;
In this way the action could be a link, or a button; it could even be interpreted into a more complex structure.&lt;br /&gt;
&lt;br /&gt;
An action has the following properties:&lt;br /&gt;
; content [string]: text content for the link or button.&lt;br /&gt;
; url [moodle_url] : the url for the action to take when the user interacts with this action.&lt;br /&gt;
; description : a description of the action. Typically used within a title or alt attribute.&lt;br /&gt;
; active : True if this is the action the user is current performing.&lt;br /&gt;
; enabled : True if the action is possible, false if it is not possible and should be shown as disabled.&lt;br /&gt;
; dimmed : True if the action should be shown as dimmed, usually used to the action is hidden to other users.&lt;br /&gt;
; method : The preferred method of submitting this action, typically GET but can be set to POST.&lt;br /&gt;
&lt;br /&gt;
It is also possible to add JavaScript actions (component_action objects) to an action. These attach a JS listener to the action that gets executed when the user interacts with the action.&lt;br /&gt;
Attached JavaScript actions get initialised when the properties for the action are retrieved so any events must be attached BEFORE the action is rendered, and all renderers must ensure they use the get_attributes() call. &lt;br /&gt;
&lt;br /&gt;
==Grids==&lt;br /&gt;
&lt;br /&gt;
We need to come up with some way to include grids in core, it is desirable to keep it framework agnostic so perhaps a grid object that allows for items to be added and a &amp;quot;width&amp;quot; specified when that occurs. The width would be either a fixed number or a percentage. Steps of 12 seems pretty common.&lt;br /&gt;
&lt;br /&gt;
==Design requirements==&lt;br /&gt;
The following concepts need to be accounted for in core, or decisions made on how we choose to support these and where.&lt;br /&gt;
&lt;br /&gt;
===Clearfix===&lt;br /&gt;
We have this in core already, bootstrap has it, pretty much every front end framework has it.&lt;br /&gt;
Clearfix is more of a design decision, should only be used when require, and only ever applied by a renderer.&lt;br /&gt;
This gets special mention as being important, support is already 100%.&lt;br /&gt;
&lt;br /&gt;
===Floats===&lt;br /&gt;
Pull left, pull right etc. These are a design decisions and should be implemented by the renderer. Bootstrap caters for these and as such they will be easily catered for in bootstrapbase, however work may be required to get them operational in base.&lt;br /&gt;
&lt;br /&gt;
==Discarded ideas==&lt;br /&gt;
The following things are ideas that came up during discussions on what elements are, and what elements we want in core that have being discarded.&lt;br /&gt;
&lt;br /&gt;
==Core atoms, molecules, and organisms==&lt;br /&gt;
&lt;br /&gt;
The following is the atoms, molecules and organisms we believe should be created initially. Of course there will be many more that are required - however this should give us a good grounding of elements to work with for the first conversions.&lt;br /&gt;
&lt;br /&gt;
===Action {atom}===&lt;br /&gt;
See the section above about [[#The user action]]&lt;br /&gt;
&lt;br /&gt;
Actions are special atoms the represent an action the user can make.&lt;br /&gt;
They can be rendered by a theme as a link, a button or I suppose anything else.&lt;br /&gt;
There should be a default for when it is not specified and the renderer in change of producing the current thing can decide whether to use the default and just call &#039;&#039;render&#039;&#039; or if it requires something specific &#039;&#039;render_link&#039;&#039; or &#039;&#039;render_button&#039;&#039; as required.&lt;br /&gt;
&lt;br /&gt;
===Action group {molecule}===&lt;br /&gt;
A group of actions, to be rendered to reflect a relation. I suppose the easiest way to think about this is how buttons in the atto editor are grouped together. It is a requirement that may seem a tad absrtracted and irrelevant at first but I think will pop up in several places throughout Moodle when we start converting.&lt;br /&gt;
&lt;br /&gt;
It is basically a collection of actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#buttonGroups Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/components/#btn-groups Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/button_groups.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
===Block {atom}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle. This represents a block on the page, and is displayed within a [[#Block region]].&lt;br /&gt;
It accepts two arguments, the first is a &#039;&#039;block_contents&#039;&#039; object instance, and the second is the region name the block instance is being shown within.&lt;br /&gt;
&lt;br /&gt;
At present a block is rendered using the &#039;&#039;&#039;&#039;&#039;core_render::block&#039;&#039;&#039;&#039;&#039; method. Internally this calls several renderer methods to produce the different parts of a block.&lt;br /&gt;
* core_renderer::block_header - Produces a header&lt;br /&gt;
** core_renderer::block_controls - Produces controls to display within the header.&lt;br /&gt;
* core_renderer::block_content - Produces the actual content of the block.&lt;br /&gt;
** core_renderer::block_controls - Used to check if block controls were rendered. PUKE!!!&lt;br /&gt;
** core_renderer::block_footer - Produces a footer that actually resides within the content.&lt;br /&gt;
* core_renderer::block_annotation - Produces an annotation, used VERY rarely.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output when called for a navigation block with a bit of extra added to show how a footer is displayed and an annotation.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#sb-1&amp;quot; class=&amp;quot;skip-block&amp;quot;&amp;gt;Skip Navigation&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;inst4&amp;quot; class=&amp;quot;block_navigation  block&amp;quot; role=&amp;quot;navigation&amp;quot; data-block=&amp;quot;navigation&amp;quot; data-instanceid=&amp;quot;4&amp;quot; aria-labelledby=&amp;quot;instance-4-header&amp;quot; data-dockable=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;block_action&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;!-- Block actions go here, they are images with JS or anchors--&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;h2 id=&amp;quot;instance-4-header&amp;quot;&amp;gt;Navigation&amp;lt;/h2&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;content&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;!-- Block content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;div class=&amp;quot;footer&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;!-- Block footer content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;blockannotation&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Block annotation content goes here --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;sb-1&amp;quot; class=&amp;quot;skip-block-to&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Block region {molecule}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle, the block region is a contain for all of the blocks in one location.&lt;br /&gt;
We currently have two methods that produce a block region within Moodle, the first is &#039;&#039;&#039;&#039;&#039;core_renderer::blocks_for_region&#039;&#039;&#039;&#039;&#039; which adds no surrounding content.&lt;br /&gt;
The preferred method &#039;&#039;&#039;&#039;&#039;core_renderer::blocks&#039;&#039;&#039;&#039;&#039; adds some embedded information to a common structure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the structure of the &#039;&#039;core_renderer::blocks()&#039;&#039; method.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function blocks($region, $classes = array(), $tag = &#039;aside&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following is the html output is $region was &#039;&#039;pre&#039;&#039; and the default tag and classes were used.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot; data-blockregion=&amp;quot;pre&amp;quot; data-droptarget=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Thoughts on this&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The blocks method is a convenience method and serves an important purpose. However it should not take classes and tag as arguments.&amp;lt;br /&amp;gt;&lt;br /&gt;
These should certainly only settable within the renderer itself, and if themes wish to change this without wrapping the call they should override the renderer.&lt;br /&gt;
&lt;br /&gt;
Both the data attributes relate to servicing JavaScript functionality. Perhaps they should be moved to a component_action or somehow else integrated with JS rather than with the renderer directly.&lt;br /&gt;
&lt;br /&gt;
Internally it is calling blocks for region, however this should change it should request a array of blocks, convert the array to [[#Block]] elements and call render on each.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Proposed HTML structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Much like the current structure but with the data attributes coming through a JS mechanism.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Breadcrumb {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently called the navbar within Moodle, controlled by the &#039;&#039;&#039;&#039;&#039;navbar&#039;&#039;&#039;&#039;&#039; class located in lib/navigationlib.php and rendered by &#039;&#039;&#039;&#039;&#039;core_renderer::navbar()&#039;&#039;&#039;&#039;&#039;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Internally it calls moodle_page-&amp;gt;navbar-&amp;gt;get_items() to get an array containing navigation node items to display in the navigation bar.&amp;lt;br /&amp;gt;&lt;br /&gt;
It produces a bit of surrounding structure before calling render on each item.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following shows the structure for two items in the navigation bar presently within Moodle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;Page path&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;nav class=&amp;quot;breadcrumb-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/nav&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the excessive amount of markup to make the separator accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#breadcrumbs Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#breadcrumbs Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/breadcrumbs.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The currently active page should be marked with a class.&lt;br /&gt;
* The current item should probably not be a link MDL-46037&lt;br /&gt;
* [http://www.w3.org/TR/2007/WD-aria-role-20070601/#breadcrumbs wia-aria breadcrumb role]&lt;br /&gt;
* The divider perhaps could come through CSS with these changes to avoid markup necessary to make it accessible (in combination with the above).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation thoughts&#039;&#039;&#039;&lt;br /&gt;
* Owns an array of [#Action {atoms}]&lt;br /&gt;
&lt;br /&gt;
===Buttons {atom}===&lt;br /&gt;
&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&amp;lt;br /&amp;gt;&lt;br /&gt;
Obviously buttons can serve different purposes and roles so have several easily reachable customisations is probably a wise idea.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
None, presently you produce a button when you need it so there are several throughout Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/base-css.html#buttons Bootstrap 2.3.2] and [http://getbootstrap.com/css/#buttons Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;btn btn-default&amp;quot;&amp;gt;Default&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;btn btn-default btn-lg active&amp;quot; role=&amp;quot;button&amp;quot;&amp;gt;Link&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;input class=&amp;quot;btn btn-default&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Input&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Bootstrap:&lt;br /&gt;
* Purposes: default, primary, success, info, warning, danger, link&lt;br /&gt;
* Sizes: large, default, small, extra-small&lt;br /&gt;
* Block level (wider)&lt;br /&gt;
* States: Active, disabled.&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/buttons.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;button&amp;quot;&amp;gt;Default Button&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Zurb Foundation:&lt;br /&gt;
* Purposes: default, secondary, success, alert&lt;br /&gt;
* Sizes: large, default, small, tiny&lt;br /&gt;
* Corner style: radius, round&lt;br /&gt;
* Expanded (wider)&lt;br /&gt;
* States: disabled&lt;br /&gt;
&lt;br /&gt;
===Calendar {organism}===&lt;br /&gt;
&lt;br /&gt;
A simple idea really, apparently not already covered by the frontend frameworks being referenced during the creation of the doc.&lt;br /&gt;
The display of the calendar is fixed, but it can contain content for each day shown.&lt;br /&gt;
&lt;br /&gt;
The calendar should have several views, perhaps these are separate organisms, perhaps not.&lt;br /&gt;
&lt;br /&gt;
* Compact month&lt;br /&gt;
* Month&lt;br /&gt;
* Week&lt;br /&gt;
* Day&lt;br /&gt;
&lt;br /&gt;
Each day could:&lt;br /&gt;
* Contain an action with an icon for events, and link to the fullday display.&lt;br /&gt;
* Have an associated action to load and display the events in a tooltip.&lt;br /&gt;
&lt;br /&gt;
===Collapsible region {molecule}===&lt;br /&gt;
&lt;br /&gt;
We use these in several places within Moodle. I could not find a reference to this concept in any of the frontend frameworks I looked at.&lt;br /&gt;
The concept is simple - you have a heading and an icon with content. By default the content is hidden, when the user clicks the heading and/or the icon the content is revealed.&lt;br /&gt;
&lt;br /&gt;
As noted we do this in several places within Moodle, it would be good to have a single way of displaying this idea of a collapsible region.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
* It should support an optional collapse/expand all trigger action.&lt;br /&gt;
* We want to be able to use it both inside and outside of forms.&lt;br /&gt;
* It should be usable in situations like the combo list frontpage component as well.&lt;br /&gt;
* Will obviously have a JS component as without JS it would not work.&lt;br /&gt;
&lt;br /&gt;
===Confirmation {molecule}===&lt;br /&gt;
&lt;br /&gt;
A simple concept used regularly in Moodle to confirm a users intention to perform an actions. Most commonly seeing when deleting content.&lt;br /&gt;
The structure is relatively basic in Moodle at present.&lt;br /&gt;
* A message&lt;br /&gt;
* A forwards button&lt;br /&gt;
* A back button&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The method &#039;&#039;&#039;&#039;&#039;core_renderer::confirm&#039;&#039;&#039;&#039;&#039; does the rendering at present. Its signature is as follows:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function confirm($message, $continue, $cancel);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output it produces is like:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;generalbox&amp;quot; id=&amp;quot;notice&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;The message goes here&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Two buttons produced by core_renderer::render_single_button() --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design throughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This component does not have a title. I believe at present some pages use &#039;&#039;core_renderer::heading&#039;&#039; to produce a title if they wish. Obviously we want consistency of style so I believe it would be wise to add a title property that can be optionally set and then in our documentation for this element recommend that a title is always provided.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will mean re-factoring our uses to set a title and if a heading is being manually added remove it.&lt;br /&gt;
&lt;br /&gt;
===Continue {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is much like the confirmation molecule but with a single button.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present we have &#039;&#039;&#039;&#039;&#039;core_renderer::continue_button&#039;&#039;&#039;&#039;&#039; that produces a single button. However this design is very poor as more often than not a message is included in the page to describe the purpose of the continue button. This is really an integral part of the continue button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Currently we have &#039;&#039;core_renderer::continue_button&#039;&#039; to render a single continue button.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function continue_button($url);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally it creates a single_button component and then calls render on that.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
Our element should have a message and a button. To make it easy to migrate the constructor should accept a URL instead of a button and do the same conversion as the current method is doing.&lt;br /&gt;
&lt;br /&gt;
===Choice {molecule}===&lt;br /&gt;
Not sure about this one quite yet.&lt;br /&gt;
A description with 2 or more actions allowing the user to select the next step.&lt;br /&gt;
Think of it like when editing a module you get: Cancel, Save and return to course, Save and display&lt;br /&gt;
&lt;br /&gt;
Perhaps both [#Confirmation {molecule}] and [#Continue {molecule}] should be just instances of this.&lt;br /&gt;
&lt;br /&gt;
Hmm perhaps that would not be as clear as this and we should have this separate choice molecule.&lt;br /&gt;
&lt;br /&gt;
===Divider {atom}===&lt;br /&gt;
Think horizontal rule.&lt;br /&gt;
&lt;br /&gt;
===Dropdowns {molecule}===&lt;br /&gt;
&lt;br /&gt;
So this is a pretty simple concept, but you&#039;ve got to think of it as a separate entity. A dropdown is a menu that appears when the user interacts with an action.&lt;br /&gt;
 &lt;br /&gt;
The action could take one of three forms:&lt;br /&gt;
* From button&lt;br /&gt;
* From link&lt;br /&gt;
* From icon&lt;br /&gt;
&lt;br /&gt;
Of course that is handled by the [#Action {atom}] noted above. Worth noting is that we will need some way to toggle these actions as dropdowns. Perhaps it is worth making that a property of the action atom.&lt;br /&gt;
&lt;br /&gt;
The dropdown itself will likely contain more actions, and I suppose additional dropdowns to form sub menus. Sub-menus in my mind are required. We don&#039;t use them in core, but they are functionally possible through things like the custom menu and I know for a fact that many sites have sub menus.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#dropdowns Bootstrap 2.3.2]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Link or button to toggle dropdown --&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dLabel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#dropdowns Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;button class=&amp;quot;btn dropdown-toggle sr-only&amp;quot; type=&amp;quot;button&amp;quot; id=&amp;quot;dropdownMenu1&amp;quot; data-toggle=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
        Dropdown&lt;br /&gt;
        &amp;lt;span class=&amp;quot;caret&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/button&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dropdownMenu1&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot; class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/dropdown.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; data-dropdown=&amp;quot;drop1&amp;quot;&amp;gt;Has Dropdown&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;ul id=&amp;quot;drop1&amp;quot; class=&amp;quot;f-dropdown&amp;quot; data-dropdown-content&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is a link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Yet another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forms {organism}===&lt;br /&gt;
&lt;br /&gt;
This is an advanced  organism and would be quite a bit of work to create in Moodle as we&#039;d need to translate from QuickForms to elements for rendering.&lt;br /&gt;
It would be worthwhile doing this however, and would be a good way of quickly showing our new work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework structures&#039;&#039;&#039;&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/base-css.html#forms Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/css/#forms Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/forms.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
All of those are quite in-depth and offer a range of configurations.&lt;br /&gt;
We should carefully consider these when analysing our work here.&lt;br /&gt;
&lt;br /&gt;
===Headings {atom}===&lt;br /&gt;
&lt;br /&gt;
Currently handled by &#039;&#039;&#039;core_renderer::heading&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* h1 - h6&lt;br /&gt;
* Optional icon&lt;br /&gt;
* Optional help icon&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method is currently:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function heading($text, $level = 2, $classes = null, $id = null);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output generated by this is, assuming we use the default level, classes, and id.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;I am a heading&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Whats worth noting is that the render method should not accept level and classes as arguments.&lt;br /&gt;
These should only be set by the render method and should not be directly influenced.&lt;br /&gt;
&lt;br /&gt;
===Image {atom}===&lt;br /&gt;
&lt;br /&gt;
There are really two types of images to focus on here, or really two ways to display an image to focus on here.&amp;lt;br /&amp;gt;&lt;br /&gt;
# Standard images&lt;br /&gt;
# Thumbnail images&lt;br /&gt;
&lt;br /&gt;
Each of these would share some common properties:&lt;br /&gt;
* Image&lt;br /&gt;
* Description (alt/title)&lt;br /&gt;
* Size&lt;br /&gt;
* Action (making it a link) - This would actually make it a molecule, we would have to consider this and either have a new element, drop the ability to wrap in an action, or simply ignore this inconsistency.&lt;br /&gt;
&lt;br /&gt;
===Image - Icon {atom}===&lt;br /&gt;
&lt;br /&gt;
This covers the display of an icon. Should be a separate element from image as really they should be treated individually.&lt;br /&gt;
Within Moodle there are a few classifications of icons to consider:&lt;br /&gt;
* Standard icons&lt;br /&gt;
* Help icon (popup, tooltip)&lt;br /&gt;
* Loading icon (really regular icon but worth showing separately as its only seen when required)&lt;br /&gt;
&lt;br /&gt;
===Image - Logo {molecule}===&lt;br /&gt;
&lt;br /&gt;
We don&#039;t have this within core Moodle at present, however just about every theme I have seen uses a logo. I think it is about time we considered having a logo element.&lt;br /&gt;
I imagine it would become a sort of hero element, likely with an associated action (back home by default).&lt;br /&gt;
&lt;br /&gt;
===Image - Profile picture {molecule}===&lt;br /&gt;
&lt;br /&gt;
We already have a user_picture component within Moodle. It can be found in lib/outputcomponents.php.&amp;lt;br /&amp;gt;&lt;br /&gt;
It has two render methods, &#039;&#039;&#039;&#039;&#039;core_renderer::user_picture&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;core_renderer::render_user_picture&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output structure for the user picture:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; id=&amp;quot;userpicture_randomid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;img src=&amp;quot;#&amp;quot; alt=&amp;quot;Picture of Joe&amp;quot; title=&amp;quot;Picture of Joe&amp;quot; class=&amp;quot;userpicture&amp;quot; width=&amp;quot;[35, 100, XX]&amp;quot; height=&amp;quot;[35, 100, XX]&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What you&#039;ll notice about this is that the link has no attributes marking it as a user picture link.&lt;br /&gt;
&lt;br /&gt;
The PHP code for the user_picture object itself is really quite in depth and complex. The component serves the user profile fields required to render a user picture. This is good in the scope of the component but would be bad within the scope of an element.&amp;lt;br /&amp;gt;&lt;br /&gt;
Don&#039;t you wish we had a proper user object!&lt;br /&gt;
&lt;br /&gt;
===Link {atom}===&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&lt;br /&gt;
&lt;br /&gt;
Theres not too much more to explain about links, they don&#039;t tend to take states other than the default active, enabled and dimmed.&amp;lt;br /&amp;gt;&lt;br /&gt;
It is worth mentioning that devs will be encouraged to use actions and not links unless absolutely necessary.&amp;lt;br /&amp;gt;&lt;br /&gt;
The render method for this atom must typehint an action rather than a link.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prototype example&#039;&#039;&#039;&lt;br /&gt;
* The atom: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/link.php&lt;br /&gt;
* The convenience method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L149&lt;br /&gt;
* The render method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L211&lt;br /&gt;
&lt;br /&gt;
===List {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is a pretty simple example and something I am sure you are all familiar with. A list is simply a collection of items. Usually represented using a UL or OL tag in markup although worth noting can be styled completely differently to the default.&lt;br /&gt;
There are three main types of lists used within Moodle:&lt;br /&gt;
* Ordered list&lt;br /&gt;
* Unordered list&lt;br /&gt;
* Presentation list (currently our unlist)&lt;br /&gt;
&lt;br /&gt;
The list is a molecule because it should be able to accept other elements as items. E.g. it should be content independent.&lt;br /&gt;
&lt;br /&gt;
===Menu {molecule}===&lt;br /&gt;
&lt;br /&gt;
A menu is a familiar concept for any site. Probably the first thing that pops to mind for many is the navbar, but I want to consider that a separate component as a navbar can consist of more than just menu items.&lt;br /&gt;
I think a menu should be a collection of actions the user can perform. Perhaps with some form of hierarchy.&lt;br /&gt;
&lt;br /&gt;
We have different types of menus within Moodle:&lt;br /&gt;
* The custom menu is one users can directly create, with dropdown downs and sub dropdowns.&lt;br /&gt;
* The action_menu component we have in core uses icons as actions and can have a dropdown.&lt;br /&gt;
&lt;br /&gt;
These should be combined into a single menu element that takes items as an argument, likely actions + dropdowns + dividers to start with would be perfect.&lt;br /&gt;
&lt;br /&gt;
We would likely need to deal with the display of the menu with properties to allow constructing code to &#039;&#039;request&#039;&#039; a particular style of menu. The renderer should be what actually gets to decide, but for the purposes of re-use having properties and a single render_method is better than having multiple render methods.&amp;lt;br /&amp;gt;&lt;br /&gt;
The following is my initial thoughts on menu structure:&lt;br /&gt;
* Direction: Horizontal, Vertical&lt;br /&gt;
* Design: Default, Tabs, &lt;br /&gt;
* Style: Default, Links, Buttons, Icons&lt;br /&gt;
&lt;br /&gt;
===Notification {atom}===&lt;br /&gt;
* Info&lt;br /&gt;
* Success&lt;br /&gt;
* Warning&lt;br /&gt;
* Danger&lt;br /&gt;
&lt;br /&gt;
===Navigation bar {organism}===&lt;br /&gt;
Formerly navbar, can&#039;t be called that because the render method would conflict.&lt;br /&gt;
&lt;br /&gt;
The navigation bar is just that, it is becoming increasingly common on the web and usually contains a title or logo, a menu, and information pertaining to the user state (login, language etc).&lt;br /&gt;
&lt;br /&gt;
===Page header {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently being produced by &#039;&#039;&#039;core_renderer::page_heading&#039;&#039;&#039; this is simply a header for the page, by default the only h1 element on the page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method has the following signature:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function page_heading($tag = &#039;h1&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output from the above method is:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;The page heading (from moodle_page::heading)&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The core_renderer method should not allow the tag to be set. The page heading should always be H1.&lt;br /&gt;
If its not an H1 then page header should not be used.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework examples&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#typography Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;hero-unit&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Heading&amp;lt;/h1&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;Tagline&amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
    &amp;lt;a class=&amp;quot;btn btn-primary btn-large&amp;quot;&amp;gt;&lt;br /&gt;
      Learn more&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#page-header Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Example page header &amp;lt;small&amp;gt;Subtext for header&amp;lt;/small&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Foundation doesn&#039;t appear to have a page header component.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* In Moodle all page headings are set as a single string, we won&#039;t be changing this.&lt;br /&gt;
* Usually just a plain string sometimes an icon is used, and sometimes a help icon is used.&lt;br /&gt;
&lt;br /&gt;
===Pagination {molecule}===&lt;br /&gt;
&lt;br /&gt;
I like the idea of this being separate to a menu, and to other navigation oriented elements because it should be something that can easily be constructed with a few basic parameters and allow us to achieve consistent pagination throughout Moodle.&amp;lt;br /&amp;gt;&lt;br /&gt;
It also appeals because this is something that people may want to style differently to their navigation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#pagination Bootstrap 2.3.2 pagination]&lt;br /&gt;
* [http://getbootstrap.com/components/#pagination Bootstrap 3 pagination]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/pagination.html Zurb foundation pagination]&lt;br /&gt;
&lt;br /&gt;
===Progress bars {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty simple concept, we already have a couple of ways of producing progress bars within Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#progress Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;bar&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 2.3.2:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#progress Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- With label --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60% Complete&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Label is hidden but accessible --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60%&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 3:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/progress_bars.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;span class=&amp;quot;meter&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Zurb foundation:&lt;br /&gt;
* Width &lt;br /&gt;
* Colours: default (blue), secondary (grey), success (green), alert (red)&lt;br /&gt;
* Corner style: default (square), radius (slight rounding), round&lt;br /&gt;
&lt;br /&gt;
===Search {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty common interface molecule, and in fact used as an example in the atomic design blog post we keep referencing.&amp;lt;br /&amp;gt;&lt;br /&gt;
We don&#039;t have a component for searching yet, however we&#039;ve several search boxes throughout Moodle. The admin setting search box is the first to come to mind for me, followed by the forum search box and course search box.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Constructed of the following items:&lt;br /&gt;
* Text input&lt;br /&gt;
* Action (must be a button for submit I imagine)&lt;br /&gt;
* Label or short description (optional)&lt;br /&gt;
* Collapsible region containing settings etc (optional)&lt;br /&gt;
&lt;br /&gt;
===Table {organism}===&lt;br /&gt;
&lt;br /&gt;
We&#039;ve two primary table components within Moodle presently &#039;&#039;&#039;html_table&#039;&#039;&#039; and &#039;&#039;&#039;flexible_table&#039;&#039;&#039; both of which offer different advantages and disadvantages. This will be a challenge and will really require some proper research and community interaction.&lt;br /&gt;
&lt;br /&gt;
===Timer {atom|molecule}===&lt;br /&gt;
&lt;br /&gt;
... not sure about this one, but we do use it in a couple of places, and we use it on all core sites that have hourly resets so in a way it makes sense to support it and allow it to be styled nicely and easily.&lt;br /&gt;
&lt;br /&gt;
===Tree {organism}===&lt;br /&gt;
&lt;br /&gt;
===User badge===&lt;br /&gt;
&lt;br /&gt;
===User content===&lt;br /&gt;
&lt;br /&gt;
Think of this like the forum post. We need a common structure in which to display content entered by the user along with information on the user. The users name, picture, date perhaps, title, content, footer (attachments, badges, what ever).&lt;br /&gt;
It could be applied to things like forum posts, calendar events etc.&lt;br /&gt;
&lt;br /&gt;
At present we have no abstraction for this.&lt;br /&gt;
&lt;br /&gt;
==Existing renderables and what they will become==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Existing renderable&lt;br /&gt;
! Description&lt;br /&gt;
! Future renderable&lt;br /&gt;
! Convenience method (if different)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu&lt;br /&gt;
| UI component for a drop down edit menu&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link&lt;br /&gt;
| UI component for a menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_filler&lt;br /&gt;
| UI component for a filler menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_primary&lt;br /&gt;
| UI component for a primary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_secondary&lt;br /&gt;
| UI component for a secondary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_link&lt;br /&gt;
| Link with alt text, and an icon&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_button&lt;br /&gt;
| A form with a single button&lt;br /&gt;
| button (action with post method)&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| confirm&lt;br /&gt;
| A form with a message and cancel/confirm buttons&lt;br /&gt;
| confirmation&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_select&lt;br /&gt;
| A form with a single drop down list that submits on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| url_select&lt;br /&gt;
| A navigation element consisting of a single drop down list of urls that navigates on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| doc_link&lt;br /&gt;
| A link to the Moodle docs&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pix_icon&lt;br /&gt;
| A small icon&lt;br /&gt;
| icon&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| emoticon_icon&lt;br /&gt;
| A small emoticon&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading_with_help&lt;br /&gt;
| A page heading with a link to help docs&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| icon_help&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon_scale&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_picture&lt;br /&gt;
| A user profile picture which links to their profile&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| container&lt;br /&gt;
| A block level element used to surround something. Can have a class to allow specific targeting with CSS.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| error_text&lt;br /&gt;
| An error to show to the user.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| notification&lt;br /&gt;
| A message for the user&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| continue_button&lt;br /&gt;
| A message and a button to continue to the next page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| paging_bar&lt;br /&gt;
| A list of next previous and specific page links&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_to&lt;br /&gt;
| A link to a section on the page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_target&lt;br /&gt;
| A target for a matching skip_link_to call&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading&lt;br /&gt;
| A page heading&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| box&lt;br /&gt;
| A page section with a border&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rarrow&lt;br /&gt;
| A right arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| larrow&lt;br /&gt;
| A left arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| tabtree&lt;br /&gt;
| A list of tabs&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| tabobject&lt;br /&gt;
| A single tab panel&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Render_library_element_planning&amp;diff=45557</id>
		<title>User:Sam Hemelryk/Render library element planning</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Render_library_element_planning&amp;diff=45557"/>
		<updated>2014-06-27T02:05:22Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Timer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45829&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
This page documents the proposed core elements, variations of them, what we expect they will contain, and the core_renderer block.&lt;br /&gt;
&lt;br /&gt;
==The user action==&lt;br /&gt;
&lt;br /&gt;
An action in this sense is a collection of data that all pertains to one action that can be taken by the user.&lt;br /&gt;
The action, once populated with data can be rendered as is required for the job it is going to fulfil, usually with some relation to the frontend framework in use.&lt;br /&gt;
In this way the action could be a link, or a button; it could even be interpreted into a more complex structure.&lt;br /&gt;
&lt;br /&gt;
An action has the following properties:&lt;br /&gt;
; content [string]: text content for the link or button.&lt;br /&gt;
; url [moodle_url] : the url for the action to take when the user interacts with this action.&lt;br /&gt;
; description : a description of the action. Typically used within a title or alt attribute.&lt;br /&gt;
; active : True if this is the action the user is current performing.&lt;br /&gt;
; enabled : True if the action is possible, false if it is not possible and should be shown as disabled.&lt;br /&gt;
; dimmed : True if the action should be shown as dimmed, usually used to the action is hidden to other users.&lt;br /&gt;
; method : The preferred method of submitting this action, typically GET but can be set to POST.&lt;br /&gt;
&lt;br /&gt;
It is also possible to add JavaScript actions (component_action objects) to an action. These attach a JS listener to the action that gets executed when the user interacts with the action.&lt;br /&gt;
Attached JavaScript actions get initialised when the properties for the action are retrieved so any events must be attached BEFORE the action is rendered, and all renderers must ensure they use the get_attributes() call. &lt;br /&gt;
&lt;br /&gt;
==Grids==&lt;br /&gt;
&lt;br /&gt;
We need to come up with some way to include grids in core, it is desirable to keep it framework agnostic so perhaps a grid object that allows for items to be added and a &amp;quot;width&amp;quot; specified when that occurs. The width would be either a fixed number or a percentage. Steps of 12 seems pretty common.&lt;br /&gt;
&lt;br /&gt;
==Design requirements==&lt;br /&gt;
The following concepts need to be accounted for in core, or decisions made on how we choose to support these and where.&lt;br /&gt;
&lt;br /&gt;
===Clearfix===&lt;br /&gt;
We have this in core already, bootstrap has it, pretty much every front end framework has it.&lt;br /&gt;
Clearfix is more of a design decision, should only be used when require, and only ever applied by a renderer.&lt;br /&gt;
This gets special mention as being important, support is already 100%.&lt;br /&gt;
&lt;br /&gt;
===Floats===&lt;br /&gt;
Pull left, pull right etc. These are a design decisions and should be implemented by the renderer. Bootstrap caters for these and as such they will be easily catered for in bootstrapbase, however work may be required to get them operational in base.&lt;br /&gt;
&lt;br /&gt;
==Discarded ideas==&lt;br /&gt;
The following things are ideas that came up during discussions on what elements are, and what elements we want in core that have being discarded.&lt;br /&gt;
&lt;br /&gt;
==Core atoms, molecules, and organisms==&lt;br /&gt;
&lt;br /&gt;
The following is the atoms, molecules and organisms we believe should be created initially. Of course there will be many more that are required - however this should give us a good grounding of elements to work with for the first conversions.&lt;br /&gt;
&lt;br /&gt;
===Action {atom}===&lt;br /&gt;
See the section above about [[#The user action]]&lt;br /&gt;
&lt;br /&gt;
Actions are special atoms the represent an action the user can make.&lt;br /&gt;
They can be rendered by a theme as a link, a button or I suppose anything else.&lt;br /&gt;
There should be a default for when it is not specified and the renderer in change of producing the current thing can decide whether to use the default and just call &#039;&#039;render&#039;&#039; or if it requires something specific &#039;&#039;render_link&#039;&#039; or &#039;&#039;render_button&#039;&#039; as required.&lt;br /&gt;
&lt;br /&gt;
===Action group {molecule}===&lt;br /&gt;
A group of actions, to be rendered to reflect a relation. I suppose the easiest way to think about this is how buttons in the atto editor are grouped together. It is a requirement that may seem a tad absrtracted and irrelevant at first but I think will pop up in several places throughout Moodle when we start converting.&lt;br /&gt;
&lt;br /&gt;
It is basically a collection of actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#buttonGroups Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/components/#btn-groups Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/button_groups.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
===Block {atom}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle. This represents a block on the page, and is displayed within a [[#Block region]].&lt;br /&gt;
It accepts two arguments, the first is a &#039;&#039;block_contents&#039;&#039; object instance, and the second is the region name the block instance is being shown within.&lt;br /&gt;
&lt;br /&gt;
At present a block is rendered using the &#039;&#039;&#039;&#039;&#039;core_render::block&#039;&#039;&#039;&#039;&#039; method. Internally this calls several renderer methods to produce the different parts of a block.&lt;br /&gt;
* core_renderer::block_header - Produces a header&lt;br /&gt;
** core_renderer::block_controls - Produces controls to display within the header.&lt;br /&gt;
* core_renderer::block_content - Produces the actual content of the block.&lt;br /&gt;
** core_renderer::block_controls - Used to check if block controls were rendered. PUKE!!!&lt;br /&gt;
** core_renderer::block_footer - Produces a footer that actually resides within the content.&lt;br /&gt;
* core_renderer::block_annotation - Produces an annotation, used VERY rarely.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output when called for a navigation block with a bit of extra added to show how a footer is displayed and an annotation.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#sb-1&amp;quot; class=&amp;quot;skip-block&amp;quot;&amp;gt;Skip Navigation&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;inst4&amp;quot; class=&amp;quot;block_navigation  block&amp;quot; role=&amp;quot;navigation&amp;quot; data-block=&amp;quot;navigation&amp;quot; data-instanceid=&amp;quot;4&amp;quot; aria-labelledby=&amp;quot;instance-4-header&amp;quot; data-dockable=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;block_action&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;!-- Block actions go here, they are images with JS or anchors--&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;h2 id=&amp;quot;instance-4-header&amp;quot;&amp;gt;Navigation&amp;lt;/h2&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;content&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;!-- Block content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;div class=&amp;quot;footer&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;!-- Block footer content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;blockannotation&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Block annotation content goes here --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;sb-1&amp;quot; class=&amp;quot;skip-block-to&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Block region {molecule}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle, the block region is a contain for all of the blocks in one location.&lt;br /&gt;
We currently have two methods that produce a block region within Moodle, the first is &#039;&#039;&#039;&#039;&#039;core_renderer::blocks_for_region&#039;&#039;&#039;&#039;&#039; which adds no surrounding content.&lt;br /&gt;
The preferred method &#039;&#039;&#039;&#039;&#039;core_renderer::blocks&#039;&#039;&#039;&#039;&#039; adds some embedded information to a common structure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the structure of the &#039;&#039;core_renderer::blocks()&#039;&#039; method.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function blocks($region, $classes = array(), $tag = &#039;aside&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following is the html output is $region was &#039;&#039;pre&#039;&#039; and the default tag and classes were used.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot; data-blockregion=&amp;quot;pre&amp;quot; data-droptarget=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Thoughts on this&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The blocks method is a convenience method and serves an important purpose. However it should not take classes and tag as arguments.&amp;lt;br /&amp;gt;&lt;br /&gt;
These should certainly only settable within the renderer itself, and if themes wish to change this without wrapping the call they should override the renderer.&lt;br /&gt;
&lt;br /&gt;
Both the data attributes relate to servicing JavaScript functionality. Perhaps they should be moved to a component_action or somehow else integrated with JS rather than with the renderer directly.&lt;br /&gt;
&lt;br /&gt;
Internally it is calling blocks for region, however this should change it should request a array of blocks, convert the array to [[#Block]] elements and call render on each.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Proposed HTML structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Much like the current structure but with the data attributes coming through a JS mechanism.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Breadcrumb {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently called the navbar within Moodle, controlled by the &#039;&#039;&#039;&#039;&#039;navbar&#039;&#039;&#039;&#039;&#039; class located in lib/navigationlib.php and rendered by &#039;&#039;&#039;&#039;&#039;core_renderer::navbar()&#039;&#039;&#039;&#039;&#039;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Internally it calls moodle_page-&amp;gt;navbar-&amp;gt;get_items() to get an array containing navigation node items to display in the navigation bar.&amp;lt;br /&amp;gt;&lt;br /&gt;
It produces a bit of surrounding structure before calling render on each item.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following shows the structure for two items in the navigation bar presently within Moodle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;Page path&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;nav class=&amp;quot;breadcrumb-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/nav&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the excessive amount of markup to make the separator accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#breadcrumbs Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#breadcrumbs Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/breadcrumbs.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The currently active page should be marked with a class.&lt;br /&gt;
* The current item should probably not be a link MDL-46037&lt;br /&gt;
* [http://www.w3.org/TR/2007/WD-aria-role-20070601/#breadcrumbs wia-aria breadcrumb role]&lt;br /&gt;
* The divider perhaps could come through CSS with these changes to avoid markup necessary to make it accessible (in combination with the above).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation thoughts&#039;&#039;&#039;&lt;br /&gt;
* Owns an array of [#Action {atoms}]&lt;br /&gt;
&lt;br /&gt;
===Buttons {atom}===&lt;br /&gt;
&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&amp;lt;br /&amp;gt;&lt;br /&gt;
Obviously buttons can serve different purposes and roles so have several easily reachable customisations is probably a wise idea.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
None, presently you produce a button when you need it so there are several throughout Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/base-css.html#buttons Bootstrap 2.3.2] and [http://getbootstrap.com/css/#buttons Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;btn btn-default&amp;quot;&amp;gt;Default&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;btn btn-default btn-lg active&amp;quot; role=&amp;quot;button&amp;quot;&amp;gt;Link&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;input class=&amp;quot;btn btn-default&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Input&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Bootstrap:&lt;br /&gt;
* Purposes: default, primary, success, info, warning, danger, link&lt;br /&gt;
* Sizes: large, default, small, extra-small&lt;br /&gt;
* Block level (wider)&lt;br /&gt;
* States: Active, disabled.&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/buttons.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;button&amp;quot;&amp;gt;Default Button&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Zurb Foundation:&lt;br /&gt;
* Purposes: default, secondary, success, alert&lt;br /&gt;
* Sizes: large, default, small, tiny&lt;br /&gt;
* Corner style: radius, round&lt;br /&gt;
* Expanded (wider)&lt;br /&gt;
* States: disabled&lt;br /&gt;
&lt;br /&gt;
===Calendar {organism}===&lt;br /&gt;
&lt;br /&gt;
A simple idea really, apparently not already covered by the frontend frameworks being referenced during the creation of the doc.&lt;br /&gt;
The display of the calendar is fixed, but it can contain content for each day shown.&lt;br /&gt;
&lt;br /&gt;
The calendar should have several views, perhaps these are separate organisms, perhaps not.&lt;br /&gt;
&lt;br /&gt;
* Compact month&lt;br /&gt;
* Month&lt;br /&gt;
* Week&lt;br /&gt;
* Day&lt;br /&gt;
&lt;br /&gt;
Each day could:&lt;br /&gt;
* Contain an action with an icon for events, and link to the fullday display.&lt;br /&gt;
* Have an associated action to load and display the events in a tooltip.&lt;br /&gt;
&lt;br /&gt;
===Collapsible region {molecule}===&lt;br /&gt;
&lt;br /&gt;
We use these in several places within Moodle. I could not find a reference to this concept in any of the frontend frameworks I looked at.&lt;br /&gt;
The concept is simple - you have a heading and an icon with content. By default the content is hidden, when the user clicks the heading and/or the icon the content is revealed.&lt;br /&gt;
&lt;br /&gt;
As noted we do this in several places within Moodle, it would be good to have a single way of displaying this idea of a collapsible region.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
* It should support an optional collapse/expand all trigger action.&lt;br /&gt;
* We want to be able to use it both inside and outside of forms.&lt;br /&gt;
* It should be usable in situations like the combo list frontpage component as well.&lt;br /&gt;
* Will obviously have a JS component as without JS it would not work.&lt;br /&gt;
&lt;br /&gt;
===Confirmation {molecule}===&lt;br /&gt;
&lt;br /&gt;
A simple concept used regularly in Moodle to confirm a users intention to perform an actions. Most commonly seeing when deleting content.&lt;br /&gt;
The structure is relatively basic in Moodle at present.&lt;br /&gt;
* A message&lt;br /&gt;
* A forwards button&lt;br /&gt;
* A back button&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The method &#039;&#039;&#039;&#039;&#039;core_renderer::confirm&#039;&#039;&#039;&#039;&#039; does the rendering at present. Its signature is as follows:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function confirm($message, $continue, $cancel);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output it produces is like:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;generalbox&amp;quot; id=&amp;quot;notice&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;The message goes here&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Two buttons produced by core_renderer::render_single_button() --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design throughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This component does not have a title. I believe at present some pages use &#039;&#039;core_renderer::heading&#039;&#039; to produce a title if they wish. Obviously we want consistency of style so I believe it would be wise to add a title property that can be optionally set and then in our documentation for this element recommend that a title is always provided.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will mean re-factoring our uses to set a title and if a heading is being manually added remove it.&lt;br /&gt;
&lt;br /&gt;
===Continue {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is much like the confirmation molecule but with a single button.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present we have &#039;&#039;&#039;&#039;&#039;core_renderer::continue_button&#039;&#039;&#039;&#039;&#039; that produces a single button. However this design is very poor as more often than not a message is included in the page to describe the purpose of the continue button. This is really an integral part of the continue button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Currently we have &#039;&#039;core_renderer::continue_button&#039;&#039; to render a single continue button.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function continue_button($url);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally it creates a single_button component and then calls render on that.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
Our element should have a message and a button. To make it easy to migrate the constructor should accept a URL instead of a button and do the same conversion as the current method is doing.&lt;br /&gt;
&lt;br /&gt;
===Choice {molecule}===&lt;br /&gt;
Not sure about this one quite yet.&lt;br /&gt;
A description with 2 or more actions allowing the user to select the next step.&lt;br /&gt;
Think of it like when editing a module you get: Cancel, Save and return to course, Save and display&lt;br /&gt;
&lt;br /&gt;
Perhaps both [#Confirmation {molecule}] and [#Continue {molecule}] should be just instances of this.&lt;br /&gt;
&lt;br /&gt;
Hmm perhaps that would not be as clear as this and we should have this separate choice molecule.&lt;br /&gt;
&lt;br /&gt;
===Divider {atom}===&lt;br /&gt;
Think horizontal rule.&lt;br /&gt;
&lt;br /&gt;
===Dropdowns {molecule}===&lt;br /&gt;
&lt;br /&gt;
So this is a pretty simple concept, but you&#039;ve got to think of it as a separate entity. A dropdown is a menu that appears when the user interacts with an action.&lt;br /&gt;
 &lt;br /&gt;
The action could take one of three forms:&lt;br /&gt;
* From button&lt;br /&gt;
* From link&lt;br /&gt;
* From icon&lt;br /&gt;
&lt;br /&gt;
Of course that is handled by the [#Action {atom}] noted above. Worth noting is that we will need some way to toggle these actions as dropdowns. Perhaps it is worth making that a property of the action atom.&lt;br /&gt;
&lt;br /&gt;
The dropdown itself will likely contain more actions, and I suppose additional dropdowns to form sub menus. Sub-menus in my mind are required. We don&#039;t use them in core, but they are functionally possible through things like the custom menu and I know for a fact that many sites have sub menus.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#dropdowns Bootstrap 2.3.2]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Link or button to toggle dropdown --&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dLabel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#dropdowns Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;button class=&amp;quot;btn dropdown-toggle sr-only&amp;quot; type=&amp;quot;button&amp;quot; id=&amp;quot;dropdownMenu1&amp;quot; data-toggle=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
        Dropdown&lt;br /&gt;
        &amp;lt;span class=&amp;quot;caret&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/button&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dropdownMenu1&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot; class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/dropdown.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; data-dropdown=&amp;quot;drop1&amp;quot;&amp;gt;Has Dropdown&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;ul id=&amp;quot;drop1&amp;quot; class=&amp;quot;f-dropdown&amp;quot; data-dropdown-content&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is a link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Yet another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forms {organism}===&lt;br /&gt;
&lt;br /&gt;
This is an advanced  organism and would be quite a bit of work to create in Moodle as we&#039;d need to translate from QuickForms to elements for rendering.&lt;br /&gt;
It would be worthwhile doing this however, and would be a good way of quickly showing our new work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework structures&#039;&#039;&#039;&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/base-css.html#forms Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/css/#forms Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/forms.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
All of those are quite in-depth and offer a range of configurations.&lt;br /&gt;
We should carefully consider these when analysing our work here.&lt;br /&gt;
&lt;br /&gt;
===Headings {atom}===&lt;br /&gt;
&lt;br /&gt;
Currently handled by &#039;&#039;&#039;core_renderer::heading&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* h1 - h6&lt;br /&gt;
* Optional icon&lt;br /&gt;
* Optional help icon&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method is currently:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function heading($text, $level = 2, $classes = null, $id = null);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output generated by this is, assuming we use the default level, classes, and id.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;I am a heading&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Whats worth noting is that the render method should not accept level and classes as arguments.&lt;br /&gt;
These should only be set by the render method and should not be directly influenced.&lt;br /&gt;
&lt;br /&gt;
===Image {atom}===&lt;br /&gt;
&lt;br /&gt;
There are really two types of images to focus on here, or really two ways to display an image to focus on here.&amp;lt;br /&amp;gt;&lt;br /&gt;
# Standard images&lt;br /&gt;
# Thumbnail images&lt;br /&gt;
&lt;br /&gt;
Each of these would share some common properties:&lt;br /&gt;
* Image&lt;br /&gt;
* Description (alt/title)&lt;br /&gt;
* Size&lt;br /&gt;
* Action (making it a link) - This would actually make it a molecule, we would have to consider this and either have a new element, drop the ability to wrap in an action, or simply ignore this inconsistency.&lt;br /&gt;
&lt;br /&gt;
===Image - Icon {atom}===&lt;br /&gt;
&lt;br /&gt;
This covers the display of an icon. Should be a separate element from image as really they should be treated individually.&lt;br /&gt;
Within Moodle there are a few classifications of icons to consider:&lt;br /&gt;
* Standard icons&lt;br /&gt;
* Help icon (popup, tooltip)&lt;br /&gt;
* Loading icon (really regular icon but worth showing separately as its only seen when required)&lt;br /&gt;
&lt;br /&gt;
===Image - Logo {molecule}===&lt;br /&gt;
&lt;br /&gt;
We don&#039;t have this within core Moodle at present, however just about every theme I have seen uses a logo. I think it is about time we considered having a logo element.&lt;br /&gt;
I imagine it would become a sort of hero element, likely with an associated action (back home by default).&lt;br /&gt;
&lt;br /&gt;
===Image - Profile picture {molecule}===&lt;br /&gt;
&lt;br /&gt;
We already have a user_picture component within Moodle. It can be found in lib/outputcomponents.php.&amp;lt;br /&amp;gt;&lt;br /&gt;
It has two render methods, &#039;&#039;&#039;&#039;&#039;core_renderer::user_picture&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;core_renderer::render_user_picture&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output structure for the user picture:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; id=&amp;quot;userpicture_randomid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;img src=&amp;quot;#&amp;quot; alt=&amp;quot;Picture of Joe&amp;quot; title=&amp;quot;Picture of Joe&amp;quot; class=&amp;quot;userpicture&amp;quot; width=&amp;quot;[35, 100, XX]&amp;quot; height=&amp;quot;[35, 100, XX]&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What you&#039;ll notice about this is that the link has no attributes marking it as a user picture link.&lt;br /&gt;
&lt;br /&gt;
The PHP code for the user_picture object itself is really quite in depth and complex. The component serves the user profile fields required to render a user picture. This is good in the scope of the component but would be bad within the scope of an element.&amp;lt;br /&amp;gt;&lt;br /&gt;
Don&#039;t you wish we had a proper user object!&lt;br /&gt;
&lt;br /&gt;
===Link {atom}===&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&lt;br /&gt;
&lt;br /&gt;
Theres not too much more to explain about links, they don&#039;t tend to take states other than the default active, enabled and dimmed.&amp;lt;br /&amp;gt;&lt;br /&gt;
It is worth mentioning that devs will be encouraged to use actions and not links unless absolutely necessary.&amp;lt;br /&amp;gt;&lt;br /&gt;
The render method for this atom must typehint an action rather than a link.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prototype example&#039;&#039;&#039;&lt;br /&gt;
* The atom: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/link.php&lt;br /&gt;
* The convenience method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L149&lt;br /&gt;
* The render method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L211&lt;br /&gt;
&lt;br /&gt;
===List {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is a pretty simple example and something I am sure you are all familiar with. A list is simply a collection of items. Usually represented using a UL or OL tag in markup although worth noting can be styled completely differently to the default.&lt;br /&gt;
There are three main types of lists used within Moodle:&lt;br /&gt;
* Ordered list&lt;br /&gt;
* Unordered list&lt;br /&gt;
* Presentation list (currently our unlist)&lt;br /&gt;
&lt;br /&gt;
The list is a molecule because it should be able to accept other elements as items. E.g. it should be content independent.&lt;br /&gt;
&lt;br /&gt;
===Menu {molecule}===&lt;br /&gt;
&lt;br /&gt;
A menu is a familiar concept for any site. Probably the first thing that pops to mind for many is the navbar, but I want to consider that a separate component as a navbar can consist of more than just menu items.&lt;br /&gt;
I think a menu should be a collection of actions the user can perform. Perhaps with some form of hierarchy.&lt;br /&gt;
&lt;br /&gt;
We have different types of menus within Moodle:&lt;br /&gt;
* The custom menu is one users can directly create, with dropdown downs and sub dropdowns.&lt;br /&gt;
* The action_menu component we have in core uses icons as actions and can have a dropdown.&lt;br /&gt;
&lt;br /&gt;
These should be combined into a single menu element that takes items as an argument, likely actions + dropdowns + dividers to start with would be perfect.&lt;br /&gt;
&lt;br /&gt;
We would likely need to deal with the display of the menu with properties to allow constructing code to &#039;&#039;request&#039;&#039; a particular style of menu. The renderer should be what actually gets to decide, but for the purposes of re-use having properties and a single render_method is better than having multiple render methods.&amp;lt;br /&amp;gt;&lt;br /&gt;
The following is my initial thoughts on menu structure:&lt;br /&gt;
* Direction: Horizontal, Vertical&lt;br /&gt;
* Design: Default, Tabs, &lt;br /&gt;
* Style: Default, Links, Buttons, Icons&lt;br /&gt;
&lt;br /&gt;
===Notification {atom}===&lt;br /&gt;
* Info&lt;br /&gt;
* Success&lt;br /&gt;
* Warning&lt;br /&gt;
* Danger&lt;br /&gt;
&lt;br /&gt;
===Navigation bar {organism}===&lt;br /&gt;
Formerly navbar, can&#039;t be called that because the render method would conflict.&lt;br /&gt;
&lt;br /&gt;
The navigation bar is just that, it is becoming increasingly common on the web and usually contains a title or logo, a menu, and information pertaining to the user state (login, language etc).&lt;br /&gt;
&lt;br /&gt;
===Page header {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently being produced by &#039;&#039;&#039;core_renderer::page_heading&#039;&#039;&#039; this is simply a header for the page, by default the only h1 element on the page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method has the following signature:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function page_heading($tag = &#039;h1&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output from the above method is:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;The page heading (from moodle_page::heading)&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The core_renderer method should not allow the tag to be set. The page heading should always be H1.&lt;br /&gt;
If its not an H1 then page header should not be used.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework examples&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#typography Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;hero-unit&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Heading&amp;lt;/h1&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;Tagline&amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
    &amp;lt;a class=&amp;quot;btn btn-primary btn-large&amp;quot;&amp;gt;&lt;br /&gt;
      Learn more&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#page-header Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Example page header &amp;lt;small&amp;gt;Subtext for header&amp;lt;/small&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Foundation doesn&#039;t appear to have a page header component.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* In Moodle all page headings are set as a single string, we won&#039;t be changing this.&lt;br /&gt;
* Usually just a plain string sometimes an icon is used, and sometimes a help icon is used.&lt;br /&gt;
&lt;br /&gt;
===Pagination {molecule}===&lt;br /&gt;
&lt;br /&gt;
I like the idea of this being separate to a menu, and to other navigation oriented elements because it should be something that can easily be constructed with a few basic parameters and allow us to achieve consistent pagination throughout Moodle.&amp;lt;br /&amp;gt;&lt;br /&gt;
It also appeals because this is something that people may want to style differently to their navigation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#pagination Bootstrap 2.3.2 pagination]&lt;br /&gt;
* [http://getbootstrap.com/components/#pagination Bootstrap 3 pagination]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/pagination.html Zurb foundation pagination]&lt;br /&gt;
&lt;br /&gt;
===Progress bars {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty simple concept, we already have a couple of ways of producing progress bars within Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#progress Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;bar&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 2.3.2:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#progress Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- With label --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60% Complete&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Label is hidden but accessible --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60%&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 3:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/progress_bars.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;span class=&amp;quot;meter&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Zurb foundation:&lt;br /&gt;
* Width &lt;br /&gt;
* Colours: default (blue), secondary (grey), success (green), alert (red)&lt;br /&gt;
* Corner style: default (square), radius (slight rounding), round&lt;br /&gt;
&lt;br /&gt;
===Search {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty common interface molecule, and in fact used as an example in the atomic design blog post we keep referencing.&amp;lt;br /&amp;gt;&lt;br /&gt;
We don&#039;t have a component for searching yet, however we&#039;ve several search boxes throughout Moodle. The admin setting search box is the first to come to mind for me, followed by the forum search box and course search box.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Constructed of the following items:&lt;br /&gt;
* Text input&lt;br /&gt;
* Action (must be a button for submit I imagine)&lt;br /&gt;
* Label or short description (optional)&lt;br /&gt;
* Collapsible region containing settings etc (optional)&lt;br /&gt;
&lt;br /&gt;
===Table {organism}===&lt;br /&gt;
&lt;br /&gt;
We&#039;ve two primary table components within Moodle presently &#039;&#039;&#039;html_table&#039;&#039;&#039; and &#039;&#039;&#039;flexible_table&#039;&#039;&#039; both of which offer different advantages and disadvantages. This will be a challenge and will really require some proper research and community interaction.&lt;br /&gt;
&lt;br /&gt;
===Timer {atom|molecule}===&lt;br /&gt;
&lt;br /&gt;
... not sure about this one, but we do use it in a couple of places, and we use it on all core sites that have hourly resets so in a way it makes sense to support it and allow it to be styled nicely and easily.&lt;br /&gt;
&lt;br /&gt;
===Tree===&lt;br /&gt;
&lt;br /&gt;
===User badge===&lt;br /&gt;
&lt;br /&gt;
===User content===&lt;br /&gt;
&lt;br /&gt;
Think of this like the forum post. We need a common structure in which to display content entered by the user along with information on the user. The users name, picture, date perhaps, title, content, footer (attachments, badges, what ever).&lt;br /&gt;
It could be applied to things like forum posts, calendar events etc.&lt;br /&gt;
&lt;br /&gt;
At present we have no abstraction for this.&lt;br /&gt;
&lt;br /&gt;
==Existing renderables and what they will become==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Existing renderable&lt;br /&gt;
! Description&lt;br /&gt;
! Future renderable&lt;br /&gt;
! Convenience method (if different)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu&lt;br /&gt;
| UI component for a drop down edit menu&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link&lt;br /&gt;
| UI component for a menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_filler&lt;br /&gt;
| UI component for a filler menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_primary&lt;br /&gt;
| UI component for a primary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_secondary&lt;br /&gt;
| UI component for a secondary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_link&lt;br /&gt;
| Link with alt text, and an icon&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_button&lt;br /&gt;
| A form with a single button&lt;br /&gt;
| button (action with post method)&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| confirm&lt;br /&gt;
| A form with a message and cancel/confirm buttons&lt;br /&gt;
| confirmation&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_select&lt;br /&gt;
| A form with a single drop down list that submits on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| url_select&lt;br /&gt;
| A navigation element consisting of a single drop down list of urls that navigates on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| doc_link&lt;br /&gt;
| A link to the Moodle docs&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pix_icon&lt;br /&gt;
| A small icon&lt;br /&gt;
| icon&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| emoticon_icon&lt;br /&gt;
| A small emoticon&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading_with_help&lt;br /&gt;
| A page heading with a link to help docs&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| icon_help&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon_scale&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_picture&lt;br /&gt;
| A user profile picture which links to their profile&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| container&lt;br /&gt;
| A block level element used to surround something. Can have a class to allow specific targeting with CSS.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| error_text&lt;br /&gt;
| An error to show to the user.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| notification&lt;br /&gt;
| A message for the user&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| continue_button&lt;br /&gt;
| A message and a button to continue to the next page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| paging_bar&lt;br /&gt;
| A list of next previous and specific page links&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_to&lt;br /&gt;
| A link to a section on the page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_target&lt;br /&gt;
| A target for a matching skip_link_to call&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading&lt;br /&gt;
| A page heading&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| box&lt;br /&gt;
| A page section with a border&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rarrow&lt;br /&gt;
| A right arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| larrow&lt;br /&gt;
| A left arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| tabtree&lt;br /&gt;
| A list of tabs&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| tabobject&lt;br /&gt;
| A single tab panel&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Render_library_element_planning&amp;diff=45556</id>
		<title>User:Sam Hemelryk/Render library element planning</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=User:Sam_Hemelryk/Render_library_element_planning&amp;diff=45556"/>
		<updated>2014-06-27T01:58:49Z</updated>

		<summary type="html">&lt;p&gt;Samhemelryk: /* Table {organism} */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox Project&lt;br /&gt;
|name = Renderer consistency&lt;br /&gt;
|state = Specification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/MDL-45829&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/discuss.php?d=261202&lt;br /&gt;
|assignee = Damyon, Sam&lt;br /&gt;
}}&lt;br /&gt;
{{Work in progress|forumurl=https://moodle.org/mod/forum/discuss.php?d=261202}}&lt;br /&gt;
This page documents the proposed core elements, variations of them, what we expect they will contain, and the core_renderer block.&lt;br /&gt;
&lt;br /&gt;
==The user action==&lt;br /&gt;
&lt;br /&gt;
An action in this sense is a collection of data that all pertains to one action that can be taken by the user.&lt;br /&gt;
The action, once populated with data can be rendered as is required for the job it is going to fulfil, usually with some relation to the frontend framework in use.&lt;br /&gt;
In this way the action could be a link, or a button; it could even be interpreted into a more complex structure.&lt;br /&gt;
&lt;br /&gt;
An action has the following properties:&lt;br /&gt;
; content [string]: text content for the link or button.&lt;br /&gt;
; url [moodle_url] : the url for the action to take when the user interacts with this action.&lt;br /&gt;
; description : a description of the action. Typically used within a title or alt attribute.&lt;br /&gt;
; active : True if this is the action the user is current performing.&lt;br /&gt;
; enabled : True if the action is possible, false if it is not possible and should be shown as disabled.&lt;br /&gt;
; dimmed : True if the action should be shown as dimmed, usually used to the action is hidden to other users.&lt;br /&gt;
; method : The preferred method of submitting this action, typically GET but can be set to POST.&lt;br /&gt;
&lt;br /&gt;
It is also possible to add JavaScript actions (component_action objects) to an action. These attach a JS listener to the action that gets executed when the user interacts with the action.&lt;br /&gt;
Attached JavaScript actions get initialised when the properties for the action are retrieved so any events must be attached BEFORE the action is rendered, and all renderers must ensure they use the get_attributes() call. &lt;br /&gt;
&lt;br /&gt;
==Grids==&lt;br /&gt;
&lt;br /&gt;
We need to come up with some way to include grids in core, it is desirable to keep it framework agnostic so perhaps a grid object that allows for items to be added and a &amp;quot;width&amp;quot; specified when that occurs. The width would be either a fixed number or a percentage. Steps of 12 seems pretty common.&lt;br /&gt;
&lt;br /&gt;
==Design requirements==&lt;br /&gt;
The following concepts need to be accounted for in core, or decisions made on how we choose to support these and where.&lt;br /&gt;
&lt;br /&gt;
===Clearfix===&lt;br /&gt;
We have this in core already, bootstrap has it, pretty much every front end framework has it.&lt;br /&gt;
Clearfix is more of a design decision, should only be used when require, and only ever applied by a renderer.&lt;br /&gt;
This gets special mention as being important, support is already 100%.&lt;br /&gt;
&lt;br /&gt;
===Floats===&lt;br /&gt;
Pull left, pull right etc. These are a design decisions and should be implemented by the renderer. Bootstrap caters for these and as such they will be easily catered for in bootstrapbase, however work may be required to get them operational in base.&lt;br /&gt;
&lt;br /&gt;
==Discarded ideas==&lt;br /&gt;
The following things are ideas that came up during discussions on what elements are, and what elements we want in core that have being discarded.&lt;br /&gt;
&lt;br /&gt;
==Core atoms, molecules, and organisms==&lt;br /&gt;
&lt;br /&gt;
The following is the atoms, molecules and organisms we believe should be created initially. Of course there will be many more that are required - however this should give us a good grounding of elements to work with for the first conversions.&lt;br /&gt;
&lt;br /&gt;
===Action {atom}===&lt;br /&gt;
See the section above about [[#The user action]]&lt;br /&gt;
&lt;br /&gt;
Actions are special atoms the represent an action the user can make.&lt;br /&gt;
They can be rendered by a theme as a link, a button or I suppose anything else.&lt;br /&gt;
There should be a default for when it is not specified and the renderer in change of producing the current thing can decide whether to use the default and just call &#039;&#039;render&#039;&#039; or if it requires something specific &#039;&#039;render_link&#039;&#039; or &#039;&#039;render_button&#039;&#039; as required.&lt;br /&gt;
&lt;br /&gt;
===Action group {molecule}===&lt;br /&gt;
A group of actions, to be rendered to reflect a relation. I suppose the easiest way to think about this is how buttons in the atto editor are grouped together. It is a requirement that may seem a tad absrtracted and irrelevant at first but I think will pop up in several places throughout Moodle when we start converting.&lt;br /&gt;
&lt;br /&gt;
It is basically a collection of actions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#buttonGroups Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/components/#btn-groups Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/button_groups.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
===Block {atom}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle. This represents a block on the page, and is displayed within a [[#Block region]].&lt;br /&gt;
It accepts two arguments, the first is a &#039;&#039;block_contents&#039;&#039; object instance, and the second is the region name the block instance is being shown within.&lt;br /&gt;
&lt;br /&gt;
At present a block is rendered using the &#039;&#039;&#039;&#039;&#039;core_render::block&#039;&#039;&#039;&#039;&#039; method. Internally this calls several renderer methods to produce the different parts of a block.&lt;br /&gt;
* core_renderer::block_header - Produces a header&lt;br /&gt;
** core_renderer::block_controls - Produces controls to display within the header.&lt;br /&gt;
* core_renderer::block_content - Produces the actual content of the block.&lt;br /&gt;
** core_renderer::block_controls - Used to check if block controls were rendered. PUKE!!!&lt;br /&gt;
** core_renderer::block_footer - Produces a footer that actually resides within the content.&lt;br /&gt;
* core_renderer::block_annotation - Produces an annotation, used VERY rarely.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output when called for a navigation block with a bit of extra added to show how a footer is displayed and an annotation.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#sb-1&amp;quot; class=&amp;quot;skip-block&amp;quot;&amp;gt;Skip Navigation&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;div id=&amp;quot;inst4&amp;quot; class=&amp;quot;block_navigation  block&amp;quot; role=&amp;quot;navigation&amp;quot; data-block=&amp;quot;navigation&amp;quot; data-instanceid=&amp;quot;4&amp;quot; aria-labelledby=&amp;quot;instance-4-header&amp;quot; data-dockable=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;header&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;title&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;div class=&amp;quot;block_action&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;!-- Block actions go here, they are images with JS or anchors--&amp;gt;&lt;br /&gt;
            &amp;lt;/div&amp;gt;&lt;br /&gt;
            &amp;lt;h2 id=&amp;quot;instance-4-header&amp;quot;&amp;gt;Navigation&amp;lt;/h2&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;content&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;!-- Block content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;div class=&amp;quot;footer&amp;quot;&amp;gt;&lt;br /&gt;
           &amp;lt;!-- Block footer content goes here --&amp;gt;&lt;br /&gt;
       &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;blockannotation&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Block annotation content goes here --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span id=&amp;quot;sb-1&amp;quot; class=&amp;quot;skip-block-to&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Block region {molecule}===&lt;br /&gt;
&lt;br /&gt;
Unique to Moodle, the block region is a contain for all of the blocks in one location.&lt;br /&gt;
We currently have two methods that produce a block region within Moodle, the first is &#039;&#039;&#039;&#039;&#039;core_renderer::blocks_for_region&#039;&#039;&#039;&#039;&#039; which adds no surrounding content.&lt;br /&gt;
The preferred method &#039;&#039;&#039;&#039;&#039;core_renderer::blocks&#039;&#039;&#039;&#039;&#039; adds some embedded information to a common structure.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the structure of the &#039;&#039;core_renderer::blocks()&#039;&#039; method.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function blocks($region, $classes = array(), $tag = &#039;aside&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following is the html output is $region was &#039;&#039;pre&#039;&#039; and the default tag and classes were used.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot; data-blockregion=&amp;quot;pre&amp;quot; data-droptarget=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Thoughts on this&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The blocks method is a convenience method and serves an important purpose. However it should not take classes and tag as arguments.&amp;lt;br /&amp;gt;&lt;br /&gt;
These should certainly only settable within the renderer itself, and if themes wish to change this without wrapping the call they should override the renderer.&lt;br /&gt;
&lt;br /&gt;
Both the data attributes relate to servicing JavaScript functionality. Perhaps they should be moved to a component_action or somehow else integrated with JS rather than with the renderer directly.&lt;br /&gt;
&lt;br /&gt;
Internally it is calling blocks for region, however this should change it should request a array of blocks, convert the array to [[#Block]] elements and call render on each.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Proposed HTML structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Much like the current structure but with the data attributes coming through a JS mechanism.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;aside id=&amp;quot;block-region-pre&amp;quot; class=&amp;quot;block-region&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- blocks go here --&amp;gt;&lt;br /&gt;
&amp;lt;/aside&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Breadcrumb {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently called the navbar within Moodle, controlled by the &#039;&#039;&#039;&#039;&#039;navbar&#039;&#039;&#039;&#039;&#039; class located in lib/navigationlib.php and rendered by &#039;&#039;&#039;&#039;&#039;core_renderer::navbar()&#039;&#039;&#039;&#039;&#039;.&amp;lt;br /&amp;gt;&lt;br /&gt;
Internally it calls moodle_page-&amp;gt;navbar-&amp;gt;get_items() to get an array containing navigation node items to display in the navigation bar.&amp;lt;br /&amp;gt;&lt;br /&gt;
It produces a bit of surrounding structure before calling render on each item.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following shows the structure for two items in the navigation bar presently within Moodle.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;Page path&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;nav class=&amp;quot;breadcrumb-nav&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&lt;br /&gt;
            &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
            &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;accesshide&amp;quot;&amp;gt;&lt;br /&gt;
                    &amp;lt;span class=&amp;quot;arrow_text&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
                    &amp;amp;nbsp;&lt;br /&gt;
                &amp;lt;/span&amp;gt;&lt;br /&gt;
                &amp;lt;span class=&amp;quot;arrow sep&amp;quot;&amp;gt;►&amp;lt;/span&amp;gt;&lt;br /&gt;
            &amp;lt;/span&amp;gt;&lt;br /&gt;
        &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/nav&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the excessive amount of markup to make the separator accessible.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#breadcrumbs Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
        &amp;lt;span class=&amp;quot;divider&amp;quot;&amp;gt;/&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#breadcrumbs Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/breadcrumbs.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;ul class=&amp;quot;breadcrumb&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Home&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&lt;br /&gt;
        &amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Here&amp;lt;/a&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The currently active page should be marked with a class.&lt;br /&gt;
* The current item should probably not be a link MDL-46037&lt;br /&gt;
* [http://www.w3.org/TR/2007/WD-aria-role-20070601/#breadcrumbs wia-aria breadcrumb role]&lt;br /&gt;
* The divider perhaps could come through CSS with these changes to avoid markup necessary to make it accessible (in combination with the above).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation thoughts&#039;&#039;&#039;&lt;br /&gt;
* Owns an array of [#Action {atoms}]&lt;br /&gt;
&lt;br /&gt;
===Buttons {atom}===&lt;br /&gt;
&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&amp;lt;br /&amp;gt;&lt;br /&gt;
Obviously buttons can serve different purposes and roles so have several easily reachable customisations is probably a wise idea.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
None, presently you produce a button when you need it so there are several throughout Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/base-css.html#buttons Bootstrap 2.3.2] and [http://getbootstrap.com/css/#buttons Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;button type=&amp;quot;button&amp;quot; class=&amp;quot;btn btn-default&amp;quot;&amp;gt;Default&amp;lt;/button&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;btn btn-default btn-lg active&amp;quot; role=&amp;quot;button&amp;quot;&amp;gt;Link&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;!-- OR --&amp;gt;&lt;br /&gt;
&amp;lt;input class=&amp;quot;btn btn-default&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Input&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Bootstrap:&lt;br /&gt;
* Purposes: default, primary, success, info, warning, danger, link&lt;br /&gt;
* Sizes: large, default, small, extra-small&lt;br /&gt;
* Block level (wider)&lt;br /&gt;
* States: Active, disabled.&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/buttons.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; class=&amp;quot;button&amp;quot;&amp;gt;Default Button&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Customisations available through Zurb Foundation:&lt;br /&gt;
* Purposes: default, secondary, success, alert&lt;br /&gt;
* Sizes: large, default, small, tiny&lt;br /&gt;
* Corner style: radius, round&lt;br /&gt;
* Expanded (wider)&lt;br /&gt;
* States: disabled&lt;br /&gt;
&lt;br /&gt;
===Calendar {organism}===&lt;br /&gt;
&lt;br /&gt;
A simple idea really, apparently not already covered by the frontend frameworks being referenced during the creation of the doc.&lt;br /&gt;
The display of the calendar is fixed, but it can contain content for each day shown.&lt;br /&gt;
&lt;br /&gt;
The calendar should have several views, perhaps these are separate organisms, perhaps not.&lt;br /&gt;
&lt;br /&gt;
* Compact month&lt;br /&gt;
* Month&lt;br /&gt;
* Week&lt;br /&gt;
* Day&lt;br /&gt;
&lt;br /&gt;
Each day could:&lt;br /&gt;
* Contain an action with an icon for events, and link to the fullday display.&lt;br /&gt;
* Have an associated action to load and display the events in a tooltip.&lt;br /&gt;
&lt;br /&gt;
===Collapsible region {molecule}===&lt;br /&gt;
&lt;br /&gt;
We use these in several places within Moodle. I could not find a reference to this concept in any of the frontend frameworks I looked at.&lt;br /&gt;
The concept is simple - you have a heading and an icon with content. By default the content is hidden, when the user clicks the heading and/or the icon the content is revealed.&lt;br /&gt;
&lt;br /&gt;
As noted we do this in several places within Moodle, it would be good to have a single way of displaying this idea of a collapsible region.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
* It should support an optional collapse/expand all trigger action.&lt;br /&gt;
* We want to be able to use it both inside and outside of forms.&lt;br /&gt;
* It should be usable in situations like the combo list frontpage component as well.&lt;br /&gt;
* Will obviously have a JS component as without JS it would not work.&lt;br /&gt;
&lt;br /&gt;
===Confirmation {molecule}===&lt;br /&gt;
&lt;br /&gt;
A simple concept used regularly in Moodle to confirm a users intention to perform an actions. Most commonly seeing when deleting content.&lt;br /&gt;
The structure is relatively basic in Moodle at present.&lt;br /&gt;
* A message&lt;br /&gt;
* A forwards button&lt;br /&gt;
* A back button&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The method &#039;&#039;&#039;&#039;&#039;core_renderer::confirm&#039;&#039;&#039;&#039;&#039; does the rendering at present. Its signature is as follows:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function confirm($message, $continue, $cancel);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output it produces is like:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;generalbox&amp;quot; id=&amp;quot;notice&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;p&amp;gt;The message goes here&amp;lt;/p&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;buttons&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;!-- Two buttons produced by core_renderer::render_single_button() --&amp;gt;&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design throughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This component does not have a title. I believe at present some pages use &#039;&#039;core_renderer::heading&#039;&#039; to produce a title if they wish. Obviously we want consistency of style so I believe it would be wise to add a title property that can be optionally set and then in our documentation for this element recommend that a title is always provided.&amp;lt;br /&amp;gt;&lt;br /&gt;
It will mean re-factoring our uses to set a title and if a heading is being manually added remove it.&lt;br /&gt;
&lt;br /&gt;
===Continue {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is much like the confirmation molecule but with a single button.&amp;lt;br /&amp;gt;&lt;br /&gt;
At present we have &#039;&#039;&#039;&#039;&#039;core_renderer::continue_button&#039;&#039;&#039;&#039;&#039; that produces a single button. However this design is very poor as more often than not a message is included in the page to describe the purpose of the continue button. This is really an integral part of the continue button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Currently we have &#039;&#039;core_renderer::continue_button&#039;&#039; to render a single continue button.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function continue_button($url);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Internally it creates a single_button component and then calls render on that.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
Our element should have a message and a button. To make it easy to migrate the constructor should accept a URL instead of a button and do the same conversion as the current method is doing.&lt;br /&gt;
&lt;br /&gt;
===Choice {molecule}===&lt;br /&gt;
Not sure about this one quite yet.&lt;br /&gt;
A description with 2 or more actions allowing the user to select the next step.&lt;br /&gt;
Think of it like when editing a module you get: Cancel, Save and return to course, Save and display&lt;br /&gt;
&lt;br /&gt;
Perhaps both [#Confirmation {molecule}] and [#Continue {molecule}] should be just instances of this.&lt;br /&gt;
&lt;br /&gt;
Hmm perhaps that would not be as clear as this and we should have this separate choice molecule.&lt;br /&gt;
&lt;br /&gt;
===Divider {atom}===&lt;br /&gt;
Think horizontal rule.&lt;br /&gt;
&lt;br /&gt;
===Dropdowns {molecule}===&lt;br /&gt;
&lt;br /&gt;
So this is a pretty simple concept, but you&#039;ve got to think of it as a separate entity. A dropdown is a menu that appears when the user interacts with an action.&lt;br /&gt;
 &lt;br /&gt;
The action could take one of three forms:&lt;br /&gt;
* From button&lt;br /&gt;
* From link&lt;br /&gt;
* From icon&lt;br /&gt;
&lt;br /&gt;
Of course that is handled by the [#Action {atom}] noted above. Worth noting is that we will need some way to toggle these actions as dropdowns. Perhaps it is worth making that a property of the action atom.&lt;br /&gt;
&lt;br /&gt;
The dropdown itself will likely contain more actions, and I suppose additional dropdowns to form sub menus. Sub-menus in my mind are required. We don&#039;t use them in core, but they are functionally possible through things like the custom menu and I know for a fact that many sites have sub menus.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#dropdowns Bootstrap 2.3.2]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;!-- Link or button to toggle dropdown --&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dLabel&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li&amp;gt;&amp;lt;a tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#dropdowns Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;button class=&amp;quot;btn dropdown-toggle sr-only&amp;quot; type=&amp;quot;button&amp;quot; id=&amp;quot;dropdownMenu1&amp;quot; data-toggle=&amp;quot;dropdown&amp;quot;&amp;gt;&lt;br /&gt;
        Dropdown&lt;br /&gt;
        &amp;lt;span class=&amp;quot;caret&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
    &amp;lt;/button&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;dropdown-menu&amp;quot; role=&amp;quot;menu&amp;quot; aria-labelledby=&amp;quot;dropdownMenu1&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Something else here&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot; class=&amp;quot;divider&amp;quot;&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;li role=&amp;quot;presentation&amp;quot;&amp;gt;&amp;lt;a role=&amp;quot;menuitem&amp;quot; tabindex=&amp;quot;-1&amp;quot; href=&amp;quot;#&amp;quot;&amp;gt;Separated link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/dropdown.html Zurb foundation]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; data-dropdown=&amp;quot;drop1&amp;quot;&amp;gt;Has Dropdown&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;ul id=&amp;quot;drop1&amp;quot; class=&amp;quot;f-dropdown&amp;quot; data-dropdown-content&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is a link&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;This is another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;#&amp;quot;&amp;gt;Yet another&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Forms {organism}===&lt;br /&gt;
&lt;br /&gt;
This is an advanced  organism and would be quite a bit of work to create in Moodle as we&#039;d need to translate from QuickForms to elements for rendering.&lt;br /&gt;
It would be worthwhile doing this however, and would be a good way of quickly showing our new work.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework structures&#039;&#039;&#039;&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/base-css.html#forms Bootstrap 2.3.2]&lt;br /&gt;
* [http://getbootstrap.com/css/#forms Bootstrap 3]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/forms.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
All of those are quite in-depth and offer a range of configurations.&lt;br /&gt;
We should carefully consider these when analysing our work here.&lt;br /&gt;
&lt;br /&gt;
===Headings {atom}===&lt;br /&gt;
&lt;br /&gt;
Currently handled by &#039;&#039;&#039;core_renderer::heading&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* h1 - h6&lt;br /&gt;
* Optional icon&lt;br /&gt;
* Optional help icon&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method is currently:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function heading($text, $level = 2, $classes = null, $id = null);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output generated by this is, assuming we use the default level, classes, and id.&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;I am a heading&amp;lt;/h2&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Whats worth noting is that the render method should not accept level and classes as arguments.&lt;br /&gt;
These should only be set by the render method and should not be directly influenced.&lt;br /&gt;
&lt;br /&gt;
===Image {atom}===&lt;br /&gt;
&lt;br /&gt;
There are really two types of images to focus on here, or really two ways to display an image to focus on here.&amp;lt;br /&amp;gt;&lt;br /&gt;
# Standard images&lt;br /&gt;
# Thumbnail images&lt;br /&gt;
&lt;br /&gt;
Each of these would share some common properties:&lt;br /&gt;
* Image&lt;br /&gt;
* Description (alt/title)&lt;br /&gt;
* Size&lt;br /&gt;
* Action (making it a link) - This would actually make it a molecule, we would have to consider this and either have a new element, drop the ability to wrap in an action, or simply ignore this inconsistency.&lt;br /&gt;
&lt;br /&gt;
===Image - Icon {atom}===&lt;br /&gt;
&lt;br /&gt;
This covers the display of an icon. Should be a separate element from image as really they should be treated individually.&lt;br /&gt;
Within Moodle there are a few classifications of icons to consider:&lt;br /&gt;
* Standard icons&lt;br /&gt;
* Help icon (popup, tooltip)&lt;br /&gt;
* Loading icon (really regular icon but worth showing separately as its only seen when required)&lt;br /&gt;
&lt;br /&gt;
===Image - Logo {molecule}===&lt;br /&gt;
&lt;br /&gt;
We don&#039;t have this within core Moodle at present, however just about every theme I have seen uses a logo. I think it is about time we considered having a logo element.&lt;br /&gt;
I imagine it would become a sort of hero element, likely with an associated action (back home by default).&lt;br /&gt;
&lt;br /&gt;
===Image - Profile picture {molecule}===&lt;br /&gt;
&lt;br /&gt;
We already have a user_picture component within Moodle. It can be found in lib/outputcomponents.php.&amp;lt;br /&amp;gt;&lt;br /&gt;
It has two render methods, &#039;&#039;&#039;&#039;&#039;core_renderer::user_picture&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;&#039;&#039;core_renderer::render_user_picture&#039;&#039;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following is the output structure for the user picture:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;#&amp;quot; id=&amp;quot;userpicture_randomid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;img src=&amp;quot;#&amp;quot; alt=&amp;quot;Picture of Joe&amp;quot; title=&amp;quot;Picture of Joe&amp;quot; class=&amp;quot;userpicture&amp;quot; width=&amp;quot;[35, 100, XX]&amp;quot; height=&amp;quot;[35, 100, XX]&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What you&#039;ll notice about this is that the link has no attributes marking it as a user picture link.&lt;br /&gt;
&lt;br /&gt;
The PHP code for the user_picture object itself is really quite in depth and complex. The component serves the user profile fields required to render a user picture. This is good in the scope of the component but would be bad within the scope of an element.&amp;lt;br /&amp;gt;&lt;br /&gt;
Don&#039;t you wish we had a proper user object!&lt;br /&gt;
&lt;br /&gt;
===Link {atom}===&lt;br /&gt;
This will be both an element and a representation of a [#Action {atom}].&lt;br /&gt;
&lt;br /&gt;
Theres not too much more to explain about links, they don&#039;t tend to take states other than the default active, enabled and dimmed.&amp;lt;br /&amp;gt;&lt;br /&gt;
It is worth mentioning that devs will be encouraged to use actions and not links unless absolutely necessary.&amp;lt;br /&amp;gt;&lt;br /&gt;
The render method for this atom must typehint an action rather than a link.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prototype example&#039;&#039;&#039;&lt;br /&gt;
* The atom: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/link.php&lt;br /&gt;
* The convenience method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L149&lt;br /&gt;
* The render method: https://github.com/samhemelryk/moodle/blob/output_prototype_5/local/output/classes/output/renderer.php#L211&lt;br /&gt;
&lt;br /&gt;
===List {molecule}===&lt;br /&gt;
&lt;br /&gt;
This is a pretty simple example and something I am sure you are all familiar with. A list is simply a collection of items. Usually represented using a UL or OL tag in markup although worth noting can be styled completely differently to the default.&lt;br /&gt;
There are three main types of lists used within Moodle:&lt;br /&gt;
* Ordered list&lt;br /&gt;
* Unordered list&lt;br /&gt;
* Presentation list (currently our unlist)&lt;br /&gt;
&lt;br /&gt;
The list is a molecule because it should be able to accept other elements as items. E.g. it should be content independent.&lt;br /&gt;
&lt;br /&gt;
===Menu {molecule}===&lt;br /&gt;
&lt;br /&gt;
A menu is a familiar concept for any site. Probably the first thing that pops to mind for many is the navbar, but I want to consider that a separate component as a navbar can consist of more than just menu items.&lt;br /&gt;
I think a menu should be a collection of actions the user can perform. Perhaps with some form of hierarchy.&lt;br /&gt;
&lt;br /&gt;
We have different types of menus within Moodle:&lt;br /&gt;
* The custom menu is one users can directly create, with dropdown downs and sub dropdowns.&lt;br /&gt;
* The action_menu component we have in core uses icons as actions and can have a dropdown.&lt;br /&gt;
&lt;br /&gt;
These should be combined into a single menu element that takes items as an argument, likely actions + dropdowns + dividers to start with would be perfect.&lt;br /&gt;
&lt;br /&gt;
We would likely need to deal with the display of the menu with properties to allow constructing code to &#039;&#039;request&#039;&#039; a particular style of menu. The renderer should be what actually gets to decide, but for the purposes of re-use having properties and a single render_method is better than having multiple render methods.&amp;lt;br /&amp;gt;&lt;br /&gt;
The following is my initial thoughts on menu structure:&lt;br /&gt;
* Direction: Horizontal, Vertical&lt;br /&gt;
* Design: Default, Tabs, &lt;br /&gt;
* Style: Default, Links, Buttons, Icons&lt;br /&gt;
&lt;br /&gt;
===Notification {atom}===&lt;br /&gt;
* Info&lt;br /&gt;
* Success&lt;br /&gt;
* Warning&lt;br /&gt;
* Danger&lt;br /&gt;
&lt;br /&gt;
===Navigation bar {organism}===&lt;br /&gt;
Formerly navbar, can&#039;t be called that because the render method would conflict.&lt;br /&gt;
&lt;br /&gt;
The navigation bar is just that, it is becoming increasingly common on the web and usually contains a title or logo, a menu, and information pertaining to the user state (login, language etc).&lt;br /&gt;
&lt;br /&gt;
===Page header {molecule}===&lt;br /&gt;
&lt;br /&gt;
Currently being produced by &#039;&#039;&#039;core_renderer::page_heading&#039;&#039;&#039; this is simply a header for the page, by default the only h1 element on the page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Current structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The render method has the following signature:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
public function page_heading($tag = &#039;h1&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The output from the above method is:&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;The page heading (from moodle_page::heading)&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The core_renderer method should not allow the tag to be set. The page heading should always be H1.&lt;br /&gt;
If its not an H1 then page header should not be used.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend framework examples&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#typography Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;hero-unit&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Heading&amp;lt;/h1&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;Tagline&amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&lt;br /&gt;
    &amp;lt;a class=&amp;quot;btn btn-primary btn-large&amp;quot;&amp;gt;&lt;br /&gt;
      Learn more&lt;br /&gt;
    &amp;lt;/a&amp;gt;&lt;br /&gt;
  &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#page-header Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;page-header&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;h1&amp;gt;Example page header &amp;lt;small&amp;gt;Subtext for header&amp;lt;/small&amp;gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Foundation doesn&#039;t appear to have a page header component.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design thoughts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* In Moodle all page headings are set as a single string, we won&#039;t be changing this.&lt;br /&gt;
* Usually just a plain string sometimes an icon is used, and sometimes a help icon is used.&lt;br /&gt;
&lt;br /&gt;
===Pagination {molecule}===&lt;br /&gt;
&lt;br /&gt;
I like the idea of this being separate to a menu, and to other navigation oriented elements because it should be something that can easily be constructed with a few basic parameters and allow us to achieve consistent pagination throughout Moodle.&amp;lt;br /&amp;gt;&lt;br /&gt;
It also appeals because this is something that people may want to style differently to their navigation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* [http://getbootstrap.com/2.3.2/components.html#pagination Bootstrap 2.3.2 pagination]&lt;br /&gt;
* [http://getbootstrap.com/components/#pagination Bootstrap 3 pagination]&lt;br /&gt;
* [http://foundation.zurb.com/docs/components/pagination.html Zurb foundation pagination]&lt;br /&gt;
&lt;br /&gt;
===Progress bars {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty simple concept, we already have a couple of ways of producing progress bars within Moodle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Markup in various frontend frameworks&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/2.3.2/components.html#progress Bootstrap 2.3.2]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;bar&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 2.3.2:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://getbootstrap.com/components/#progress Bootstrap 3]&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;!-- With label --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60% Complete&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- Label is hidden but accessible --&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;div class=&amp;quot;progress-bar&amp;quot; role=&amp;quot;progressbar&amp;quot; aria-valuenow=&amp;quot;60&amp;quot; aria-valuemin=&amp;quot;0&amp;quot; aria-valuemax=&amp;quot;100&amp;quot; style=&amp;quot;width: 60%;&amp;quot;&amp;gt;&lt;br /&gt;
        60%&lt;br /&gt;
    &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Bootstrap 3:&lt;br /&gt;
&lt;br /&gt;
* Striped&lt;br /&gt;
* Striped + Animated&lt;br /&gt;
* Stacked (multiple bars forming a single)&lt;br /&gt;
* Colours: default (blue), info (light blue), success (green), warning (orange), danger (red)&lt;br /&gt;
&lt;br /&gt;
[http://foundation.zurb.com/docs/components/progress_bars.html Zurb foundation]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html5&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;progress&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;span class=&amp;quot;meter&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following options are offered by Zurb foundation:&lt;br /&gt;
* Width &lt;br /&gt;
* Colours: default (blue), secondary (grey), success (green), alert (red)&lt;br /&gt;
* Corner style: default (square), radius (slight rounding), round&lt;br /&gt;
&lt;br /&gt;
===Search {molecule}===&lt;br /&gt;
&lt;br /&gt;
A pretty common interface molecule, and in fact used as an example in the atomic design blog post we keep referencing.&amp;lt;br /&amp;gt;&lt;br /&gt;
We don&#039;t have a component for searching yet, however we&#039;ve several search boxes throughout Moodle. The admin setting search box is the first to come to mind for me, followed by the forum search box and course search box.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Design considerations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Constructed of the following items:&lt;br /&gt;
* Text input&lt;br /&gt;
* Action (must be a button for submit I imagine)&lt;br /&gt;
* Label or short description (optional)&lt;br /&gt;
* Collapsible region containing settings etc (optional)&lt;br /&gt;
&lt;br /&gt;
===Table {organism}===&lt;br /&gt;
&lt;br /&gt;
We&#039;ve two primary table components within Moodle presently &#039;&#039;&#039;html_table&#039;&#039;&#039; and &#039;&#039;&#039;flexible_table&#039;&#039;&#039; both of which offer different advantages and disadvantages. This will be a challenge and will really require some proper research and community interaction.&lt;br /&gt;
&lt;br /&gt;
===Timer===&lt;br /&gt;
&lt;br /&gt;
===Tree===&lt;br /&gt;
&lt;br /&gt;
===User badge===&lt;br /&gt;
&lt;br /&gt;
===User content===&lt;br /&gt;
&lt;br /&gt;
Think of this like the forum post. We need a common structure in which to display content entered by the user along with information on the user. The users name, picture, date perhaps, title, content, footer (attachments, badges, what ever).&lt;br /&gt;
It could be applied to things like forum posts, calendar events etc.&lt;br /&gt;
&lt;br /&gt;
At present we have no abstraction for this.&lt;br /&gt;
&lt;br /&gt;
==Existing renderables and what they will become==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Existing renderable&lt;br /&gt;
! Description&lt;br /&gt;
! Future renderable&lt;br /&gt;
! Convenience method (if different)&lt;br /&gt;
|-&lt;br /&gt;
| action_menu&lt;br /&gt;
| UI component for a drop down edit menu&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link&lt;br /&gt;
| UI component for a menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_filler&lt;br /&gt;
| UI component for a filler menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_primary&lt;br /&gt;
| UI component for a primary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_menu_link_secondary&lt;br /&gt;
| UI component for a secondary menu item in an action menu&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| action_link&lt;br /&gt;
| Link with alt text, and an icon&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_button&lt;br /&gt;
| A form with a single button&lt;br /&gt;
| button (action with post method)&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| confirm&lt;br /&gt;
| A form with a message and cancel/confirm buttons&lt;br /&gt;
| confirmation&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| single_select&lt;br /&gt;
| A form with a single drop down list that submits on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| url_select&lt;br /&gt;
| A navigation element consisting of a single drop down list of urls that navigates on change&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| doc_link&lt;br /&gt;
| A link to the Moodle docs&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pix_icon&lt;br /&gt;
| A small icon&lt;br /&gt;
| icon&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| emoticon_icon&lt;br /&gt;
| A small emoticon&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading_with_help&lt;br /&gt;
| A page heading with a link to help docs&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
| icon_help&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| help_icon_scale&lt;br /&gt;
| A help icon that opens a help popup when clicked&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_picture&lt;br /&gt;
| A user profile picture which links to their profile&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| container&lt;br /&gt;
| A block level element used to surround something. Can have a class to allow specific targeting with CSS.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| error_text&lt;br /&gt;
| An error to show to the user.&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| notification&lt;br /&gt;
| A message for the user&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| continue_button&lt;br /&gt;
| A message and a button to continue to the next page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| paging_bar&lt;br /&gt;
| A list of next previous and specific page links&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_to&lt;br /&gt;
| A link to a section on the page&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| skip_link_target&lt;br /&gt;
| A target for a matching skip_link_to call&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| heading&lt;br /&gt;
| A page heading&lt;br /&gt;
| heading&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| box&lt;br /&gt;
| A page section with a border&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rarrow&lt;br /&gt;
| A right arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| larrow&lt;br /&gt;
| A left arrow&lt;br /&gt;
|&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| tabtree&lt;br /&gt;
| A list of tabs&lt;br /&gt;
| menu&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| tabobject&lt;br /&gt;
| A single tab panel&lt;br /&gt;
| action&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[User:Sam Hemelryk/Render library element planning]]&lt;br /&gt;
* [[Guide to creating output elements]] &#039;&#039;originally written at [[User:Sam Hemelryk/Creating renderable components]]&#039;&#039;&lt;br /&gt;
* [[User:Sam Hemelryk/Renderer best practices]]&lt;br /&gt;
* [[User:Sam Hemelryk/CSS style guidelines]]&lt;/div&gt;</summary>
		<author><name>Samhemelryk</name></author>
	</entry>
</feed>