Accessor to get preview string

@return string
766280
public function getPreviewAttribute()
    {
        if ($this->use_html) {
            return 'HTML Content';
        } elseif ($this->path) {
            $row_image = ImageHelper::getImageUrl($this->path);
            return '<img src="' . $row_image . '" class="thumbnail" />';
        }
    }
339845
public function viewItem()
    {
        $this->loadStandaloneMode();

		if (!$this->isXmlHttpRequest()) {
			throw new common_exception_BadRequest('wrong request mode');
		}

		$itemClass = $this->getCurrentClass();
		$item = $this->getCurrentInstance();

		$lang = null;
		if($this->hasRequestParameter('target_lang')){
			$lang = $this->getRequestParameter('target_lang');
		}

		$hiddenProperties = array(
			taoItems_models_classes_ItemsService::PROPERTY_ITEM_CONTENT
		);

		$properties = array();
		foreach($this->getClassService()->getClazzProperties($itemClass) as $property){
			if(in_array($property->getUri(), $hiddenProperties)){
				continue;
			}
			$range = $property->getRange();

			if(is_null($lang)){
				$propValues = $item->getPropertyValues($property);
			} else {
				$propContainer = $item->getPropertyValuesByLg($property, $lang);
				$propValues = $propContainer->getIterator();
			}
			foreach($propValues as $propValue){
				if($range->getUri() == OntologyRdfs::RDFS_LITERAL){
					$value = (string)$propValue;
				} else {
					$resource = new core_kernel_classes_Resource($propValue);
					$value = $resource->getLabel();
				}
				$properties[] = array(
					'name'	=> $property->getLabel(),
					'value'	=> $value
				);
			}
		}

		$previewData = $this->initPreview($item, $itemClass);
		if(count($previewData) == 0){
			$this->setData('preview', false);
			$this->setData('previewMsg', __('Not yet available'));
		}
		else{
			$this->setData('preview', true);
			$this->setData('instanceUri', tao_helpers_Uri::encode($item->getUri(), false));
			foreach($previewData as $key => $value){
				$this->setData($key, $value);
			}
		}

		$this->setData('uri', tao_helpers_Uri::encode($item->getUri()));
		$this->setData('classUri', tao_helpers_Uri::encode($itemClass->getUri()));

		$this->setData('label', $item->getLabel());
		$this->setData('itemProperties', $properties);
		$this->setView('view.tpl');
	}
1099718
public function previewVal()
    {
        $val = parent::inputVal();
        if (empty($val)) {
            return '';
        }

        $parts = parse_url($val);
        if (empty($parts['scheme']) && !in_array($val[0], [ '/', '#', '?' ])) {
            $path  = isset($parts['path']) ? ltrim($parts['path'], '/') : '';
            $query = isset($parts['query']) ? $parts['query'] : '';
            $hash  = isset($parts['fragment']) ? $parts['fragment'] : '';
            $val   = $this->baseUrl->withPath($path)->withQuery($query)->withFragment($hash);
        }

        return $val;
    }
514375
public function display_preview($require_user_idnumber=false) {
        global $OUTPUT;

        debugging('function grade_export::display_preview is deprecated.', DEBUG_DEVELOPER);

        $userprofilefields = grade_helper::get_user_profile_fields($this->course->id, $this->usercustomfields);
        $formatoptions = new stdClass();
        $formatoptions->para = false;

        echo $OUTPUT->heading(get_string('previewrows', 'grades'));

        echo '<table>';
        echo '<tr>';
        foreach ($userprofilefields as $field) {
            echo '<th>' . $field->fullname . '</th>';
        }
        if (!$this->onlyactive) {
            echo '<th>'.get_string("suspended")."</th>";
        }
        foreach ($this->columns as $grade_item) {
            echo '<th>'.$this->format_column_name($grade_item).'</th>';

            /// add a column_feedback column
            if ($this->export_feedback) {
                echo '<th>'.$this->format_column_name($grade_item, true).'</th>';
            }
        }
        echo '</tr>';
        /// Print all the lines of data.
        $i = 0;
        $gui = new graded_users_iterator($this->course, $this->columns, $this->groupid);
        $gui->require_active_enrolment($this->onlyactive);
        $gui->allow_user_custom_fields($this->usercustomfields);
        $gui->init();
        while ($userdata = $gui->next_user()) {
            // number of preview rows
            if ($this->previewrows and $this->previewrows <= $i) {
                break;
            }
            $user = $userdata->user;
            if ($require_user_idnumber and empty($user->idnumber)) {
                // some exports require user idnumber so we can match up students when importing the data
                continue;
            }

            $gradeupdated = false; // if no grade is update at all for this user, do not display this row
            $rowstr = '';
            foreach ($this->columns as $itemid=>$unused) {
                $gradetxt = $this->format_grade($userdata->grades[$itemid]);

                // get the status of this grade, and put it through track to get the status
                $g = new grade_export_update_buffer();
                $grade_grade = new grade_grade(array('itemid'=>$itemid, 'userid'=>$user->id));
                $status = $g->track($grade_grade);

                if ($this->updatedgradesonly && ($status == 'nochange' || $status == 'unknown')) {
                    $rowstr .= '<td>'.get_string('unchangedgrade', 'grades').'</td>';
                } else {
                    $rowstr .= "<td>$gradetxt</td>";
                    $gradeupdated = true;
                }

                if ($this->export_feedback) {
                    $rowstr .=  '<td>'.$this->format_feedback($userdata->feedbacks[$itemid]).'</td>';
                }
            }

            // if we are requesting updated grades only, we are not interested in this user at all
            if (!$gradeupdated && $this->updatedgradesonly) {
                continue;
            }

            echo '<tr>';
            foreach ($userprofilefields as $field) {
                $fieldvalue = grade_helper::get_user_field_value($user, $field);
                // @see profile_field_base::display_data().
                echo '<td>' . format_text($fieldvalue, FORMAT_MOODLE, $formatoptions) . '</td>';
            }
            if (!$this->onlyactive) {
                $issuspended = ($user->suspendedenrolment) ? get_string('yes') : '';
                echo "<td>$issuspended</td>";
            }
            echo $rowstr;
            echo "</tr>";

            $i++; // increment the counter
        }
        echo '</table>';
        $gui->close();
    }
