2017 © Pedro PelĂĄez
 

library components

Collection of swoopaholic components

image

swoopaholic/components

Collection of swoopaholic components

  • Thursday, October 29, 2015
  • by Danny Dörfel
  • Repository
  • 2 Watchers
  • 0 Stars
  • 856 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Swoopaholic Components

This bundle of components is used for decoupling logic with view rendering. Using code independent of rendering creates as more flexible way of using different templates or even front-end templates like mustache., (*1)

Usage

Will be here soon..., (*2)

For now, to enable dependency injectino for the table component:, (*3)

in the BundleNameExtension class:, (*4)

``` php $tableLoader = new Loader\XmlFileLoader($container, new FileLocator($container->getParameter('kernel.root_dir') . '/../vendor/swoopaholic/components/Swoopaholic/Component/Table/Resources/config')); $tableLoader->load('twig.xml'); $tableLoader->load('table.xml');, (*5)


in the Bundle class ``` php ... use Swoopaholic\Component\Table\Extension\DependencyInjection\Compiler\TablePass; use Swoopaholic\Component\Table\Extension\DependencyInjection\Compiler\TableTemplatePass; ... public function build(ContainerBuilder $container) { $container->addCompilerPass(new TablePass()); $container->addCompilerPass(new TableTemplatePass()); }

To define the crud table:, (*6)

``` php <?php namespace Namespace\Bundle\MyBundle\CrudTable;, (*7)

use Swoopaholic\Component\Table\Extension\Crud\Type\TableType; use Swoopaholic\Component\Table\TableBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface;, (*8)

class UserType extends TableType { public function setDefaultOptions(OptionsResolverInterface $resolver) { parent::setDefaultOptions($resolver); $resolver->setRequired(array('data')); }, (*9)

public function buildTable(TableBuilderInterface $builder, array $options)
{
    $this
        ->addColumn('username', 'text', array('label' => 'Naam', 'sort' => 'username'))
        ->addColumn('email', 'text', array('label' => 'E-mail', 'sort' => 'email'))
        ->addColumn('enabled', 'text', array('label' => 'Enabled'))
        ->addColumn('last_login', 'datetime', array('label' => 'Ingelogd op', 'sort' => 'lastLogin'));

    parent::buildTable($builder, $options);
}

public function buildRowActions($builder, $cell, $item, array $options)
{
    $group = $builder->create('group', 'crud_action_group', array());
    $group->add('show', 'crud_action', array(
        'icon' => 'eye-open',
        'url' => $this->router->generate('nvs_framework_user_show', array('id' => $item->getId())),
        'label' => 'Bekijken',
        'attr' => array('data-rowclick' => '')
    ));

    $group->add('edit', 'crud_action', array(
        'icon' => 'eye-open',
        'url' => $this->router->generate('nvs_framework_user_edit', array('id' => $item->getId())),
        'label' => 'Bewerken',
        'attr' => array('data-rowclick' => '')
    ));

    $cell->add($group);
}

public function getParent()
{
    return 'table';
}

public function getName()
{
    return 'user';
}

}, (*10)


To use the new crud table, in the controller/action: ``` php $data = $this->getData() $tableFactory = $this->get('table.factory'); $table = $tableFactory->create( 'user', $data, array('table_route' => $route, 'responsive' => true) );

The Versions

29/10 2015

dev-master

9999999-dev

Collection of swoopaholic components

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Avatar Danny Dörfel

29/10 2015

0.2.1

0.2.1.0

Collection of swoopaholic components

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Avatar Danny Dörfel

23/09 2015

0.2.0

0.2.0.0

Collection of swoopaholic components

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Avatar Danny Dörfel

22/05 2015

0.1.x-dev

0.1.9999999.9999999-dev

Collection of swoopaholic components

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Avatar Danny Dörfel

22/05 2015

0.1.0

0.1.0.0

Collection of swoopaholic components

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Avatar Danny Dörfel