Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402]

(no description)

File Size: 831 lines (30 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: DeclarationBlock  - X-Ref

Declaration blocks are the parts of a CSS file which denote the rules belonging to a selector.

Declaration blocks usually appear directly inside a `Document` or another `CSSList` (mostly a `MediaQuery`).
__construct($iLineNo = 0)   X-Ref

param: int $iLineNo

parse(ParserState $oParserState, $oList = null)   X-Ref

param: CSSList|null $oList
return: DeclarationBlock|false

setSelectors($mSelector, $oList = null)   X-Ref

param: array<int, Selector|string>|string $mSelector
param: CSSList|null $oList

removeSelector($mSelector)   X-Ref
Remove one of the selectors of the block.

param: Selector|string $mSelector
return: bool

getSelector()   X-Ref

return: array<int, Selector|string>

setSelector($mSelector, $oList = null)   X-Ref

param: Selector|string $mSelector
param: CSSList|null $oList
return: void

getSelectors()   X-Ref

return: array<int, Selector|string>

expandShorthands()   X-Ref
Splits shorthand declarations (e.g. `margin` or `font`) into their constituent parts.

return: void

createShorthands()   X-Ref
Creates shorthand declarations (e.g. `margin` or `font`) whenever possible.

return: void

expandBorderShorthand()   X-Ref
Splits shorthand border declarations (e.g. `border: 1px red;`).

Additional splitting happens in expandDimensionsShorthand.

Multiple borders are not yet supported as of 3.

return: void

expandDimensionsShorthand()   X-Ref
Splits shorthand dimensional declarations (e.g. `margin: 0px auto;`)
into their constituent parts.

Handles `margin`, `padding`, `border-color`, `border-style` and `border-width`.

return: void

expandFontShorthand()   X-Ref
Converts shorthand font declarations
(e.g. `font: 300 italic 11px/14px verdana, helvetica, sans-serif;`)
into their constituent parts.

return: void

expandBackgroundShorthand()   X-Ref
Converts shorthand background declarations
(e.g. `background: url("chess.png") gray 50% repeat fixed;`)
into their constituent parts.

return: void

expandListStyleShorthand()   X-Ref

return: void

createShorthandProperties(array $aProperties, $sShorthand)   X-Ref

param: array<array-key, string> $aProperties
param: string $sShorthand
return: void

createBackgroundShorthand()   X-Ref

return: void

createListStyleShorthand()   X-Ref

return: void

createBorderShorthand()   X-Ref
Combines `border-color`, `border-style` and `border-width` into `border`.

Should be run after `create_dimensions_shorthand`!

return: void

createDimensionsShorthand()   X-Ref
Looks for long format CSS dimensional properties
(margin, padding, border-color, border-style and border-width)
and converts them into shorthand CSS properties.

return: void

createFontShorthand()   X-Ref
Looks for long format CSS font properties (e.g. `font-weight`) and
tries to convert them into a shorthand CSS `font` property.

At least `font-size` AND `font-family` must be present in order to create a shorthand declaration.

return: void

__toString()   X-Ref

return: string

render(OutputFormat $oOutputFormat)   X-Ref

return: string