970555
public function getPanel(): string
    {
        \ob_start();
        if (\is_file(__DIR__ . "/templates/{$this->id}.panel.phtml")) {
            $data = $this->data;
            require __DIR__ . "/templates/{$this->id}.panel.phtml";
        }

        return \ob_get_clean();
    }
326983
public function preview()
	{
		$objModule = \ModuleModel::findByPk($this->module);
		
		return '<div class="widget"><span style="color:#b3b3b3 ">' . $objModule->name . ' (ID ' . $objModule->id . ')</span></div>';
	}
773657
public function previewElementPattern($arrRow)
	{
		$key = $arrRow['invisible'] ? 'unpublished' : 'published';
		$type = $GLOBALS['TL_LANG']['CTP'][$arrRow['type']][0] ?: '&nbsp;';

		// Prepare option string (alias / replicable)
		switch ($arrRow['type'])
		{
			case 'section':
			case 'explanation':
			case 'protection':
			case 'visibility':
				break;
			
			default:
				$options = '<span style="color: #b3b3b3 ;padding-left: 3px"> (Template alias: $this->' . $arrRow['alias'] . ')</span>';
				break;
		}
		
		// Get pattern model and call view method
		$objPattern = new \PatternModel();
		$objPattern->setRow($arrRow);
		
		$strClass = Agoat\CustomContentElementsBundle\Contao\Pattern::findClass($objPattern->type);
				
		if (!class_exists($strClass))
		{
			static::log('Pattern element class "'.$strClass.'" (pattern element "'.$objPattern->type.'") does not exist', __METHOD__, TL_ERROR);
		}
		else
		{
			$objPatternClass = new $strClass($objPattern);	
			$strPatternView = $objPatternClass->preview();
		}
		
		return '<div class="cte_type ' . $key . '">' . $type . $options . '</div><div style="padding: 5px 0 10px;">' . $strPatternView . '</div>';
	}
1006818
public function getPreviewUrl()
    {
        if ($domain = $this->getBaseProperty('preliminaryDomain')) {
            $https = Kwf_Util_Https::domainSupportsHttps($domain);
            $protocol = $https ? 'https' : 'http';
            $url = $protocol . '://'.$domain.$this->url;
        } else {
            $url = $this->getAbsoluteUrl();
        }
        return Kwf_Setup::getBaseUrl().'/admin/component/preview/?url='.urlencode($url.'?kwcPreview');
    }
1332084
public function preview($e)
    {
        $configName = $e['config'];
        $template = $e['template'];
        $layout = $e['layout'];
        $headers = empty($e['headers']) ? [] : (array)$e['headers'];
        $theme = empty($e['theme']) ? '' : (string)$e['theme'];

        $email = new Email($configName);

        if (!empty($e['attachments'])) {
            $email->setAttachments($e['attachments']);
        }

        $email->setTransport('Debug')
            ->setTo($e['email'])
            ->setSubject($e['subject'])
            ->setEmailFormat($e['format'])
            ->addHeaders($headers)
            ->setMessageId(false)
            ->setReturnPath($email->getFrom())
            ->setViewVars($e['template_vars']);

        $email->viewBuilder()
            ->setTheme($theme)
            ->setTemplate($template)
            ->setLayout($layout);

        $return = $email->send();

        $this->out('Content:');
        $this->hr();
        $this->out($return['message']);
        $this->hr();
        $this->out('Headers:');
        $this->hr();
        $this->out($return['headers']);
        $this->hr();
        $this->out('Data:');
        $this->hr();
        debug($e['template_vars']);
        $this->hr();
        $this->out();
    }
