Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
cbed1284
Commit
cbed1284
authored
Dec 28, 2013
by
Andrew Nicols
Browse files
MDL-43506 Blocks: Remove various deprecated functions
parent
d29fb4ac
Changes
4
Hide whitespace changes
Inline
Side-by-side
blocks/moodleblock.class.php
View file @
cbed1284
...
...
@@ -75,12 +75,6 @@ class block_base {
*/
var
$content
=
NULL
;
/**
* A string generated by {@link _add_edit_controls()} to display block manipulation links when the user is in editing mode.
* @var string $edit_controls
*/
var
$edit_controls
=
NULL
;
/**
* The initialized instance of this block object.
* @var block $instance
...
...
@@ -484,32 +478,6 @@ class block_base {
return
false
;
}
/**
* Default behavior: print the config_instance.html file
* You don't need to override this if you're satisfied with the above
*
* @deprecated since Moodle 2.0.
* @return boolean whether anything was done. Blocks should use edit_form.php.
*/
function
instance_config_print
()
{
global
$CFG
,
$DB
,
$OUTPUT
;
// Default behavior: print the config_instance.html file
// You don't need to override this if you're satisfied with the above
if
(
!
$this
->
instance_allow_multiple
()
&&
!
$this
->
instance_allow_config
())
{
return
false
;
}
if
(
is_file
(
$CFG
->
dirroot
.
'/blocks/'
.
$this
->
name
()
.
'/config_instance.html'
))
{
echo
$OUTPUT
->
box_start
(
'generalbox boxaligncenter blockconfiginstance'
);
include
(
$CFG
->
dirroot
.
'/blocks/'
.
$this
->
name
()
.
'/config_instance.html'
);
echo
$OUTPUT
->
box_end
();
}
else
{
notice
(
get_string
(
'blockconfigbad'
),
str_replace
(
'blockaction='
,
'dummy='
,
qualified_me
()));
}
return
true
;
}
/**
* Serialize and store config data
*/
...
...
@@ -637,39 +605,6 @@ class block_base {
return
180
;
}
/** @deprecated since Moodle 2.0. */
function
_print_block
()
{
throw
new
coding_exception
(
'_print_block is no longer used. It was a private '
.
'method of the block class, only for use by the blocks system. You '
.
'should not have been calling it anyway.'
);
}
/** @deprecated since Moodle 2.0. */
function
_print_shadow
()
{
throw
new
coding_exception
(
'_print_shadow is no longer used. It was a private '
.
'method of the block class, only for use by the blocks system. You '
.
'should not have been calling it anyway.'
);
}
/** @deprecated since Moodle 2.0. */
function
_title_html
()
{
throw
new
coding_exception
(
'_title_html is no longer used. It was a private '
.
'method of the block class, only for use by the blocks system. You '
.
'should not have been calling it anyway.'
);
}
/** @deprecated since Moodle 2.0. */
function
_add_edit_controls
()
{
throw
new
coding_exception
(
'_add_edit_controls is no longer used. It was a private '
.
'method of the block class, only for use by the blocks system. You '
.
'should not have been calling it anyway.'
);
}
/** @deprecated since Moodle 2.0. */
function
config_print
()
{
throw
new
coding_exception
(
'config_print() can no longer be used. Blocks should use a settings.php file.'
);
}
/**
* Can be overridden by the block to prevent the block from being dockable.
*
...
...
blocks/myprofile/block_myprofile.php
View file @
cbed1284
...
...
@@ -212,24 +212,6 @@ class block_myprofile extends block_base {
public
function
specialization
()
{
}
/**
* displays instance configuration form
*
* @return boolean
*/
function
instance_config_print
()
{
return
false
;
/*
global $CFG;
$form = new block_myprofile.phpConfigForm(null, array($this->config));
$form->display();
return true;
*/
}
/**
* locations where block can be displayed
*
...
...
blocks/upgrade.txt
View file @
cbed1284
This files describes API changes in /blocks/* - activity modules,
information provided here is intended especially for developers.
=== 2.8 ===
* The instance_config_print() function was removed. It was deprecated in
Moodle 2.0, but without debugging notices. Since it was no longer a part
of the code path, debugging notices would not have been displayed.
* Deprecated functions were removed from the block_base class:
** _print_block()
** _print_shadow()
** _title_html()
** _add_edit_controls()
** config_print()
=== 2.6 ===
* Deprecated /admin/block.php was removed, make sure blocks are using settings.php instead.
...
...
lib/blocklib.php
View file @
cbed1284
...
...
@@ -28,16 +28,6 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
();
/**#@+
* @deprecated since Moodle 2.0. No longer used.
*/
define
(
'BLOCK_MOVE_LEFT'
,
0x01
);
define
(
'BLOCK_MOVE_RIGHT'
,
0x02
);
define
(
'BLOCK_MOVE_UP'
,
0x04
);
define
(
'BLOCK_MOVE_DOWN'
,
0x08
);
define
(
'BLOCK_CONFIGURE'
,
0x10
);
/**#@-*/
/**#@+
* Default names for the block regions in the standard theme.
*/
...
...
@@ -45,14 +35,6 @@ define('BLOCK_POS_LEFT', 'side-pre');
define
(
'BLOCK_POS_RIGHT'
,
'side-post'
);
/**#@-*/
/**#@+
* @deprecated since Moodle 2.0. No longer used.
*/
define
(
'BLOCKS_PINNED_TRUE'
,
0
);
define
(
'BLOCKS_PINNED_FALSE'
,
1
);
define
(
'BLOCKS_PINNED_BOTH'
,
2
);
/**#@-*/
define
(
'BUI_CONTEXTS_FRONTPAGE_ONLY'
,
0
);
define
(
'BUI_CONTEXTS_FRONTPAGE_SUBS'
,
1
);
define
(
'BUI_CONTEXTS_ENTIRE_SITE'
,
2
);
...
...
@@ -485,19 +467,6 @@ class block_manager {
$this
->
extracontent
[
$region
][]
=
$bc
;
}
/**
* When the block_manager class was created, the {@link add_fake_block()}
* was called add_pretend_block, which is inconsisted with
* {@link show_only_fake_blocks()}. To fix this inconsistency, this method
* was renamed to add_fake_block. Please update your code.
* @param block_contents $bc the content of the block-like thing.
* @param string $region a block region that exists on this page.
*/
public
function
add_pretend_block
(
$bc
,
$region
)
{
debugging
(
DEBUG_DEVELOPER
,
'add_pretend_block has been renamed to add_fake_block. Please rename the method call in your code.'
);
$this
->
add_fake_block
(
$bc
,
$region
);
}
/**
* Checks to see whether all of the blocks within the given region are docked
*
...
...
@@ -1949,28 +1918,6 @@ function block_add_block_ui($page, $output) {
return
$bc
;
}
// Functions that have been deprecated by block_manager =======================
/**
* @deprecated since Moodle 2.0 - use $page->blocks->get_addable_blocks();
*
* This function returns an array with the IDs of any blocks that you can add to your page.
* Parameters are passed by reference for speed; they are not modified at all.
*
* @param $page the page object.
* @param $blockmanager Not used.
* @return array of block type ids.
*/
function
blocks_get_missing
(
&
$page
,
&
$blockmanager
)
{
debugging
(
'blocks_get_missing is deprecated. Please use $page->blocks->get_addable_blocks() instead.'
,
DEBUG_DEVELOPER
);
$blocks
=
$page
->
blocks
->
get_addable_blocks
();
$ids
=
array
();
foreach
(
$blocks
as
$block
)
{
$ids
[]
=
$block
->
id
;
}
return
$ids
;
}
/**
* 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.
...
...
@@ -2102,23 +2049,6 @@ function blocks_set_visibility($instance, $page, $newvisibility) {
$DB
->
insert_record
(
'block_positions'
,
$bp
);
}
/**
* @deprecated since 2.0
* Delete all the blocks from a particular page.
*
* @param string $pagetype the page type.
* @param integer $pageid the page id.
* @return bool success or failure.
*/
function
blocks_delete_all_on_page
(
$pagetype
,
$pageid
)
{
global
$DB
;
debugging
(
'Call to deprecated function blocks_delete_all_on_page. '
.
'This function cannot work any more. Doing nothing. '
.
'Please update your code to use a block_manager method $PAGE->blocks->....'
,
DEBUG_DEVELOPER
);
return
false
;
}
/**
* Get the block record for a particular blockid - that is, a particular type os block.
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment