Problem/Motivation

DS provides this option for multi cardinality fields. It would be handy to limit the number of items we display for the outer chained field.

My use case is a teaser for a multi-cardinality media entity reference, where we display a single product image.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

Sam152 created an issue. See original summary.

sam152’s picture

Status: Active » Needs review
StatusFileSize
new6.66 KB
sam152’s picture

StatusFileSize
new2.18 KB
new6.63 KB

Whoops the "chained field" refers to the inner part, "field" is the outer referencing field.

larowlan’s picture

  1. +++ b/src/Plugin/DsField/ChainedField.php
    @@ -96,9 +97,21 @@ class ChainedField extends DsFieldBase {
    +    $element['chain_settings'] = [
    +      '#type' => 'container',
    +      '#weight' => -100,
    +    ];
    

    Should this go inside the if too?

  2. +++ b/src/Plugin/DsField/ChainedField.php
    @@ -127,8 +140,14 @@ class ChainedField extends DsFieldBase {
    +    $ui_limit = isset($this->configuration['chain_settings']['ui_limit']) ? $this->configuration['chain_settings']['ui_limit'] : NULL;
    

    oh for php7

  3. +++ b/tests/src/Kernel/ChainedFieldBuildTest.php
    @@ -80,4 +81,57 @@ class ChainedFieldBuildTest extends EntityKernelTestBase {
    +  public function testUiLimit() {
    

    nice

Also, some file mode changes in the patch (644 -> 755)

sam152’s picture

StatusFileSize
new835 bytes
new5.93 KB

1. It can be
2. Hah!
3. :)

File mode changes should be gone.

  • larowlan committed 5b78874 on 8.x-1.x authored by Sam152
    Issue #2960036 by Sam152, larowlan: Support the same "UI Limit" option...
larowlan’s picture

Status: Needs review » Fixed

Fixed, rolling a release, cheers

sam152’s picture

Aww yeah, thanks @larowlan.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.