Loading freelinking.info.yml +1 −1 Original line number Diff line number Diff line Loading @@ -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 modules/freelinking_prepopulate/freelinking_prepopulate.info.yml +1 −2 Original line number Diff line number Diff line Loading @@ -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 modules/freelinking_prepopulate/src/Plugin/freelinking/FreelinkingPrepopulate.php +1 −1 Original line number Diff line number Diff line Loading @@ -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; Loading modules/freelinking_prepopulate/tests/src/Functional/FreelinkingPrepopulateTest.php +13 −0 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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(); Loading Loading @@ -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')); Loading Loading @@ -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(); Loading src/Plugin/Filter/Freelinking.php +2 −2 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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 Loading
freelinking.info.yml +1 −1 Original line number Diff line number Diff line Loading @@ -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
modules/freelinking_prepopulate/freelinking_prepopulate.info.yml +1 −2 Original line number Diff line number Diff line Loading @@ -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
modules/freelinking_prepopulate/src/Plugin/freelinking/FreelinkingPrepopulate.php +1 −1 Original line number Diff line number Diff line Loading @@ -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; Loading
modules/freelinking_prepopulate/tests/src/Functional/FreelinkingPrepopulateTest.php +13 −0 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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(); Loading Loading @@ -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')); Loading Loading @@ -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(); Loading
src/Plugin/Filter/Freelinking.php +2 −2 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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