PHP code example of kunicmarko / configuration-panel

1. Go to this page and download the library: Download kunicmarko/configuration-panel 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/ */

    

kunicmarko / configuration-panel example snippets


$bundles = array(
    // ...
    new KunicMarko\SonataConfigurationPanelBundle\ConfigurationPanelBundle(),
);

$this->get('configuration_panel.global.service')->getAll()
$this->get('configuration_panel.global.service')->getValueFor()


namespace YourBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use KunicMarko\SonataConfigurationPanelBundle\Entity\AbstractConfiguration;
use Sonata\AdminBundle\Form\FormMapper;
use Symfony\Component\Form\Extension\Core\Type\DateType;

/**
*
* @ORM\Entity(repositoryClass="KunicMarko\SonataConfigurationPanelBundle\Repository\ConfigurationRepository")
*
*/
class NewType extends AbstractConfiguration
{
    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date", type="date", nullable=true)
     */
    private $date;

    /**
     * Set date
     *
     * @param \DateTime $date
     *
     * @return DateType
     */
    public function setDate($date)
    {
        $this->date = $date;

        return $this;
    }

    /**
     * Get date
     *
     * @return \DateTime
     */
    public function getDate()
    {
        return $this->date;
    }

    /**
     * Get date
     *
     * @return \DateTime
     */
    public function getValue()
    {
        return $this->getDate();
    }

    /**
     * {@inheritDoc}
     */
    public function getTemplate()
    {
        //return 'SonataAdminBundle:CRUD:list_string.html.twig'; can also be used 
        
        return 'ConfigurationPanelBundle:CRUD:list_field_date.html.twig';
    }

    /**
     * {@inheritDoc}
     */
    public function generateFormField(FormMapper $formMapper)
    {
        $formMapper->add('date', DateType::class, ['