Providing further information during package installation

Providing further information during package installation

From concrete5 v5.5, package developers can provide further information or even take input during the installation of their package


Snippet by Ollie / / Comments / Difficulty 
Providing further information during package installation

Ever since concrete5 version 5.5, package developers have been able to provide further information, or even take input, during the installation of their package. It's a great little feature that you can use to help provide installation or usage support at a point in the process when it won't be ignored!

To make this work you simply need to add a single file to your package. Create the file /elements/dashboard/install.php in your package tree and then add some text.

Now, try installing your package and you'll be presented with an additional dialog prompt before the installation starts which shows the text you input! You may want to format this text, but it's simple!! 

To take it one step further and actually pass input to your package's installation routine, add a form and some input fields to the install.php file we used above. Now, the form's $_POST data will be available to your package's installer as an array - simply modify your install() method declaration to look something like the below, where $data is now an array containing each form $_POST field:

public function install($data = array()) {
  $pkg = parent::install();

  ....

}

Join the conversation

comments powered by Disqus