Ejemplo n.º 1
0
 /**
  * @param DC_General|\Avisota\Contao\Entity\Layout $layout
  *
  * @return array
  */
 public static function getDefaultSelectedCellContentElements($layout)
 {
     $value = array();
     list($group, $mailChimpTemplate) = explode(':', $layout->getMailchimpTemplate());
     if (isset($GLOBALS['AVISOTA_MAILCHIMP_TEMPLATE'][$group][$mailChimpTemplate])) {
         $config = $GLOBALS['AVISOTA_MAILCHIMP_TEMPLATE'][$group][$mailChimpTemplate];
         if (isset($config['cells'])) {
             foreach ($config['cells'] as $cellName => $cellConfig) {
                 if (isset($cellConfig['preferredElements'])) {
                     foreach ($cellConfig['preferredElements'] as $elementName) {
                         $value[] = $cellName . ':' . $elementName;
                     }
                 } else {
                     foreach ($GLOBALS['TL_MCE'] as $elements) {
                         foreach ($elements as $elementType) {
                             $value[] = $cellName . ':' . $elementType;
                         }
                     }
                 }
             }
         }
     }
     return $value;
 }
 /**
  * Render content for a specific cell.
  *
  * @param Message $message
  * @param string  $cell
  *
  * @param Layout  $layout
  *
  * @return StringBuilder
  */
 public function renderCell(Message $message, $cell, Layout $layout = null)
 {
     global $container;
     if (!$layout || $layout->getType() != 'mailChimp') {
         return null;
     }
     /** @var \Avisota\Contao\Message\Core\Renderer\MessageRendererInterface $renderer */
     $renderer = $container['avisota.message.renderer'];
     return $renderer->renderCell($message, $cell, $layout);
 }