Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Simple function call in blueprint does not return anything

Solved by Dimitri Longo View solution

Started by Anna 7 years ago · 2 replies · 573 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 Ton Haarmans, 5 years ago
13 1138 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 62 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 136 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 110 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 130 7 months ago