สอบถามปุ่มเลือกเอกสารกดแล้วมันไม่ขึ้น modal ในหน้าเพิ่มเมนู joomla 5 ครับ

ถามตอบ ปัญหาการพัฒนา Extension ไม่ว่าจะเป็น Module plugin Component หรือ แม้แต่ template การปรับแต่งโค้ด Joomla ต่างๆ ทุกเวอร์ชั่น 1.5 2.5 หรือ 3.x

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
Thanapoom1514
PHP VIP Members
PHP VIP Members
โพสต์: 4329
ลงทะเบียนเมื่อ: 04/07/2022 9:46 am

สอบถามปุ่มเลือกเอกสารกดแล้วมันไม่ขึ้น modal ในหน้าเพิ่มเมนู joomla 5 ครับ

โพสต์ที่ยังไม่ได้อ่าน โดย Thanapoom1514 »

ในหน้าเมนูจะมีปุ่มเลือกเอกสาร ซึ่งถ้ากดปุ่มเลือกจะมี modal ขึ้นมาแสดงแต่ใน joomla 5 มันเข้าไปลิงก์นั้นเลยครับ แต่ของ joomla 3 มันขึ้น modal ให้ครับ
ปุ่มเลือกอยู่ในคลาส JFormFieldModal_Document ครับ

โค้ด: เลือกทั้งหมด

class JFormFieldModal_Document extends Joomla\CMS\Form\FormField
{
		$link	= 'index.php?option=com_mdfiles&c=documents&layout=modal&modal=1&tmpl=component&function=jSelectDocument_'.$this->id;

		$html[] = '<span class="input-append">';
		$html[] = '<input type="text" class="input-medium" id="'.$this->id.'_name" value="'.$title.'" disabled="disabled" size="35" />';
		$html[] = '<a class="modals btn hasTooltip" title="'.HTMLHelper::tooltipText('COM_MDFILES_DOCUMENT_CHANGE_DOCUMENT').'"  href="'.$link.'&amp;'.Session::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}"><i class="icon-file"></i> '.Text::_('JSELECT').'</a>';
		return implode("\n", $html);
}
ใน joomla 3
กดเลือกเอกสาร
Joomla Development-1.png
Joomla Development-1.png (9.13 KiB) Viewed 4527 times
จะมี popup ขึ้นมาแสดงครับ
Joomla Development-2.png
Joomla Development-2.png (57.63 KiB) Viewed 4527 times

แต่ใน joomla 5
Joomla Development-3.png
Joomla Development-3.png (32.71 KiB) Viewed 4527 times
กดเลือกเอกสารมันไปลิงก์นั้นเลยครับ ไม่ขึ้น modal ให้ครับ
Joomla Development-4.png
Joomla Development-4.png (14.34 KiB) Viewed 4527 times
ส่วนนี้ปรับยังไงให้ขึ้น modal หรอครับ
:gfb:
ภาพประจำตัวสมาชิก
tsukasaz
PHP VIP Members
PHP VIP Members
โพสต์: 24163
ลงทะเบียนเมื่อ: 18/04/2012 9:39 am

Re: สอบถามปุ่มเลือกเอกสารกดแล้วมันไม่ขึ้น modal ในหน้าเพิ่มเมนู joomla 5 ครับ

โพสต์ที่ยังไม่ได้อ่าน โดย tsukasaz »

ใน J3 กับ J5 น่าจะใช้คนละรูปแบบกันครับ ลองดูตัวอย่างไฟล์ใน com_content ฝั่ง admin จะอยู่ในโฟลเดอร์ Field แล้วก็ Modal ครับ
The last bug isn't fixed until the last user is dead. (Sidney Markowitz, 1995)
ภาพประจำตัวสมาชิก
Thanapoom1514
PHP VIP Members
PHP VIP Members
โพสต์: 4329
ลงทะเบียนเมื่อ: 04/07/2022 9:46 am

Re: สอบถามปุ่มเลือกเอกสารกดแล้วมันไม่ขึ้น modal ในหน้าเพิ่มเมนู joomla 5 ครับ

โพสต์ที่ยังไม่ได้อ่าน โดย Thanapoom1514 »

ขึ้น modal โชว์แล้วครับ
Joomla Development-1.png
Joomla Development-1.png (22.36 KiB) Viewed 4428 times

โค้ด: เลือกทั้งหมด

			$modalId = 'document_' . $this->id;
			$html[] = '<input class="form-control" id="' . $this->id . '_name" type="text" value="' . $title . '" readonly size="35">';
			$html[] = '<button'
			. ' class="btn btn-primary"'
			. ' id="'.$this->id.'_name"'
			. ' data-bs-toggle="modal"'
			. ' type="button"'
			. ' data-bs-target="#ModalSelect' . $modalId . '">'
			. '<span class="icon-file" aria-hidden="true"></span> ' . Text::_('JSELECT')
			. '</button>';
	
			$html[] = HTMLHelper::_(
				'bootstrap.renderModal',
				'ModalSelect' . $modalId,
				[
					'title'      => HTMLHelper::tooltipText('COM_MDFILES_DOCUMENT_CHANGE_DOCUMENT'),
					'url'        => $link.'&amp;'.Session::getFormToken().'=1',
					'height'     => '400px',
					'width'      => '800px',
					'bodyHeight' => 70,
					'modalWidth' => 80,
					'footer'     => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">'
										. Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>',
				]
			);
:gfb:
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 6