Пример #1
0
 /**
  * Add paragraph to Area
  *
  * #### Example
  * ```php
  * $objArea->addParagraph(
  *     "Cool paragraph with lots of text in it. It's an absolute must-read.",
  *     "You must read this"
  * );
  * ```
  *
  * @param string $strBody The paragraph's body text
  * @param string $strHeader The paragraph's optional header
  * @param array $meta Standard meta array
  * @return \ValidFormBuilder\Paragraph
  */
 public function addParagraph($strBody, $strHeader = "", $meta = array())
 {
     $objParagraph = new Paragraph($strHeader, $strBody, $meta);
     $objParagraph->setMeta("parent", $this, true);
     // *** Add field to the fieldset.
     $this->__fields->addObject($objParagraph);
     return $objParagraph;
 }
Пример #2
0
 /**
  * Adds a \ValidFormBuilder\Paragraph object to the internal elements collection.
  *
  * This renders a paragraph inside the form. Formfields can be added before and after the paragraph.
  * **Example:**
  *
  * ```php
  * $objForm->addField("name", "Your Name", ValidForm::VFORM_STRING);
  * $objForm->addParagraph("Next, you should enter your last name.", "Enter your name!");
  * $objForm->addField("last-name", "Last Name", ValidForm::VFORM_STRING);
  * ```
  *
  * @param string $strBody Paragraph body
  * @param string $strHeader Optional header above the paragraph
  * @param array $meta Custom meta array
  * @return \ValidFormBuilder\Paragraph
  */
 public function addParagraph($strBody, $strHeader = "", $meta = array())
 {
     $objParagraph = new Paragraph($strHeader, $strBody, $meta);
     // *** Fieldset already defined?
     $objFieldset = $this->__elements->getLast("ValidFormBuilder\\Fieldset");
     if ($this->__elements->count() == 0 || !is_object($objFieldset)) {
         $objFieldset = $this->addFieldset();
     }
     $objParagraph->setMeta("parent", $objFieldset, true);
     // *** Add field to the fieldset.
     $objFieldset->addField($objParagraph);
     return $objParagraph;
 }