776794
protected function _getPlainText()
    {
        if (empty($this->_properties['text'])) {
            return null;
        }

        //Loads the `BBCode` helper
        $BBCode = (new HelperRegistry(new View))->load('MeTools.BBCode');

        return trim(strip_tags($BBCode->remove($this->_properties['text'])));
    }
650157
public function render()
    {
        $this->setupDefaultOptions();

        if (!empty($this->value)) {
            $this->attribute('data-initial-preview', $this->preview());
            $this->attribute('data-initial-caption', $this->initialCaption($this->value));

            $this->setupPreviewOptions();
        }

        $this->options(['overwriteInitial' => true]);

        $options = json_encode($this->options);

        $this->script = <<<EOT

$("input{$this->getElementClassSelector()}").fileinput({$options});

EOT;

        return parent::render();
    }
510766
public function getDisplayNameAttribute()
    {
        if (! is_null($this->details->display_name)) {
            return $this->details->display_name;
        }

        if (! is_null($this->details->full_name)) {
            return $this->details->full_name;
        }

        return $this->email;
    }
1219186
public function preview()
	{
		$strPreview = '<div class="widget" style="padding-top:10px;"><h3 style="margin: 0;"><label>' . $this->label . '</label> <a href="javascript:void(0);" title="" > <img src="system/themes/flexible/icons/tablewizard.svg" alt="CSV import" style="vertical-align:text-bottom" height="14" width="16"></a></h3>';
		
		$strRowPreview = '<ul class="tl_listwizard" data-tabindex="1"><li><input type="text" class="tl_text" tabindex="1" value=""> <a href="javascript:void(0);"><img src="system/themes/flexible/icons/copy.svg" width="14" height="16" alt="Duplicate the element" class="tl_listwizard_img"></a> <a href="javascript:void(0);"><img src="system/themes/flexible/icons/drag.svg" width="14" height="16" alt="" class="drag-handle" title="Move the item via drag and drop"></a> <a href="javascript:void(0);"><img src="system/themes/flexible/icons/delete.svg" width="14" height="16" alt="Delete the element" class="tl_listwizard_img"></a></li></ul>';
			
		// Show three example lines
		$strPreview .= $strRowPreview;
		$strPreview .= $strRowPreview;
		$strPreview .= $strRowPreview;
		
		$strPreview .= '<p title="" class="tl_help tl_tip">' . $this->description . '</p></div>';	

		return $strPreview;
	}
859713
public function preview()
	{
		$strPreview = '<div class="' . (($this->classLong) ? 'long' : 'w50') . ((in_array($this->picker, array('datetime', 'color', 'link'))) ? ' wizard' : '') . ' widget" style="padding-top:10px;"><h3><label>' . $this->label . '</label></h3>';

		if ($this->picker == 'unit')
		{
			$strPreview .= '<input class="tl_text_unit" value="' . $this->defaultValue . '" type="text">';
			$strPreview .= ' <select class="tl_select_unit">';

			$units = StringUtil::deserialize($this->units);
			foreach ($units as $unit)
			{
				$strPreview .= '<option value="' . $unit['value'] . '">' . $unit['label'] . '</option>';
			}

			$strPreview .= '</select>';
		}
		
		elseif ($this->multiple)
		{
			$strPreview .= '<div>';
			
			for ($i = 0; $i < $this->multiple; $i++)
			{
				$strPreview .= '<input class="tl_text_' . $this->multiple . '" value="' . $this->defaultValue . '" type="text"> ';
			}

			$strPreview .= '</div>';
		}
		
		else
		{
			$strPreview .= '<input class="tl_text" value="' . $this->defaultValue . '" type="text">';
		}
		
		switch ($this->picker)
		{
			case 'datetime':
				$strPreview .=  ' <img src="assets/datepicker/images/icon.svg" height="20" width="20">';
				break;

			case 'color':
				$strPreview .=  ' <img src="system/themes/flexible/icons/pickcolor.svg" height="16" width="16">';
				break;
			
			case 'link':
				$strPreview .=  ' <img src="system/themes/flexible/icons/pickpage.svg" height="16" width="16">';
				break;
		}
		
		$strPreview .= '<p title="" class="tl_help tl_tip">' . $this->description . '</p></div>';	

		return $strPreview;
	}
718122
public function getPreview()
    {
        $url = trim($this->value);
        if (!$this->display_video || !$url) {
            return false;
        }
        $obj = VideoLink::create()->setValue($url);
        if ($obj->iFrameURL) {
            return $obj->Iframe($this->display_video, $this->preview_height);
        }
    }
147114
public function peekToEnd()
    {
        return substr($this->string, $this->scanOffset, strlen($this->string) - $this->scanOffset);        
    }
25541
def preview(self):
        """"""

        if hasattr(self, '_url'):
            url = self._url + '/preview'
            return self.post(url)
        else:
            url = urljoin(recurly.base_uri(), self.collection_path + '/preview')
            return self.post(url)