buildMessage example

/** * Send a mail with the given content. * * @param string $content formatted email body to be sent * @param array $records the array of log records that formed this content * * @return void */
    protected function send(string $content, array $records)
    {
        $this->mailer->send($this->buildMessage($content$records));
    }

    /** * Gets the formatter for the Message subject. * * @param string $format The format of the subject */
    protected function getSubjectFormatter(string $format): FormatterInterface
    {
        return new LineFormatter($format);
    }

    
if ($this->BCCBatchMode && count($this->BCCArray) > $this->BCCBatchSize) {
            $this->batchBCCSend();

            if ($autoClear) {
                $this->clear();
            }

            return true;
        }

        $this->buildMessage();
        $result = $this->spoolEmail();

        if ($result) {
            $this->setArchiveValues();

            if ($autoClear) {
                $this->clear();
            }

            Events::trigger('email', $this->archive);
        }

        
/** * {@inheritdoc} */
  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL) {
    $form['#attributes']['class'][] = 'layout-builder-form';
    $form['layout_builder'] = [
      '#type' => 'layout_builder',
      '#section_storage' => $section_storage,
      '#process' => [[static::class, 'layoutBuilderElementGetKeys']],
    ];
    $form['layout_builder_message'] = $this->buildMessage($section_storage->getContextValue('display'));

    $this->sectionStorage = $section_storage;
    return parent::buildForm($form$form_state);
  }

  /** * Form element #process callback. * * Save the layout builder element array parents as a property on the top form * element so that they can be used to access the element within the whole * render array later. * * @see \Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController */

  public function buildForm(array $form, FormStateInterface $form_state, SectionStorageInterface $section_storage = NULL) {
    $this->sectionStorage = $section_storage;
    $form = parent::buildForm($form$form_state);
    $form['#attributes']['class'][] = 'layout-builder-form';

    // @todo \Drupal\layout_builder\Field\LayoutSectionItemList::defaultAccess()     // restricts all access to the field, explicitly allow access here until     // https://www.drupal.org/node/2942975 is resolved.     $form[OverridesSectionStorage::FIELD_NAME]['#access'] = TRUE;

    $form['layout_builder_message'] = $this->buildMessage($section_storage->getContextValue('entity')$section_storage);
    return $form;
  }

  /** * Renders a message to display at the top of the layout builder. * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity whose layout is being edited. * @param \Drupal\layout_builder\OverridesSectionStorageInterface $section_storage * The current section storage. * * @return array * A renderable array containing the message. */
Home | Imprint | This part of the site doesn't use cookies.