PHP Class Apple_Exporter\Components\Body

Since: 0.2.0
Inheritance: extends Component
Show file Open project: alleyinteractive/apple-news Class Usage Examples

Public Properties

Property Type Description
$needs_layout_if_anchored boolean Override. This component doesn't need a layout update if marked as the target of an anchor.

Protected Properties

Property Type Description
$can_be_anchor_target boolean Quotes can be anchor targets.

Public Methods

Method Description
node_matches ( DomNode $node ) : mixed Look for node matches for this component.
set_default_style ( ) Set the default style for the component.
to_array ( ) : array This component needs to ensure it didn't end up with empty content.

Protected Methods

Method Description
build ( string $text ) Build the component.

Private Methods

Method Description
get_col_start ( ) Get the start column for the body based on the layout.
get_default_style ( ) : array Get the default style for the component.
set_default_layout ( ) Set the default layout for the component.
set_initial_dropcap_style ( ) Set the initial dropcap style for the component.
split_non_markdownable ( string $html ) : array Split the non markdownable content for processing.

Method Details

build() protected method

Build the component.
protected build ( string $text )
$text string

node_matches() public static method

Look for node matches for this component.
public static node_matches ( DomNode $node ) : mixed
$node DomNode
return mixed

set_default_style() public method

Set the default style for the component.
public set_default_style ( )

to_array() public method

This will go through sanitize_text_field later as part of the assembled JSON. Therefore, tags aren't valid but we need to catch them now or we could encounter a parsing error when it's already too late. We also can't do this sooner, such as in build, because at that point the component could still contain nested, valid tags. We don't want to modify the JSON since it will still undergo further processing. We only want to check if, on its own, this component would end up empty.
public to_array ( ) : array
return array

Property Details

$can_be_anchor_target protected property

Quotes can be anchor targets.
protected bool $can_be_anchor_target
return boolean

$needs_layout_if_anchored public property

Override. This component doesn't need a layout update if marked as the target of an anchor.
public bool $needs_layout_if_anchored
return boolean