/**
  * @param GridBuilderInterface $builder
  * @param array                $options
  *
  * @return GridBuilderInterface|mixed
  */
 public function buildGrid(GridBuilderInterface $builder, array $options = array())
 {
     /** @var \Bigfish\Bundle\ConfigurationBundle\ConfigurationManager $config */
     $config = $this->_configurationManager->getConfiguration($options['module']);
     $fields = $config->get('grid_fields');
     $this->eavColumns->setModule($options['module']);
     $builder->addField(new Field('sort', array('label' => false, 'header' => array('attr' => array('width' => 50)), 'formatValueCallback' => function ($value) {
         return '<span class="sortable glyphicon glyphicon glyphicon-menu-hamburger" data-id="{{ row.container_id }}"></span>';
     })));
     if (is_array($fields) && $fields) {
         foreach ($fields as $field) {
             foreach ($this->eavColumns->getColumns() as $column) {
                 if ($column['identifier'] == $field) {
                     $builder->addField(new Field($column['identifier'], array('label' => $column['label'])));
                 }
             }
         }
     }
     $builder->addField(new Field('show', array('header' => array('attr' => array('width' => 50)), 'item' => array('attr' => array('class' => '')), 'formatValueCallback' => function ($value) {
         return '
                         <input type="hidden" class="hide" name="grid_item_display[{{ row.container_id }}]" value="0" />
                         <input type="checkbox" class="glyphicon glyphicon-eye-close toggle-display" name="grid_item_display[{{ row.container_id }}]" value="1" {{ row.display ? "checked" : "" }} />
                     ';
     })));
     $builder->addField(new Field('edit', array('label' => false, 'header' => array('attr' => array('width' => 50)), 'item' => array('attr' => array('class' => 'btn btn-sm btn-warning')), 'childItem' => array('attr' => array('class' => 'glyphicon glyphicon-pencil')), 'url' => array('module_item_edit' => array('module' => 'module_id', 'container' => 'container_id')))));
     $builder->addField(new Field('delete', array('label' => false, 'header' => array('attr' => array('width' => 50)), 'item' => array('attr' => array('class' => 'btn btn-sm btn-danger open-modal')), 'childItem' => array('attr' => array('class' => 'glyphicon glyphicon-trash')), 'url' => array('module_item_delete' => array('module' => 'module_id', 'container' => 'container_id')))));
     $builder->addButton(new Button('toevoegen', array('label' => false, 'attr' => array('class' => 'btn btn-success'), 'route' => array('routeName' => 'module_item_create', 'routeParameters' => array('module' => $options['module']->getId())), 'childItem' => array('attr' => array('class' => 'glyphicon glyphicon-plus')), 'showInHeader' => true)));
     $builder->addButton(new Button('save', array('childItem' => array('attr' => array('class' => 'glyphicon glyphicon-ok-sign')), 'label' => 'bigfish.grid.save', 'attr' => array('class' => 'btn btn-info hide saveGrid'), 'showInFooter' => true)));
     return $builder;
 }
 /**
  * @param  GridBuilderInterface       $builder
  * @param  array                      $options
  * @return GridBuilderInterface|mixed
  */
 public function buildGrid(GridBuilderInterface $builder, array $options = array())
 {
     /** @var \Bigfish\Bundle\ConfigurationBundle\ConfigurationManager $config */
     $config = $this->_configurationManager->getConfiguration($options["module"]);
     $fields = $config->get("grid_fields");
     //        $eavColumns = new EavColumns($this->_objectManager, $this->_columnMapper, $options["module"]);
     $this->eavColumns->setModule($options["module"]);
     $builder->addField(new Field("id", array("label" => false, "header" => array("attr" => array("width" => 50)), "formatValueCallback" => function ($value) {
         return '<span class="sortable glyphicon glyphicon glyphicon-menu-hamburger" data-id="{{ row.container_id }}"></span>';
     })));
     if (is_array($fields) && $fields) {
         foreach ($fields as $field) {
             foreach ($this->eavColumns->getColumns() as $column) {
                 if ($column['identifier'] == $field) {
                     $builder->addField(new Field($column['identifier'], array('label' => $column['label'])));
                 }
             }
         }
     }
     $builder->addField(new Field("show", array("header" => array("attr" => array("width" => 50)), "item" => array("attr" => array("class" => "")), "formatValueCallback" => function ($value) {
         return '
                         <input type="hidden" class="hide" name="grid_item_display[{{ row.container_id }}]" value="0" />
                         <input type="checkbox" class="glyphicon glyphicon-eye-close toggle-display" name="grid_item_display[{{ row.container_id }}]" value="1" {{ row.display ? "checked" : "" }} />
                     ';
     })));
     $builder->addField(new Field("edit", array("label" => false, "header" => array("attr" => array("width" => 50)), "item" => array("attr" => array("class" => "btn btn-sm btn-warning")), "childItem" => array("attr" => array("class" => "glyphicon glyphicon-pencil")), "url" => array("resource_edit" => array("resource" => "resource_id", "parent" => "parent_id")))));
     $builder->addField(new Field("delete", array("label" => false, "header" => array("attr" => array("width" => 50)), "item" => array("attr" => array("class" => "btn btn-sm btn-danger open-modal")), "childItem" => array("attr" => array("class" => "glyphicon glyphicon-trash")), "url" => array("resource_delete" => array("resource" => "resource_id")))));
     $builder->addButton(new Button("toevoegen", array("label" => false, "attr" => array("class" => "btn btn-success"), "route" => array("routeName" => "resource_create", "routeParameters" => array("template" => $options["template"]->getId(), "parent" => $options["parent"])), "childItem" => array("attr" => array("class" => "glyphicon glyphicon-plus")), "showInHeader" => true)));
     $builder->addButton(new Button("save", array("childItem" => array("attr" => array("class" => "glyphicon glyphicon-ok-sign")), "label" => "bigfish.grid.save", "attr" => array("class" => "btn btn-info hide saveGrid"), "showInFooter" => true)));
     return $builder;
 }
 public function getConfig()
 {
     if (null == $this->module) {
         throw new \Exception('First set a module');
     }
     return $this->configurationManager->getConfiguration('BigfishEavBundle:Configuration', array('module' => $this->module));
 }