TitanFramework::displayFrameworkError PHP Method

displayFrameworkError() public static method

Displays an error notice
Since: 1.0
public static displayFrameworkError ( string $message, array | object $errorObject = null ) : void
$message string The error message to display.
$errorObject array | object The object to dump inside the error message.
return void
    public static function displayFrameworkError($message, $errorObject = null)
    {
        // Clean up the debug object for display. e.g. If this is a setting, we can have lots of blank values.
        if (is_array($errorObject)) {
            foreach ($errorObject as $key => $val) {
                if ('' === $val) {
                    unset($errorObject[$key]);
                }
            }
        }
        // Display an error message.
        ?>
		<div style='margin: 20px; text-align: center;'><strong><?php 
        echo TF_NAME;
        ?>
 Error:</strong>
			<?php 
        echo $message;
        ?>
			<?php 
        if (!empty($errorObject)) {
            ?>
				<pre><code style="display: inline-block; padding: 10px"><?php 
            echo print_r($errorObject, true);
            ?>
</code></pre>
				<?php 
        }
        ?>
		</div>
		<?php 
    }

Usage Example

 /**
  * Constructor
  *
  * @since	1.4
  */
 function __construct($settings, $owner)
 {
     if (defined('WP_DEBUG')) {
         if (WP_DEBUG == true) {
             // Warn about deprecation, refer to `font` option
             TitanFramework::displayFrameworkError(sprintf(__('%s has been deprecated and will be removed in version %s! Please use %s instead to avoid errors in the future.', TF_I18NDOMAIN), '<code>select-googlefont</code>', '<code>1.5</code>', '<code>font</code>'));
         }
     }
     parent::__construct($settings, $owner);
     add_filter('tf_generate_css_select-googlefont_' . $this->getOptionNamespace(), array($this, 'generateCSS'), 10, 2);
 }
All Usage Examples Of TitanFramework::displayFrameworkError