You are here

protected function ContactBlock::getContactForm in Contact Block 8

Loads the contact form entity.

Return value

\Drupal\contact\Entity\ContactForm|null The contact form configuration entity. NULL if the entity does not exist.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

4 calls to ContactBlock::getContactForm()
ContactBlock::blockAccess in src/Plugin/Block/ContactBlock.php
Indicates whether the block should be shown.
ContactBlock::build in src/Plugin/Block/ContactBlock.php
Builds and returns the renderable array for this block plugin.
ContactBlock::calculateDependencies in src/Plugin/Block/ContactBlock.php
ContactBlock::createContactMessage in src/Plugin/Block/ContactBlock.php
Creates the contact message entity without saving it.

File

src/Plugin/Block/ContactBlock.php, line 256

Class

ContactBlock
Provides a 'ContactBlock' block.

Namespace

Drupal\contact_block\Plugin\Block

Code

protected function getContactForm() {
  if (!isset($this->contactForm)) {
    if (isset($this->configuration['contact_form'])) {
      $this->contactForm = $this->entityTypeManager
        ->getStorage('contact_form')
        ->load($this->configuration['contact_form']);
    }
  }
  return $this->contactForm;
}