SproutCMS

This is the code documentation for the SproutCMS project

function fieldPlain()

Return HTML for a 'plain' field, i.e. one which doesn't require a FIELDSET wrapped around it.

The main wrapping DIV will contain additional classes if the field is required, disabled or has an error.
A class is also output for the field method name (if the name contains "Sprout\Helpers\Fb::" this is removed)
If the field has an explicit ID set, that will be added as a class on the wrapper too.

The special attribute "-wrapper-class" can be used to add classes to the wrapper DIV.
Multiple classes can be specified, space separated.
These classes will be prefixed with "field-element--"

Usage

string Form::fieldPlain ( callable $method , string $name , array $attrs , array $options );

Example

// Adds the class "field-element--small" to the wrapper
echo Form::fieldPlain('Sprout\Helpers\Fb::text', 'first_name', ['-wrapper-class' => 'small'], []);

Example

// Adds the class "field-element--id-first-name" to the wrapper
echo Form::fieldPlain('Sprout\Helpers\Fb::text', 'first_name', ['id' => 'first-name'], []);

Example

echo Form::fieldPlain('Sprout\Helpers\Fb::text', 'first_name', [], []);

Arguments

  1. callable $method
    The actual field rendering method
  2. string $name
    The field name - this is passed to the rendering method
  3. array $attrs
    The field attrs - this is passed to the rendering method
  4. array $options
    The field options - this is passed to the rendering method

Return value

  • string
    HTML