Main Menu
Contact
Popular Plugins
Sign In

So, files were written, a name is set, some database stuff was build etc. etc. At the end, you can see it says “Please edit…”. Now open up this file (config.php). This is the main config file of your Block Type. You can see a name, description and one field (“title”). Your contents should look like this:

<?php

return [
	// Block
	"block"  => [
		"name"        => t("Hello Block Developer"),
		"description" => t("Created with Block Developer"),
	],

	// Fields
	"fields" => [
		"title" => [
			"type"        => "Text",
			"label"       => t("A Text Input Field"),
			"description" => t("This is the description of the field"),
			"required"    => true,
			"searchable"  => true,
		],
	],
];

Now we can add fields, like a “Content” field and an “Image”. This is done in the “fields” section of this config file. In the default config file, there is a “title” field which has the “Text” (field) type. The label of this field is t("A Text Input Field") and also has a description. You can see it being a required field (because of the “true” value) and it is a searchable field – so it turns up in your search results if you use that on your site. You can set a “true” value to “false” too if you’d like of course, to achieve the opposite. The "title" part, right before “type”, is the variable as used in your view/template file(s). So make sure these are always unique. In case you have duplicates, the last one will always be overridden. How would the file look with the 2 extra fields then? Like this:

<?php

return [
	// Block
	"block"  => [
		"name"        => t("Hello Block Developer"),
		"description" => t("Created with Block Developer"),
	],

	// Fields
	"fields" => [
		"title" => [
			"type"        => "Text",
			"label"       => t("A Text Input Field"),
			"description" => t("This is the description of the field"),
			"required"    => true,
			"searchable"  => true,
		],
		"content" => [
			"type"        => "Wysiwyg",
			"label"       => t("Some content"),
			"required"    => true,
			"searchable"  => true,
		],
		"awesomeImage" => [
			"type"        => "Image",
			"label"       => t("An awesome image"),
			"required"    => true,
			"searchable"  => true,
		],
	],
];

Now run the same command as you did before:

concrete/bin/concrete5 c5:block-developer -b hello_block_developer

And you’re good to go. Your Block Type is installed, has been updated with the new fields and can be added wherever you’d want to.

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