dev-master
9999999-devSilverStripe form field for customizable input formats
MIT
The Requires
by Nico Blum
email silverstripe input postfix phone number prefix customizable
Wallogit.com
2017 © Pedro Peláez
SilverStripe form field for customizable input formats
This package is deprecated. There will be no features or bug fixes in future., (*1)
composer require "nblum/silverstripe-customizableinputfield" private static $db = array(
'Field' => 'CustomizableInputField'
);
Example for mail address with pre defined domain:, (*2)
_________ @example.com, (*3)
//creates a new fieldset $field = new CustomizableInputFieldSet('Field', 'Email address'); //creates a new part $part1 = new CustomizableInputFieldPart(); $part1->setAfter('@example.com'); $part1->setMaxLength(15); $field->addPart($part1); //adds the customized fieldset to the tab $fields->addFieldToTab('Root.Main', $field, 'Content');
Example for (german) mobile phone numbers:, (*4)
+49 (0) ___ / _________, (*5)
//creates a new fieldset $field = new CustomizableInputFieldSet('Field', 'Mobile Phone'); //creates a new part $part1 = new CustomizableInputFieldPart(); //the first param will be visible in admin form, the second in the template $part1->setBefore('+49', '+49 (0)'); $part1->setAfter('/'); $part1->setMaxLength(3); $field->addPart($part1); //creates a second part $part2 = new CustomizableInputFieldPart(); $part2->setMaxLength(9); $field->addPart($part2); //adds the customized fieldset to the tab $fields->addFieldToTab('Root.Main', $field, 'Content');
<!-- show the concatenated string for simple output --> <p>$Field1.Strval</p> <!-- loop over all parts of fieldset, for more individual output --> <p> <% loop $Field1.Parts %> <span>$Before $Value $After</span> <% end_loop %> </p>
SilverStripe form field for customizable input formats
MIT
email silverstripe input postfix phone number prefix customizable