# contact-forms/2.3.0/PFBC/View.php

Contact Forms by Cimatti, version 2.3.0. 77 lines.

- Page: https://pluginprobe.com/plugins/contact-forms/2.3.0/code/PFBC/View.php
- Raw: https://pluginprobe.com/plugins/contact-forms/2.3.0/raw/PFBC/View.php
- Modified: 2026-04-08T09:49:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/contact-forms/2.3.0/code/PFBC/View.php#L10-L20`.

```php
<?php
/**
 * PFBC (PHP Form Builder Class) - Third-party library
 * @package PFBC
 */

// phpcs:disable WordPress.Security.EscapeOutput, WordPress.NamingConventions.PrefixAllGlobals, PluginCheck.CodeAnalysis.Heredoc -- Third-party library

abstract class View extends Base {
	protected $form;

	public function __construct(?array $properties = null) {
		$this->configure($properties);
	}

	/*This method encapsulates the various pieces that are included in an element's label.*/
	protected function renderLabel($element) {
        $label = $element->getLabel();
        $id = $element->getID();
        $description = $element->getDescription();
        if(!empty($label) || !empty($description)) {
            echo '<div class="pfbc-label">';
            if(!empty($label)) {
                echo '<label for="', $id, '">';
                if($element->isRequired())
                    echo '<span class="pfbc-required" aria-label="required">*</span> ';
                echo $label, '</label>'; 
            }
            if(!empty($description))
                echo '<em>', $description, '</em>';
            echo '</div>';
        }
    }

	/*Render inline error messages for an element with proper ARIA support*/
	protected function renderInlineError($element) {
		$errors = $element->getErrors();
		$errorID = $element->getErrorID();
		if(!empty($errors) && !empty($errorID)) {
			echo '<div class="pfbc-inline-error" id="', $errorID, '" role="alert" aria-live="polite">';
			echo '<span class="pfbc-error-icon" aria-hidden="true">⚠</span> ';
			echo '<span class="pfbc-error-text">', implode(' ', $errors), '</span>';
			echo '</div>';
		}
	}

	public function setForm(Form $form) {
		$this->form = $form;
	}

	/*jQuery is used to apply css entries to the last element.*/
	public function jQueryDocumentReady() {
		echo 'jQuery("#', $this->form->getId(), ' .pfbc-element:last").css({ "margin-bottom": "0", "padding-bottom": "0", "border-bottom": "none" });';
	}	

	public function render() {}

	public function renderCSS() {
		$id = $this->form->getId();

		/*For ease-of-use, default styles are applied to form elements.*/
		if(!in_array("style", $this->form->getPrevent())) {
			echo <<<CSS
#$id .pfbc-label label { font-weight: bold; }
#$id .pfbc-label em { font-size: .9em; color: #888; }
#$id .pfbc-label strong { color: #990000; }
#$id .pfbc-textbox, #$id .pfbc-textarea, #$id .pfbc-select { border: 1px solid #ccc; font-size: 14px; }
#$id .pfbc-textbox, #$id .pfbc-textarea { padding: 7px; }
#$id .pfbc-select { padding: 6px 7px; }
#$id img.pfbc-loading { position: absolute; top: 50%; right: .5em; margin-top: -8px; border: 0; }
CSS;
		}
	}

	public function renderJS() {}
}

```
