This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Tschallacka
Tschallacka

I have a plugin and i'd like to load the contents of a Content element via what was defined in the plugin.

How do I do that because I'm getting exceptions and googling yields 0 results. Is there a php way I can request the content instead of the twiggy markup?

<span class="justified">
    {% content bannerheader.textcontent %}
</span>

I'll also be happy with an answer that loads it in the php part of the code.

$ret->content = unknownToMeLoadingFunctionOfContent($this->property('textcontent'));

Last updated

Tschallacka
Tschallacka

I'm on the track of a solution but I need to know how to get the current theme object from the plugin

Content::loadCached($this->theme, $name);

any way I can get access to the theme object from the plugin?

Tschallacka
Tschallacka

Allright, with some help from jraw I managed to think up a fix for this

You define a method in your controller which you name for example textcontent

You let this method return the correct property.

public function textcontent() {
    return $this->property('textcontent');
}

Then in the default.htm or whatever file you use

{% content __SELF__.textcontent %}

Which calls the above mentioned method and renders the content :-)

Last updated

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.