You are here

class FormHelper in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 8.4

Same name and namespace in other branches
  1. 8.8 src/Form/FormHelper.php \Drupal\varbase\Form\FormHelper
  2. 8.5 src/Form/FormHelper.php \Drupal\varbase\Form\FormHelper
  3. 8.6 src/Form/FormHelper.php \Drupal\varbase\Form\FormHelper
  4. 8.7 src/Form/FormHelper.php \Drupal\varbase\Form\FormHelper
  5. 9.0.x src/Form/FormHelper.php \Drupal\varbase\Form\FormHelper

Form helper.

Hierarchy

Expanded class hierarchy of FormHelper

1 string reference to 'FormHelper'
varbase.services.yml in ./varbase.services.yml
varbase.services.yml
1 service uses FormHelper
varbase.form_helper in ./varbase.services.yml
\Drupal\varbase\Form\FormHelper

File

src/Form/FormHelper.php, line 10

Namespace

Drupal\varbase\Form
View source
class FormHelper {

  /**
   * The element info plugin manager.
   *
   * @var \Drupal\Core\Render\ElementInfoManagerInterface
   */
  protected $elementInfo;

  /**
   * FormHelper constructor.
   *
   * @param \Drupal\Core\Render\ElementInfoManagerInterface $element_info
   *   Element info plugin manager.
   */
  public function __construct(ElementInfoManagerInterface $element_info) {
    $this->elementInfo = $element_info;
  }

  /**
   * Applies standard process for elements in the form.
   *
   * @param array $element
   *   Form element.
   */
  public function applyStandardProcessing(array &$element) {
    if (empty($element['#process'])) {
      $info = $this->elementInfo
        ->getInfo($element['#type']);
      if (isset($info['#process'])) {
        $element['#process'] = $info['#process'];
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FormHelper::$elementInfo protected property The element info plugin manager.
FormHelper::applyStandardProcessing public function Applies standard process for elements in the form.
FormHelper::__construct public function FormHelper constructor.