Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Simple function call in blueprint does not return anything

Solved by Dimitri Longo View solution

Started by Anna 8 years ago · 2 replies · 859 views
8 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!

8 years ago Solution

i will use classname

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

That was IT thank youuuuuuuu 😍

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Anna, 2 days ago
2 53 16 hours ago
Forms & Blueprints · by Anna, 3 days ago
7 82 16 hours ago
Forms & Blueprints · by Anna, 1 week ago
5 186 6 days ago
Forms & Blueprints · by TomW, 1 month ago
3 379 1 month ago
Forms & Blueprints · by Japhy, 2 months ago
2 595 2 months ago