Ejemplo n.º 1
0
 /**
  * Gets definition for tag column.
  *
  * @param DatagridConfiguration $config
  *
  * @return array
  */
 protected function getColumnDefinition(DatagridConfiguration $config)
 {
     $className = $this->getEntityClassName($config);
     $urlSafeClassName = $this->entityRoutingHelper->getUrlSafeClassName($className);
     $permissions = ['oro_tag_create' => $this->securityFacade->isGranted(TagManager::ACL_RESOURCE_CREATE_ID_KEY), 'oro_tag_unassign_global' => $this->securityFacade->isGranted(TagManager::ACL_RESOURCE_REMOVE_ID_KEY)];
     return ['label' => 'oro.tag.tags_label', 'type' => 'callback', 'frontend_type' => 'tags', 'callable' => function (ResultRecordInterface $record) {
         return $record->getValue(self::COLUMN_NAME);
     }, 'editable' => false, 'translatable' => true, 'renderable' => $this->taggableHelper->isEnableGridColumn($className), 'inline_editing' => ['enable' => $this->securityFacade->isGranted(TagManager::ACL_RESOURCE_ASSIGN_ID_KEY), 'editor' => ['view' => 'orotag/js/app/views/editor/tags-editor-view', 'view_options' => ['permissions' => $permissions]], 'save_api_accessor' => ['route' => 'oro_api_post_taggable', 'http_method' => 'POST', 'default_route_parameters' => ['entity' => $urlSafeClassName], 'route_parameters_rename_map' => ['id' => 'entityId']], 'autocomplete_api_accessor' => ['class' => 'oroui/js/tools/search-api-accessor', 'search_handler_name' => 'tags', 'label_field_name' => 'name']]];
 }
Ejemplo n.º 2
0
 /**
  * @dataProvider isTaggableDataProvider
  *
  * @param object     $object
  * @param bool       $expected
  * @param bool|false $needSetConfig
  * @param bool|false $hasConfig
  * @param bool|false $isEnableGridFilter
  */
 public function testIsEnableGridFilter($object, $expected, $needSetConfig = false, $hasConfig = false, $isEnableGridFilter = false)
 {
     if ($needSetConfig) {
         $this->setConfigProvider($object, $hasConfig, $isEnableGridFilter);
     }
     $this->assertEquals($expected, $this->helper->isEnableGridColumn($object));
 }