|
| _load_instance ($instance, $page) |
| Set up a particular instance of this class given data from the block_insances table and the current page. More...
|
|
| _self_test () |
| Tests if this block has been implemented correctly. More...
|
|
| applicable_formats () |
| Which page types this block may appear on. More...
|
|
| before_delete () |
| Function that can be overridden to do extra cleanup before the database tables are deleted. More...
|
|
| config_save ($data) |
| Default behavior: save all variables as $CFG properties You don't need to override this if you 're satisfied with the above. More...
|
|
| get_aria_role () |
| Returns the aria role attribute that best describes this block. More...
|
|
| get_config_for_external () |
| Return the plugin config settings for external functions. More...
|
|
| get_content () |
| Return the content of this block. More...
|
|
| get_content_for_external ($output) |
| Return an object containing all the block content to be returned by external functions. More...
|
|
| get_content_for_output ($output) |
| Return a block_contents object representing the full contents of this block. More...
|
|
| get_content_type () |
| Returns the class $content_type var value. More...
|
|
| get_required_javascript () |
| Allows the block to load any JS it requires into the page. More...
|
|
| get_title () |
| Returns the class $title var value. More...
|
|
| has_config () |
| Subclasses should override this and return true if the subclass block has a settings.php file. More...
|
|
| hide_header () |
| Default return is false - header will be shown. More...
|
|
| html_attributes () |
| Return any HTML attributes that you want added to the outer. More...
|
|
| init () |
| Initialise the block.
|
|
| instance_allow_config () |
| Is each block of this type going to have instance-specific configuration? Normally, this setting is controlled by instance_allow_multiple(): if multiple instances are allowed, then each will surely need its own configuration. More...
|
|
| instance_allow_multiple () |
| Are you going to allow multiple instances of each block? If yes, then it is assumed that the block WILL USE per-instance configuration. More...
|
|
| instance_can_be_collapsed () |
| If overridden and set to false by the block it will not be collapsible. More...
|
|
| instance_can_be_docked () |
| Can be overridden by the block to prevent the block from being dockable. More...
|
|
| instance_can_be_hidden () |
| If overridden and set to false by the block it will not be hidable when editing is turned on. More...
|
|
| instance_config_commit ($nolongerused=false) |
| Replace the instance's configuration data with those currently in $this->config;. More...
|
|
| instance_config_save ($data, $nolongerused=false) |
| Serialize and store config data. More...
|
|
| instance_copy ($fromid) |
| Copy any block-specific data when copying to a new block instance. More...
|
|
| instance_create () |
| Do any additional initialization you may need at the time a new block instance is created. More...
|
|
| instance_delete () |
| Delete everything related to this instance if you have been using persistent storage other than the configdata field. More...
|
|
| is_empty () |
| Returns true or false, depending on whether this block has any content to display and whether the user has permission to view the block. More...
|
|
| name () |
| Returns the block name, as present in the class name, the database, the block directory, etc etc. More...
|
|
| refresh_content () |
| First sets the current value of $this->content to NULL then calls the block's get_content() function to set its value back. More...
|
|
| specialization () |
| This function is called on your subclass right after an instance is loaded Use this function to act on instance data just after it's loaded and before anything else is done For instance: if your block will have different title's depending on location (site, course, blog, etc) More...
|
|
| user_can_addto ($page) |
| Allows the block class to have a say in the user's ability to create new instances of this block. More...
|
|
| user_can_edit () |
| Allows the block class to have a say in the user's ability to edit (i.e., configure) blocks of this type. More...
|
|
|
string | $arialabel = NULL |
| The name of the block to be displayed in the block title area if the title is empty. More...
|
|
stdObject | $config = NULL |
| An object containing the instance configuration information for the current instance of this block. More...
|
|
stdObject | $content = NULL |
| An object to contain the information to be displayed in the block. More...
|
|
int | $content_type = BLOCK_TYPE_TEXT |
| The type of content that this block creates. More...
|
|
stdClass | $context = NULL |
| This blocks's context.
|
|
int | $cron = NULL |
| How often the cronjob should run, 0 if not at all. More...
|
|
block | $instance = NULL |
| The initialized instance of this block object. More...
|
|
moodle_page | $page = NULL |
| The page that this block is appearing on.
|
|
string | $str |
| Internal var for storing/caching translated strings $str.
|
|
string | $title = NULL |
| The title of the block to be displayed in the block title area. More...
|
|
block_base::applicable_formats |
( |
| ) |
|
|
inherited |
Which page types this block may appear on.
The information returned here is processed by the blocks_name_allowed_in_format() function. Look there if you need to know exactly how this works.
Default case: everything except mod and tag.
- Return values
-
array | page-type prefix => true/false. |
Reimplemented in block_activity_modules, block_activity_results, block_admin_bookmarks, block_badges, block_blog_menu, block_blog_recent, block_blog_tags, block_comments, block_completionstatus, block_course_summary, block_feedback, block_html, block_login, block_lp, block_mentees, block_mnet_hosts, block_myoverview, block_myprofile, block_navigation, block_private_files, block_quiz_results, block_recent_activity, block_recentlyaccessedcourses, block_recentlyaccesseditems, block_rss_client, block_search_forums, block_section_links, block_selfcompletion, block_settings, block_site_main_menu, block_social_activities, block_starredcourses, block_tag_flickr, block_tag_youtube, block_tags, and block_timeline.
block_base::get_config_for_external |
( |
| ) |
|
|
inherited |
Return the plugin config settings for external functions.
In some cases the configs will need formatting or be returned only if the current user has some capabilities enabled.
- Return values
-
stdClass | the configs for both the block instance and plugin (as object with name -> value) |
- Since
- Moodle 3.8
Reimplemented in block_activity_results, block_blog_recent, block_blog_tags, block_course_list, block_glossary_random, block_html, block_mentees, block_myoverview, block_myprofile, block_navigation, block_online_users, block_recentlyaccessedcourses, block_rss_client, block_section_links, block_settings, block_starredcourses, block_tag_flickr, block_tag_youtube, and block_tags.
block_base::html_attributes |
( |
| ) |
|
|
inherited |
Return any HTML attributes that you want added to the outer.
that of the block when it is output.
Because of the way certain JS events are wired it is a good idea to ensure that the default values here still get set. I found the easiest way to do this and still set anything you want is to override it within your block in the following way
function html_attributes() { $attributes = parent::html_attributes(); $attributes['class'] .= ' mynewclass'; return $attributes; }
- Return values
-
array | attribute name => value. |
Reimplemented in block_html, block_list, and block_navigation.
block_base::instance_allow_config |
( |
| ) |
|
|
inherited |
Is each block of this type going to have instance-specific configuration? Normally, this setting is controlled by instance_allow_multiple(): if multiple instances are allowed, then each will surely need its own configuration.
However, in some cases it may be necessary to provide instance configuration to blocks that do not want to allow multiple instances. In that case, make this function return true. I stress again that this makes a difference ONLY if instance_allow_multiple() returns false.
- Return values
-
Reimplemented in block_badges, block_blog_menu, block_blog_recent, block_blog_tags, block_myprofile, block_navigation, block_rss_client, block_section_links, block_settings, and block_tags.
block_base::specialization |
( |
| ) |
|
|
inherited |
This function is called on your subclass right after an instance is loaded Use this function to act on instance data just after it's loaded and before anything else is done For instance: if your block will have different title's depending on location (site, course, blog, etc)
Reimplemented in block_badges, block_blog_tags, block_comments, block_course_summary, block_glossary_random, block_html, block_mentees, block_myprofile, block_private_files, block_rss_client, block_tag_flickr, block_tag_youtube, and block_tags.