StoutLogic / acf-builder

An Advanced Custom Field Configuration Builder
GNU General Public License v2.0
794 stars 62 forks source link

No such function setInstructions after Repeater or Group #117

Closed mortensassi closed 4 years ago

mortensassi commented 4 years ago

If i want to set an instructions text after an repeater or group i get an error - how do i overcome this?

Fatal error: Uncaught Exception: No such function: setInstructions in M:\Sites\MY_CLIENT\06-Dev\app\public\vendor\stoutlogic\acf-builder\src\ParentDelegationBuilder.php on line 69

<?php

namespace App;

use StoutLogic\AcfBuilder\FieldsBuilder;

$tabs = new FieldsBuilder('tabs');

$tabs
    ->addText('headline')
    ->addRepeater('tabs', ['label' => 'Tabbed content', 'layout' => 'block', 'button_label' => 'Add content'])
        ->addText('title')
        ->addTextarea('text')
        ->addUrl('link')
    ->endRepeater()
    ->setInstructions('test');

return $tabs;
stevep commented 4 years ago

@mortensassi I believe instructions have to be added to a field. You can use a message field (see: addMessage) if there is no field in particular to add instruction text too.

mortensassi commented 4 years ago

Thanks @stevep that makes sense! I have wrapped a Group around the fields which allows to set an instruction!