/**
  * Gets the text from the data source
  * @param \ride\library\widget\WidgetProperties $widgetProperties Instance
  * of the widget properties
  * @param string $locale Code of the current locale
  * @return \ride\web\cms\text\Text Instance of the text
  */
 public function getText(WidgetProperties $widgetProperties, $locale)
 {
     $callToActions = array();
     $widgetProperties->getWidgetProperties(TextWidget::PROPERTY_CTA . '.' . $locale);
     foreach ($widgetProperties as $key => $value) {
         $keyTokens = explode('.', $key);
         if (count($keyTokens) < 3) {
             continue;
         }
         if (!isset($callToActions[$keyTokens[2]])) {
             $callToActions[$keyTokens[2]] = new GenericCallToAction();
         }
         $method = 'set' . ucfirst($keyTokens[3]);
         $callToActions[$keyTokens[2]]->{$method}($value);
     }
     $text = new GenericText();
     $text->setFormat($widgetProperties->getLocalizedWidgetProperty($locale, TextWidget::PROPERTY_FORMAT));
     $text->setTitle($widgetProperties->getLocalizedWidgetProperty($locale, TextWidget::PROPERTY_TITLE));
     $text->setSubtitle($widgetProperties->getLocalizedWidgetProperty($locale, TextWidget::PROPERTY_SUBTITLE));
     $text->setBody($widgetProperties->getLocalizedWidgetProperty($locale, TextWidget::PROPERTY_BODY));
     $text->setImage($widgetProperties->getLocalizedWidgetProperty($locale, str_replace('-', '.', TextWidget::PROPERTY_IMAGE)));
     $text->setImageAlignment($widgetProperties->getLocalizedWidgetProperty($locale, str_replace('-', '.', TextWidget::PROPERTY_IMAGE_ALIGNMENT)));
     $text->setCallToActions($callToActions);
     return $text;
 }