for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Copyright (c) Flipbox Digital Limited
* @license https://github.com/flipboxfactory/craft-element-lists/LICENSE
* @link https://github.com/flipboxfactory/craft-element-lists/
*/
namespace flipbox\craft\element\lists\fields;
use craft\base\ElementInterface;
use craft\base\FieldInterface;
* @author Flipbox Factory <[email protected]>
* @since 2.0.0
*
* @mixin FieldInterface
trait ElementListTrait
{
use ModifyElementQueryTrait,
NormalizeValueTrait,
InputTrait;
* @var bool
protected $ignoreSearchKeywords = true;
* @inheritdoc
public function getSearchKeywords($value, ElementInterface $element): string
if ($this->ignoreSearchKeywords === true) {
return '';
}
return parent::getSearchKeywords($value, $element);
* Identify whether a sort order should be enforced.
* @return bool
public function ensureSortOrder(): bool
return $this->sortable;
sortable
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
* Allow the settings to identify whether the element should be sortable
* @param bool $sortable
* @return $this
public function setSortable(bool $sortable)
$this->sortable = $sortable;
return $this;
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: