PHP code example of it-blaster / checkbox-list-bundle
1. Go to this page and download the library: Download it-blaster/checkbox-list-bundle 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/ */
it-blaster / checkbox-list-bundle example snippets
php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new ItBlaster\CheckboxListBundle\ItBlasterCheckboxListBundle(),
);
}
php
class ContactGroup extends BaseContactGroup
{
protected $form_contacts = NULL;
/**
* Привязанные контакты
* Используется только в форме CMS
*
* @return null
*/
public function getFormContacts()
{
return $this->form_contacts;
}
/**
* Привязанные контакты
* Используется только в форме CMS
*
* @param mixed $form_contacts
*/
public function setFormContacts($form_contacts)
{
$this->form_contacts = $form_contacts;
}
/**
* Обновляем привязанные контакты
* Используется только в форме CMS
*/
public function updateContacts()
{
$object_list = $this->getFormContacts();
if ($object_list !== NULL) {
//затираем старые значения
ContactQuery::create()
->filterByGroupId($this->getId())
->update(array('GroupId' => NULL));
//выставляем новые
if (is_array($object_list) && count($object_list)) {
ContactQuery::create()
->filterById($object_list)
->update(array('GroupId' => $this->getId()));
}
}
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.