ACP Modules issue

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Locked
Schofer
Registered User
Posts: 1
Joined: Sat Dec 07, 2024 1:41 pm

ACP Modules issue

Post by Schofer »

Hi. Im newbie. I generated extension template from Skeleton and then proceed to make some ACP modules that I need. I successfully made main_module and install it, but when I tried to make and install add_module (I created add_module, add_info and acp_add_template) it isnt shown in ACP menu. I have only one thing shown which is the main_module.

Here is the code of add module:

add_module.php

Code: Select all

<?php
/**
 *
 * Obywatel AI. An extension for the phpBB Forum Software package.
 *
 * @copyright (c) 2024, Sophie
 * @license GNU General Public License, version 2 (GPL-2.0)
 *
 */

namespace sophie\aiobywatel\acp;

/**
 * Obywatel AI ACP module.
 */
class add_module
{
	public $page_title;
	public $tpl_name;
	public $u_action;

	/**
	 * Main ACP module
	 *
	 * @param int    $id   The module ID
	 * @param string $mode The module mode (for example: manage or settings)
	 * @throws \Exception  ./
	 */
	public function main($id, $mode)
	{
		global $phpbb_container;

		/** @var \sophie\aiobywatel\controller\acp_controller $acp_controller */
		$acp_controller = $phpbb_container->get('sophie.aiobywatel.controller.acp');

		// Load a template from adm/style for our ACP page
		$this->tpl_name = 'acp_aiobywatel_info';

		// Set the page title for our ACP page
		$this->page_title = 'ACP_AIOBYWATEL_TITLE';

		// Make the $u_action url available in our ACP controller
		$acp_controller->set_page_url($this->u_action);

		// Load the display options handle in our ACP controller
		$acp_controller->display_options();

		$config = $phpbb_container->get('config');
		$request  = $phpbb_container->get('request');
	}
}

add_info.php

Code: Select all

<?php
/**
 *
 * Obywatel AI. An extension for the phpBB Forum Software package.
 *
 * @copyright (c) 2024, Sophie
 * @license GNU General Public License, version 2 (GPL-2.0)
 *
 */

namespace sophie\aiobywatel\acp;

/**
 * Obywatel AI ACP module info.
 */
class add_info
{
	public function module()
	{
		return [
			'filename'	=> '\sophie\aiobywatel\acp\add_module',
			'title'		=> 'ACP_AIOBYWATEL_TITLE',
			'modes'		=> [
				'settings'	=> [
					'title'	=> 'ACP_AIOBYWATEL_ADD',
					'auth'	=> 'ext_sophie/aiobywatel && acl_a_board',
					'cat'	=> ['ACP_AIOBYWATEL_TITLE'],
				],
			],
		];
	}
}

install_acp_module.php

Code: Select all

<?php
/**
 *
 * Obywatel AI. An extension for the phpBB Forum Software package.
 *
 * @copyright (c) 2024, Sophie
 * @license GNU General Public License, version 2 (GPL-2.0)
 *
 */

namespace sophie\aiobywatel\migrations;

class install_acp_module extends \phpbb\db\migration\migration
{
	public function effectively_installed()
	{
		return isset($this->config['sophie_aiobywatel_main']);
	}

	public static function depends_on()
	{
		return ['\phpbb\db\migration\data\v320\v320'];
	}

	public function update_data()
	{
		return [
			['config.add', ['sophie_aiobywatel_main', 0]],

			['module.add', [
				'acp',
				'ACP_CAT_DOT_MODS',
				'ACP_AIOBYWATEL_TITLE'
			]],
			['module.add', [
				'acp',
				'ACP_AIOBYWATEL_TITLE',
				[
					'module_basename'	=> '\sophie\aiobywatel\acp\main_module',
					'modes'				=> ['settings'],
				],
			]],
			['module.add', [
				'acp',
				'ACP_AIOBYWATEL_TITLE',
				[
					'module_basename' => '\sophie\aiobywatel\acp\add_module',
					'modes' => ['settings'],
				],
			]],
		];
	}
}

User avatar
SpIdErPiGgY
Registered User
Posts: 7
Joined: Sun May 02, 2021 2:24 pm

Re: ACP Modules issue

Post by SpIdErPiGgY »

phpBB NL Extension translations, also on request.
--> Click Here: phpbbextnl.be <--


Support my translations: https://paypal.me/myarea51secrets

Locked