Main Menu
Contact
Popular Plugins
Sign In

Form template

For each field, you could define your own form template. By default, it is the following (HTML):

<div class="form-group">%s%s</div>

The first %s is the label, the second %s is the input itself. So let's say you don't want to display a label at all, and just the input. Then you could do something like this:

"name" => [
	"type"          => "Text",
	"label"         => t("Your Name"),
	"form_template" => '<div class="form-group">%2$s</div>',
],

So the %2$s let's the code know it's the second value we need, not the first. If you only use %s (go ahead and see for yourself), it would just display the first value - the label in this scenario. Feel free to add more HTML/CSS or anything else you'd like for a specific field. Perhaps you need some extra divs or classes and do some JavaScripting too. That's all OK. Perhaps though, it would be easier to make a "field type" out of what you want? So contact me if it's something others could profit from too and I'd be happy to implement that!

For your information: the form template uses the PHP function vsprintf. So that's why both %s and %2$s both work.

renderForm

It could be that you want to do some edits to the form, generated by Block Developer. Most things can be done by configuring and adding fields, but maybe it's something that's just not possible. You can shoot me a message saying what you'd like to achieve OR you could overrule the "renderForm" function, which renders the complete form. Just go to your controller.php file and add this function:

public function renderForm($view) {
    // Your code goes here
}

You can then navigate to /packages/block_developer/src/BlockDeveloper/Block/BlockController.php and copy (parts of) the contents of this function into your own controller.php file. Make the changes you need in your form and you should be ready to go. Would be best if you do return the parent function at the end though, to make it future proof!

public function renderForm($view) {
	// do something with variables maybe?
	return parent::renderForm($view);
}

Use, by you or one client, in a single end product. The total price includes the item price and a buyer fee.

  • Quality checked by Concrete5
  • Future updates
  • 30 Day Support
  • Concrete5 buyer fee: $35.70
Add to Concrete5 Cart

Use, by you or a client, in 5 single end products. The total price includes the item price and a buyer fee.

  • Quality checked by Concrete5
  • Future updates
  • 30 Day Support
  • Concrete5 buyer fee: $142.80
  • Save an extra: $119.00
Add to Concrete5 Cart

Use, by you or a client, in x/xx single end products.

Upon request, quote will be made and sent to you via email.

  • Quality checked by Concrete5
  • Future updates
  • 30 Day Support
  • Saves extra $$
Request Quote
Released 6 years ago
Updated 1 year ago
Installs 3
Requires concrete5 5.7.5.3
Current version 1.4.5
Skill level Bleeding Edge

Buyer Rating:

5 average based on 3 ratings More information

Got something to say? Need help?

View support forum