Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Simple function call in blueprint does not return anything

Solved by Dimitri Longo View solution

Started by Anna 7 years ago · 2 replies · 713 views
7 years ago

I have a blueprint with a form for a template in my plugin, and I would like to add a display field that shows a remote image on the Admin page. This image's html tag is assembled by a plugin function. However, I can't even return a single word.

The blueprint looks like this:

YAML
title: Cloudinary
'@extends':
    type: default
    context: blueprints://pages

form:
  fields:
    tabs:
      fields:

        cloudinary:
          type: tab
          title: Cloudinary
          fields:
            header.public_id:
              type: text
              label: PLUGIN_CLOUDINARY.PUBLIC_ID
              validate:
                type: required
            header.options:
              type: array
              label: PLUGIN_CLOUDINARY.OPTIONS
            cl_file:
              label: Thumbnail image
              type: display
              #content: test
              data-content@: '\Grav\Plugin\Cloudinary::getClFile'

The function looks like this:

TXT
class CloudinaryPlugin extends Plugin
{
/**
 * get Cloudinary file for admin
 */
    public static function getClFile()
    {
        return "something";
    }
}

Shouldn't this output a simple "something" in the form? What am I doing wrong? Really grateful for any pointers!

7 years ago Solution

i will use classname

YAML
cl_file:
  label: Thumbnail image
  type: display
  #content: test
  data-content@: '\Grav\Plugin\CloudinaryPlugin::getClFile'
7 years ago

That was IT thank youuuuuuuu 😍

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by FrViPofm, 4 days ago
5 82 3 days ago
Forms & Blueprints · by Ton Haarmans, 6 years ago
13 2113 7 months ago
Forms & Blueprints · by Hugo Oliveira, 8 months ago
0 596 8 months ago
Forms & Blueprints · by Flachy Joe, 9 months ago
9 687 9 months ago
Forms & Blueprints · by Augustus, 10 months ago
7 737 10 months ago