_contextual_links_to_id example

'contextual' => [
          '',
          [],
          [
            'contextual-views-field-links' => UrlHelper::encodePath(Json::encode($links)),
          ],
        ],
      ];

      $element = [
        '#type' => 'contextual_links_placeholder',
        '#id' => _contextual_links_to_id($contextual_links),
      ];
      return \Drupal::service('renderer')->render($element);
    }
    else {
      return '';
    }
  }

  /** * {@inheritdoc} */
  

  public function testContextualLinksToId(array $links, string $id) {
    $this->assertSame($id_contextual_links_to_id($links));
  }

  /** * Tests the conversion from contextual ID to links. * * @param array $links * The #contextual_links property value array. * @param string $id * The serialized representation of the passed links. * * @covers ::_contextual_id_to_links * * @dataProvider contextualLinksDataProvider */
Home | Imprint | This part of the site doesn't use cookies.