0

I'm using Drupal 8 and have question about Inline Entity Form module.

Is it possible to introduce pagination in inline entity form module somehow?

Ideally, I'm looking for already available solution, but I'm fine if I will have to extend the module for this. But I'm not sure how it can be done.

Any pointers and help would be much appreciated.

0

I'm not ruling out mystery module that I am unaware of, but I can give some insight.

The first obvious choice is the API, just reference the hooks in : /modules/contrib/inline_entity_form/inline_entity_form.api.php

You can also add a FieldWidget in your module like: YOUR_MODULE/src/Plugin/Field/FieldWidget/IEFPagination.php, then you would select it under Manage Form Display.

namespace Drupal\YOUR_MODULE\Plugin\Field\FieldWidget;

use Drupal\inline_entity_form\Plugin\Field\FieldWidget\InlineEntityFormComplex;

/**
 *
 * @FieldWidget(
 *   id = "ief_paginated",
 *   label = @Translation("IEF - Paginated"),
 *   field_types = {
 *     "entity_reference"
 *   },
 *   multiple_values = true
 * )
 */

class IEFPagination extends InlineEntityFormComplex {

 public function formElement(\Drupal\Core\Field\FieldItemListInterface $items, $delta, array $element, array &$form, \Drupal\Core\Form\FormStateInterface $form_state) {

    $element = parent::formElement($items, $delta, $element, $form, $form_state);

    /* Adjust element here */ 

    return $element;
}

 public static function buildEntityFormActions($element) {

    $element = parent::buildEntityFormActions($element);

    /* Or here */

    return $element;
 }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.