Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
blocklib.php File Reference

Classes

class  block_manager
 This class keeps track of the block that should appear on a moodle_page. More...
 
class  block_not_on_page_exception
 Exception thrown when someone tried to do something with a block that does not exist on a page. More...
 

Functions

 block_add_block_ui ($page, $output)
 Functions update the blocks if required by the request parameters ==========.
 
 block_instance ($blockname, $instance=NULL, $page=NULL)
 Creates a new instance of the specified block class.
 
 block_instance_by_id ($blockinstanceid)
 Returns a new instance of the specified block instance id.
 
 block_load_class ($blockname)
 Load the block class for a particular type of block.
 
 block_method_result ($blockname, $method, $param=NULL)
 Helper functions for working with block classes ============================.
 
 blocks_add_default_course_blocks ($course)
 Add the default blocks to a course.
 
 blocks_add_default_system_blocks ()
 Add the default system-context blocks.
 
 blocks_delete_all_for_context ($contextid)
 Delete all the blocks that belong to a particular context.
 
 blocks_delete_instance ($instance, $nolongerused=false, $skipblockstables=false)
 Delete a block, and associated data.
 
 blocks_delete_instances ($instanceids)
 Delete multiple blocks at once.
 
 blocks_find_block ($blockid, $blocksarray)
 Find a given block by its blockid within a provide array.
 
 blocks_get_default_site_course_blocks ()
 
 blocks_get_record ($blockid=NULL, $notusedanymore=false)
 Get the block record for a particular blockid - that is, a particular type os block.
 
 blocks_name_allowed_in_format ($name, $pageformat)
 Check that a given name is in a permittable format.
 
 blocks_parse_default_blocks_list ($blocksstr)
 Parse a list of default blocks.
 
 blocks_remove_inappropriate ($course)
 Actually delete from the database any blocks that are currently on this page, but which should not be there according to blocks_name_allowed_in_format.
 
 blocks_set_visibility ($instance, $page, $newvisibility)
 Set a block to be visible or hidden on a particular page.
 
 default_page_type_list ($pagetype, $parentcontext=null, $currentcontext=null)
 Generates a default page type list when a more appropriate callback cannot be decided upon.
 
 generate_page_type_patterns ($pagetype, $parentcontext=null, $currentcontext=null)
 Given a specific page type, parent context and currect context, return all the page type patterns that might be used by this block.
 
 matching_page_type_patterns ($pagetype)
 Given a specific page type, return all the page type patterns that might match it.
 
 matching_page_type_patterns_from_pattern ($pattern)
 Give an specific pattern, return all the page type patterns that would also match it.
 
 mod_page_type_list ($pagetype, $parentcontext=null, $currentcontext=null)
 Generates the page type list for a module by either locating and using the modules callback or by generating a default list.
 
 my_page_type_list ($pagetype, $parentcontext=null, $currentcontext=null)
 Generates the page type list for the my moodle page.
 

Variables

const BLOCK_ADDBLOCK_POSITION_CUSTOM -1
 
const BLOCK_ADDBLOCK_POSITION_DEFAULT 0
 
const BLOCK_ADDBLOCK_POSITION_FLATNAV 1
 
const BLOCK_POS_LEFT 'side-pre'
 #+ Default names for the block regions in the standard theme.
 
const BLOCK_POS_RIGHT 'side-post'
 
const BUI_CONTEXTS_CURRENT 0
 
const BUI_CONTEXTS_CURRENT_SUBS 1
 
const BUI_CONTEXTS_ENTIRE_SITE 2
 
const BUI_CONTEXTS_FRONTPAGE_ONLY 0
 #-
 
const BUI_CONTEXTS_FRONTPAGE_SUBS 1