This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol CustomCollectionViewDelegate: UICollectionViewDelegate{ | |
func collectionView(sectionPosition collectionView: UICollectionView, for indexPath: IndexPath) -> CollectionPosition | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MARK: CustomLayoutInvalidationContext | |
class CustomLayoutInvalidationContext: UICollectionViewLayoutInvalidationContext { | |
var invalidatedBecauseOfBoundsChange: Bool = false | |
} | |
// MARK: CustomCollectionViewLayout | |
class CustomCollectionViewLayout: UICollectionViewLayout { | |
private enum ContentUpdateValue{ | |
case fixed(value: CGFloat) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomLayoutInvalidationContext: UICollectionViewLayoutInvalidationContext { | |
var invalidatedBecauseOfBoundsChange: Bool = false | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func invalidateLayout(with context: UICollectionViewLayoutInvalidationContext) { | |
let invalidationContext = context as! CustomLayoutInvalidationContext | |
if invalidationContext.invalidatedBecauseOfBoundsChange || invalidationContext.invalidateEverything { | |
layoutAttributesForItems.removeAll() | |
} | |
super.invalidateLayout(with: invalidationContext) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? { | |
var visibleLayoutAttributes: [UICollectionViewLayoutAttributes] = [] | |
for attributes in layoutAttributesForItems.values { | |
if attributes.frame.intersects(rect) { | |
visibleLayoutAttributes.append(attributes) | |
} | |
} | |
return visibleLayoutAttributes | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func prepare(){ | |
//Here we calculate all the dimensions we need for our collection view | |
//Stuff like item height, item width and collection view size | |
//We create x and y offsets for our items based on their collection position | |
//Also we create layout attributes for each item inside our collection view | |
//Layout attributes are cached so we wouldn’t need to recalculate them | |
//every time attribute is requested | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum CollectionPosition { | |
case start | |
case end | |
case inline | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @var \Pimcore\Templating\PhpEngine $this | |
* @var \Pimcore\Templating\PhpEngine $view | |
* @var \Pimcore\Templating\GlobalVariables $app | |
*/ | |
$this->extend('layout.html.php'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\Routing\Annotation\Route; | |
use Pimcore\Model\DataObject\Brand; | |
use Pimcore\Model\DataObject\Product; | |
class BrandController extends AbstractController | |
{ | |
/** | |
* @Route("/en/brandpages/{id}", name="brand") | |
*/ |