Showing with 31 additions and 2 deletions.
  1. +8 −0 CHANGELOG.md
  2. +21 −0 src/PanelTraits/Read.php
  3. +1 −1 src/resources/views/columns/select.blade.php
  4. +1 −1 src/resources/views/columns/text.blade.php
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ All Notable changes to `Backpack CRUD` will be documented in this file
- Nothing
-----------

## [3.4.9] - 2018-05-10

## Fixed
- #1378 - when a custom default page length is specified, it should show up in the page length menu;
- #1297 - possible XSS vulnerability in ```select``` field type; now using ```e()``` to escape the attribute;
- #1383 - ability to display relationship information using dot notation in the ```text``` column type;


## [3.4.8] - 2018-05-07

## Fixed
Expand Down
21 changes: 21 additions & 0 deletions src/PanelTraits/Read.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,25 @@ public function getDefaultPageLength()
return 25;
}

/**
* If a custom page length was specified as default, make sure it
* also show up in the page length menu.
*/
public function addCustomPageLengthToPageLengthMenu()
{
// If the default Page Length isn't in the menu's values, Add it the beginnin and resort all to show a croissant list.
// assume both array are the same lenght.
if (! in_array($this->getDefaultPageLength(), $this->page_length_menu[0])) {
// Loop through 2 arrays of prop. page_length_menu
foreach ($this->page_length_menu as $key => &$page_length_choices) {
// This is a condition that should be always true.
if (is_array($page_length_choices)) {
array_unshift($page_length_choices, $this->getDefaultPageLength());
}
}
}
}

/**
* Specify array of available page lengths on the list view.
*
Expand Down Expand Up @@ -218,6 +237,8 @@ public function getPageLengthMenu()
}
}

$this->addCustomPageLengthToPageLengthMenu();

return $this->page_length_menu;
}

Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/columns/select.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<?php
$attributes = $crud->getModelAttributeFromRelation($entry, $column['entity'], $column['attribute']);
if (count($attributes)) {
echo implode(', ', $attributes);
echo e(implode(', ', $attributes));
} else {
echo '-';
}
Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/columns/text.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{-- regular object attribute --}}
@php
$value = $entry->{$column['name']};
$value = data_get($entry, $column['name']);
@endphp

<span>
Expand Down