PHP code example of nswdpc / silverstripe-details-field
1. Go to this page and download the library: Download nswdpc/silverstripe-details-field library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nswdpc / silverstripe-details-field example snippets
namespace MyApp;
use NSWDPC\Forms\DetailsField\DetailsField;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;
// ... etc
$childFields = FieldList::create(
TextField::create('Salutation', _t('myapp.SALUTATION','Salutation')),
TextField::create('FirstName', _t('myapp.FIRST_NAME','First name')),
TextField::create('Surname', _t('myapp.SURNAME','Surname'))
);
$detailsField = DetailsField::create($childFields)
->setTitle(
_t(
'myapp.PROVIDE_DETAILS',
'Provide some optional information'
)
)->setDescription(
_t(
'myapp.PROVIDE_DETAILS_DESCRIPTION',
'A field description'
)
);
// by default the element is in a closed state, to open by default (or when values are present in the child fields)
// $detailsField = $detailsField->setIsOpen(true)
// push onto form fields
$fields->push($detailsField);
// ... etc
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.