diff --git a/Grid/Column/Column.php b/Grid/Column/Column.php index df97a0d4..59a4dab3 100755 --- a/Grid/Column/Column.php +++ b/Grid/Column/Column.php @@ -91,6 +91,7 @@ abstract class Column protected $class; protected $isManualField; protected $isAggregate; + protected $usePrefixTitle; protected $dataJunction = self::DATA_CONJUNCTION; @@ -128,7 +129,8 @@ public function __initialize(array $params) $this->setOperatorsVisible($this->getParam('operatorsVisible', true)); $this->setIsManualField($this->getParam('isManualField', false)); $this->setIsAggregate($this->getParam('isAggregate', false)); - + $this->setUsePrefixTitle($this->getParam('usePrefixTitle', true)); + // Order is important for the order display $this->setOperators($this->getParam('operators', array( self::OPERATOR_EQ, @@ -898,4 +900,18 @@ public function getIsAggregate() { return $this->isAggregate; } + + public function getUsePrefixTitle() + { + return $this->usePrefixTitle; + } + + public function setUsePrefixTitle($usePrefixTitle) + { + $this->usePrefixTitle = $usePrefixTitle; + return $this; + } + + + } diff --git a/Resources/doc/columns_configuration/annotations/column_annotation_property.md b/Resources/doc/columns_configuration/annotations/column_annotation_property.md index 4c369794..dd853bb3 100644 --- a/Resources/doc/columns_configuration/annotations/column_annotation_property.md +++ b/Resources/doc/columns_configuration/annotations/column_annotation_property.md @@ -64,7 +64,7 @@ class Product |values|array|_none_||For select filters or replace values in the grid| |searchOnClick|boolean|false|true or false|Sets the possibility to perform a search on the clicked cell (filterable has to be true)| |safe|string or false|html|false
or
see [Escape filters](http://twig.sensiolabs.org/doc/filters/escape.html)|Sets the escape filter| - +|usePrefixTitle|boolean|true|true or false|Use the prefixTitle of the grid to render title| **Note 1**: Every attribute has a setter and a getter method. **Note 2**: With the `values` attributes, if `type1` is found, the grid displays the value `Type 1`. **Note 3**: If operators are not visible, filtering is performed with the default operator. diff --git a/Resources/views/blocks.html.twig b/Resources/views/blocks.html.twig index 5d38ba2f..e9230061 100644 --- a/Resources/views/blocks.html.twig +++ b/Resources/views/blocks.html.twig @@ -64,10 +64,14 @@ {%- spaceless %} {% if column.type == 'massaction' %} - {% else %} - {% set columnTitle = grid.prefixTitle ~ column.title ~ '__abbr' %} - {% if columnTitle|trans == columnTitle %} - {% set columnTitle = grid.prefixTitle ~ column.title %} + {% else %} + {% if column.usePrefixTitle == true %} + {% set columnTitle = grid.prefixTitle ~ column.title ~ '__abbr' %} + {% if columnTitle|trans == columnTitle %} + {% set columnTitle = grid.prefixTitle ~ column.title %} + {% endif %} + {% else %} + {% set columnTitle = column.title %} {% endif %} {% if (column.sortable) %} {{ columnTitle|trans }} @@ -103,7 +107,11 @@