Commit e8fe2a35 authored by Matthew Radcliffe's avatar Matthew Radcliffe
Browse files

Issue #3293175 by mradcliffe: Passed by Reference Errors

parent ad3ade47
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ name: Freelinking
type: module
description: A filter that provides flexible, extensible, wiki-style linking of content.
package: Input filters
core_version_requirement: ^8.8 || ^9
core_version_requirement: ^9
dependencies:
  - drupal:filter
configure: filter.admin_overview
+1 −2
Original line number Diff line number Diff line
@@ -2,8 +2,7 @@ type: module
name: Freelinking Prepopulate
description: Provides plugins for Freelinking to prepopulate node create.
package: Input filters
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^9
dependencies:
  - freelinking:freelinking
  - prepopulate:prepopulate
+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ class FreelinkingPrepopulate extends FreelinkingPluginBase implements ContainerF

    $node_types = $this->entityTypeManager->getStorage('node_type')->loadMultiple();

    $options = array_reduce($node_types, function (&$result, $node_type) {
    $options = array_reduce($node_types, function ($result, $node_type) {
      /** @var \Drupal\node\Entity\NodeType $node_type */
      $result[$node_type->id()] = $node_type->label();
      return $result;
+13 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\freelinking\Functional\FreelinkingBrowserTestBase;
use Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait;
use Drupal\user\Entity\Role;

/**
 * Tests embedded prepopulate links.
@@ -39,6 +40,15 @@ class FreelinkingPrepopulateTest extends FreelinkingBrowserTestBase {

    // Creates a content type to act as default prepopulate content type.
    $this->createContentType(['name' => 'Person', 'type' => 'person']);
    $this->createContentType(['name' => 'Restricted', 'type' => 'restricted']);

    $role_ids = $this->privilegedUser->getRoles(TRUE);
    $rid = reset($role_ids);
    $role = Role::load($rid);
    $this->grantPermissions($role, [
      'create person content',
      'edit own person content',
    ]);

    $vocabulary = $this->createVocabulary();

@@ -119,6 +129,7 @@ class FreelinkingPrepopulateTest extends FreelinkingBrowserTestBase {
        <li>Default with body: [[create:Alex|Alex|Add Alex|body="A page about Alex."]]</li>
        <li>Basic page: [[create:History of Programming|History of Programming|Create New Page|type=page]]</li>
        <li>With fields: [[create:Sam|Sam|Add Sam|body="A page about Sam."|field_basic="test"|field_tags="tag1,tag2,tag3"]]</li>
        <li>Restricted: [[create:Secret|Secret|Create New Restricted|type=restricted]]</li>
      </ul>
EOF;
    $this->drupalPostForm('node/add/page', $edit, t('Save'));
@@ -146,6 +157,8 @@ EOF;
      ->linkByHrefExists($pageLinkHref);
    $this->assertSession()
      ->linkByHrefExists($fieldsLinkHref);
    $this->assertSession()
      ->pageTextContainsOnce('Freelinking: Access denied to create missing content.');

    // Logout and visit the page.
    $this->drupalLogout();
+2 −2
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@ EOF;
   *   The plugin information.
   */
  public static function extractPluginSettings($plugin_name, array $plugins) {
    return array_reduce($plugins, function (&$result, $info) use ($plugin_name) {
    return array_reduce($plugins, function ($result, $info) use ($plugin_name) {
      if ($info['plugin'] === $plugin_name) {
        $result = $info;
      }
@@ -336,7 +336,7 @@ EOF;
   *   An indexed array of allowed plugin information.
   */
  protected function extractAllowedPlugins(array $plugins) {
    return array_reduce($plugins, function (&$result, $info) {
    return array_reduce($plugins, function ($result, $info) {
      if ($info['enabled']) {
        $result[$info['plugin']] = $info;
      }
Loading