PHP code example of locomotivemtl / charcoal-contrib-formio

1. Go to this page and download the library: Download locomotivemtl/charcoal-contrib-formio 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/ */

    

locomotivemtl / charcoal-contrib-formio example snippets


/**
 * {@inheritdoc}
 *
 * @see StorableTrait::preSave()
 * @return boolean
 */
protected function preSave()
{
    $this->test = $this->p('test')->createOrUpdateRelation($this->test, null);

    return parent::preSave();
}

/**
 * {@inheritdoc}
 *
 * @see StorableTrait::preUpdate
 * @param array $properties Optional properties to update.
 * @return boolean
 */
protected function preUpdate(array $properties = null)
{
    $clone = clone $this; // Avoid calling `load()` on current object.
    $this->test = $this->p('test')->createOrUpdateRelation($this->test, $clone->load()->test);

    return parent::preUpdate($properties);
}