check_and_return()

Since: 1.0 Last Updated:
Back to Main Index

This safety function is used in the Layers_Widget class to check an option with isset()  and echo it out if it exists, if it does not exist, it returns false

Location: /core/widgets/modules/base.php

Parameters

  • $widget  – The $instance array which we will use to check against.
  • $option  – The first level key to check.
  • $array_level_1  – The first additional key to check.
  • $array_level_2  – The second additional key to check.

Usage

This function is used inside a widget when extending the Layers_Widget class.

The above will return the $widget['design']['fonts']['size'] if the keys exists and the end value not empty.

Conversely if you weren’t to use this function you’d have write the following code: