diff --git a/.upgradenotes/MDL-82183-2024061304200941.yml b/.upgradenotes/MDL-82183-2024061304200941.yml new file mode 100644 index 00000000000..85b6df698dd --- /dev/null +++ b/.upgradenotes/MDL-82183-2024061304200941.yml @@ -0,0 +1,128 @@ +issueNumber: MDL-82183 +notes: + core: + - message: > + The following classes are now also available in the following new + locations. They will continue to work in their old locations: + + | Old classname | New classname | + + | --- | --- | + + | `\action_link` | `\core\output\action_link` | + + | `\action_menu_filler` | `\core\output\action_menu\filler` | + + | `\action_menu_link_primary` | `\core\output\action_menu\link_primary` | + + | `\action_menu_link_secondary` | `\core\output\action_menu\link_secondary` | + + | `\action_menu_link` | `\core\output\action_menu\link` | + + | `\action_menu` | `\core\output\action_menu` | + + | `\block_contents` | `\core_block\output\block_contents` | + + | `\block_move_target` | `\core_block\output\block_move_target` | + + | `\component_action` | `\core\output\actions\component_action` | + + | `\confirm_action` | `\core\output\actions\confirm_action` | + + | `\context_header` | `\core\output\context_header` | + + | `\core_renderer_ajax` | `\core\output\core_renderer_ajax` | + + | `\core_renderer_cli` | `\core\output\core_renderer_cli` | + + | `\core_renderer_maintenance` | `\core\output\core_renderer_maintenance` | + + | `\core_renderer` | `\core\output\core_renderer` | + + | `\custom_menu_item` | `\core\output\custom_menu_item` | + + | `\custom_menu` | `\core\output\custom_menu` | + + | `\file_picker` | `\core\output\file_picker` | + + | `\flexible_table` | `\core_table\flexible_table` | + + | `\fragment_requirements_manager` | `\core\output\requirements\fragment_requirements_manager` | + + | `\help_icon` | `\core\output\help_icon` | + + | `\html_table_cell` | `\core_table\output\html_table_cell` | + + | `\html_table_row` | `\core_table\output\html_table_row` | + + | `\html_table` | `\core_table\output\html_table` | + + | `\html_writer` | `\core\output\html_writer` | + + | `\image_icon` | `\core\output\image_icon` | + + | `\initials_bar` | `\core\output\initials_bar` | + + | `\js_writer` | `\core\output\js_writer` | + + | `\page_requirements_manager` | `\core\output\requirements\page_requirements_manager` | + + | `\paging_bar` | `\core\output\paging_bar` | + + | `\pix_emoticon` | `\core\output\pix_emoticon` | + + | `\pix_icon_font` | `\core\output\pix_icon_font` | + + | `\pix_icon_fontawesome` | `\core\output\pix_icon_fontawesome` | + + | `\pix_icon` | `\core\output\pix_icon` | + + | `\plugin_renderer_base` | `\core\output\plugin_renderer_base` | + + | `\popup_action` | `\core\output\actions\popup_action` | + + | `\preferences_group` | `\core\output\preferences_group` | + + | `\preferences_groups` | `\core\output\preferences_groups` | + + | `\progress_bar` | `\core\output\progress_bar` | + + | `\renderable` | `\core\output\renderable` | + + | `\renderer_base` | `\core\output\renderer_base` | + + | `\renderer_factory_base` | `\core\output\renderer_factory\renderer_factory_base` | + + | `\renderer_factory` | `\core\output\renderer_factory\renderer_factory_interface` | + + | `\single_button` | `\core\output\single_button` | + + | `\single_select` | `\core\output\single_select` | + + | `\standard_renderer_factory` | `\core\output\renderer_factory\standard_renderer_factory` | + + | `\table_dataformat_export_format` | `\core_table\dataformat_export_format` | + + | `\table_default_export_format_parent` | `\core_table\base_export_format` | + + | `\table_sql` | `\core_table\sql_table` | + + | `\tabobject` | `\core\output\tabobject` | + + | `\tabtree` | `\core\output\tabtree` | + + | `\templatable` | `\core\output\templatable` | + + | `\theme_config` | `\core\output\theme_config` | + + | `\theme_overridden_renderer_factory` | `\core\output\renderer_factory\theme_overridden_renderer_factory` | + + | `\url_select` | `\core\output\url_select` | + + | `\user_picture` | `\core\output\user_picture` | + + | `\xhtml_container_stack` | `\core\output\xhtml_container_stack` | + + | `\YUI_config` | `\core\output\requirements\yui` | + + type: improved diff --git a/blocks/classes/output/block_contents.php b/blocks/classes/output/block_contents.php new file mode 100644 index 00000000000..6d8f7850e4c --- /dev/null +++ b/blocks/classes/output/block_contents.php @@ -0,0 +1,168 @@ +. + +namespace core_block\output; + +/** + * This class represents how a block appears on a page. + * + * During output, each block instance is asked to return a block_contents object, + * those are then passed to the $OUTPUT->block function for display. + * + * contents should probably be generated using a moodle_block_..._renderer. + * + * Other block-like things that need to appear on the page, for example the + * add new block UI, are also represented as block_contents objects. + * + * @copyright 2009 Tim Hunt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since Moodle 2.0 + * @package core_block + * @category output + */ +class block_contents { + /** Used when the block cannot be collapsed **/ + const NOT_HIDEABLE = 0; + + /** Used when the block can be collapsed but currently is not **/ + const VISIBLE = 1; + + /** Used when the block has been collapsed **/ + const HIDDEN = 2; + + /** + * @var int Used to set $skipid. + */ + protected static $idcounter = 1; + + /** + * @var int All the blocks (or things that look like blocks) printed on + * a page are given a unique number that can be used to construct id="" attributes. + * This is set automatically be the {@see prepare()} method. + * Do not try to set it manually. + */ + public $skipid; + + /** + * @var int If this is the contents of a real block, this should be set + * to the block_instance.id. Otherwise this should be set to 0. + */ + public $blockinstanceid = 0; + + /** + * @var int If this is a real block instance, and there is a corresponding + * block_position.id for the block on this page, this should be set to that id. + * Otherwise it should be 0. + */ + public $blockpositionid = 0; + + /** + * @var array An array of attribute => value pairs that are put on the outer div of this + * block. {@see $id} and {@see $classes} attributes should be set separately. + */ + public $attributes; + + /** + * @var string The title of this block. If this came from user input, it should already + * have had format_string() processing done on it. This will be output inside + *