Magento2 display header compare link after custom block in header

Magento2 move header compare link after custom block in the header

I have added custom block in header as follows

<referenceContainer name="header.topcontent">
            <block class="MagentoCmsBlockBlock" name="Blockname" after="-">
                    <argument name="home_page_top_content_block" xsi:type="string">home_page_top_content_block</argument>

I need to display this block after my custom block

Adding a type something like block on a page

I want to add a "type something" block on the front page with submit button which adds that particular content. I am getting a /node/add/article link but I do not want a link or button. I want the text area like a block on the page itself. Please help me with it.

postgresql – Error CREATE DATABASE cannot run inside a transaction block

I am trying to create a database from a Java application running in Micronaut framework using jOOQ.

The code


with a PostgreSQL datasource fails with:

org.jooq.exception.DataAccessException: SQL (do $$ begin create database “mydb”; exception when sqlstate ’42P07′ then null; end $$); ERROR: CREATE DATABASE cannot run inside a transaction block

Is there a simple way to turn transactions off within jOOQ just for this statement?

views – Template suggestion does not work for table in a custom block / Might there be a way around?

I created a block on pages of the “Author” content type that lists all the articles the author has contributed to in a table (via contextual filter). Now I want to customize the table layout. I already did this before in a similar case, where I show the table on a page, not in a block. There I get file name suggestions for the template inside HTML comments like that:

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_table__articles' -->
   x views-view-table--articles.html.twig
   x views-view-table--articles.html.twig
   * views-view-table.html.twig
<!-- BEGIN OUTPUT from 'themes/MYTHEMEFOLDER/templates/views/views-view-table--articles.html.twig' -->

But in my latest case, the table in a block, I only get this suggestion:

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_table' -->
<!-- BEGIN OUTPUT from 'themes/MYPARENTTHEMEFOLDER/templates/views/views-view-table.html.twig' -->

Note that it outputs the template of my parent theme, not my actual theme.

I did some research and found this issue, which currently is not resolved and the proposed patch not included inside the Drupal code. Is this the reason I cannot create a custom template or is there something else I can do?

If not, how would I create that table of referenced articles on the author’s page?

CMS and Block content warning Magento 2.4.2

Does anyone have any information or details on the following warning that I am seeing in the 2.4.2 CMS and Block content areas on save?

Temporarily allowed to save HTML value that contains restricted
elements. Allowed HTML tags are: div, a, p, span, em, strong, ul, li,
ol, h5, h4, h3, h2, h1, table, tbody, tr, td, th, tfoot, img, hr,
figure, button, i, u, br, b

It appears to be produced by saving content with html that contains things like data toggles, iFrame embeds, etc. I’ve got WYSIWYG turned-off globally, but the warning still gets produced.

I believe it has showed-up after my Magento 2.4.1 – 2.4.2 upgrade, but can’t seem to find any information online in regards to the warning, so I’m wondering if anyone has any info here.

A few questions, in-hopes that someone can answer or link to an official doc:

Are data-toggles, iframes and such going to be eliminated in a future release of Magento?

How soon do we have? Next version? Magento 2.5?

Will we be able to whitelist some/all of these items for use in admin content areas?

Thanks for any insight or help.

performance – Copy a block of data into existing cells, adding a new line

Wondering about efficiency here – I have a bit of code that does what I want; but it is terribly slow. I structured the code in a way that made sense to me logically, but I’m wondering if someone else could take a look at the code and find a shortcut or two that might make it faster. I’m guessing that I am referencing the Worksheet too often in one of the loops, but haven’t been able to find a good way to restructure to improve performance.

Option Explicit

Sub addAlternateRevCodeLogic()
Dim WS As Worksheet
Dim rng As Range
Dim lastColumn As Long
Dim row As Long
Dim i As Long

Dim ReferenceStyle As XlReferenceStyle

'Arrays of the different Alt Rev Code fields on an EAP
Dim AltID() As String
Dim EffFrom() As String
Dim EffTo() As String
Dim ProvType() As String
Dim BCC() As String
Dim DEP() As String
Dim EAF() As String
Dim Class() As String
Dim RevCode() As String

'Alt Rev Code data from the matching rows
Dim rowAltID As String
Dim rowEffFrom As String
Dim rowEffTo As String
Dim rowProvType As String
Dim rowBCC As String
Dim rowDEP As String
Dim rowEAF As String
Dim rowClass As String
Dim rowRevCode As String

'New and old cost centers
Dim newBCC() As String
Dim oldBCC As String
Dim CostCenter As Variant
Dim userInput As String

'Columns for Rev Code Ranges
Dim AltIDcol As Long 'I EAP 2431
Dim EffFromcol As Long 'I EAP 2434
Dim EffTocol As Long 'I EAP 2435
Dim ProvTypecol As Long 'I EAP 2439
Dim BCCcol As Long 'I EAP 2438
Dim DEPcol As Long 'I EAP 2437
Dim EAFcol As Long 'I EAP 2436
Dim Classcol As Long 'I EAP 2432
Dim RevCodecol As Long 'I EAP 2433

Application.ScreenUpdating = False
ReferenceStyle = Application.ReferenceStyle
If ReferenceStyle = xlR1C1 Then Application.ReferenceStyle = xlA1 'There are certain assumptions in the ranges that don't play nicely with R1C1

'Data is Chr(10) delimited
'Define the range of the EAP Export
Set WS = Worksheets("export")
lastColumn = eap.Cells.Find("*", After:=eap.Cells(1), LookIn:=xlValues, LookAt:=xlWhole, SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
Set rng = WS.Range("A1", WS.Columns(1).Find(what:="#LAST_ROW", LookIn:=xlComments, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Offset(0, lastColumn))

'Define all of the column IDs
AltIDcol = FindCol(2431, eap, True, 1, 1, 1, lastColumn)
EffFromcol = FindCol(2434, eap, True, 1, 1, 1, lastColumn)
EffTocol = FindCol(2435, eap, True, 1, 1, 1, lastColumn)
ProvTypecol = FindCol(2439, eap, True, 1, 1, 1, lastColumn)
BCCcol = FindCol(2438, eap, True, 1, 1, 1, lastColumn)
DEPcol = FindCol(2437, eap, True, 1, 1, 1, lastColumn)
EAFcol = FindCol(2436, eap, True, 1, 1, 1, lastColumn)
Classcol = FindCol(2432, eap, True, 1, 1, 1, lastColumn)
RevCodecol = FindCol(2433, eap, True, 1, 1, 1, lastColumn)

oldBCC = InputBox("What cost center do you want to copy?" & vbNewLine & "Select only one, and don't make typos")
If oldBCC = "" Then MsgBox "Must choose a cost center!", vbOKOnly + vbCritical: Exit Sub

    userInput = InputBox("What are the new cost centers that need added?" & vbNewLine & "You can enter multiple, just keep adding them and then leave the box blank after the last one" & vbNewLine & "Don't make typos", "New Cost Centers")
    Select Case True
        Case CostCenter = "" And userInput <> "" 'Handle the 1st cost center
            CostCenter = userInput
        Case CostCenter <> "" And userInput <> "" 'Handle each new input
            CostCenter = CostCenter & "," & userInput
        Case CostCenter = "" And userInput = "" 'Handle no input
            MsgBox "Must choose at least one new cost center!", vbOKOnly + vbCritical: Exit Sub
    End Select
Loop While userInput <> ""

'oldBCC = "10005320" 'Test Emergency Cost Center
'oldBCC = "10004320" 'Test Pediatrics Cost Center
'CostCenter = "70005320" 'Test New Emergency Cost Center
'CostCenter = "70004110,70004130,70004140,70004200,70004420,70004510,70004400,70004430,70004500" 'Test New Pediatrics Cost Centers
newBCC() = Split(CostCenter, ",")

With rng
    For row = LBound(.Value2) To UBound(.Value2) 'Loop through each row from the export
    If Not IsEmpty(.Value2(row, RevCodecol)) Then 'Find any row that contains an alternate revenue code
        If InStr(1, .Value2(row, BCCcol), oldBCC) Then 'Check if the TRH Emergency Cost Center is using one of the alternate revenue codes
            'Build an array for each Alt Rev Code data item
            RevCode() = Split(.Value2(row, RevCodecol), Chr(10))
            AltID() = Split(.Value2(row, AltIDcol), Chr(10))
            EffFrom() = Split(.Value2(row, EffFromcol), Chr(10))
            EffTo() = Split(.Value2(row, EffTocol), Chr(10))
            ProvType() = Split(.Value2(row, ProvTypecol), Chr(10))
            BCC() = Split(.Value2(row, BCCcol), Chr(10))
            DEP() = Split(.Value2(row, DEPcol), Chr(10))
            EAF() = Split(.Value2(row, EAFcol), Chr(10))
            Class() = Split(.Value2(row, Classcol), Chr(10))
            For i = LBound(RevCode()) To UBound(RevCode())
                If InStr(1, BCC(i), oldBCC) Then 'Set row data for a line with the cost center to copy
                    rowAltID = AltID(i)
                    rowEffFrom = EffFrom(i)
                    rowEffTo = EffTo(i)
                    rowProvType = ProvType(i)
                    rowBCC = BCC(i)
                    rowDEP = DEP(i)
                    rowEAF = EAF(i)
                    rowClass = Class(i)
                    rowRevCode = RevCode(i)
                    'Copy the existing value and add the new line(s)
                    For Each CostCenter In newBCC 'Copy existing lines and add a new entry for each new cost center
                        .Cells(row, AltIDcol).Value = .Value2(row, AltIDcol) & Chr(10) & rowAltID ' & Chr(10)
                        .Cells(row, EffFromcol).Value = .Value2(row, EffFromcol) & Chr(10) & rowEffFrom ' & Chr(10)
                        .Cells(row, EffTocol).Value = .Value2(row, EffTocol) & Chr(10) & rowEffTo ' & Chr(10)
                        .Cells(row, ProvTypecol).Value = .Value2(row, ProvTypecol) & Chr(10) & rowProvType ' & Chr(10)
                        .Cells(row, BCCcol).Value = .Value2(row, BCCcol) & Chr(10) & CostCenter ' & Chr(10)
                        .Cells(row, DEPcol).Value = .Value2(row, DEPcol) & Chr(10) & rowDEP ' & Chr(10)
                        .Cells(row, EAFcol).Value = .Value2(row, EAFcol) & Chr(10) & rowEAF ' & Chr(10)
                        .Cells(row, Classcol).Value = .Value2(row, Classcol) & Chr(10) & rowClass ' & Chr(10)
                        .Cells(row, RevCodecol).Value = .Value2(row, RevCodecol) & Chr(10) & rowRevCode ' & Chr(10)
                    Next CostCenter
                End If
            Next i
        End If
    End If
    Next row
End With
If ReferenceStyle = xlR1C1 Then Application.ReferenceStyle = xlR1C1
Application.ScreenUpdating = True
MsgBox "Rev Codes updated. Test the import.", vbInformation + vbOKOnly
End Sub

magento2.4.1 – How to solve Element ‘block’, attribute ‘destination’: The attribute ‘destination’ is not allowed

My homepage getting the following error,

1 exception(s):
Exception #0 (MagentoFrameworkConfigDomValidationException): Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 953

Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 988

Exception #0 (MagentoFrameworkConfigDomValidationException): Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 953

Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 988

<pre>#1 MagentoFrameworkConfigDom->__construct('<layout xmlns:xs...', &MagentoFrameworkAppArgumentsValidationState#0000000058d80d55000000006a5c4095#, array(), NULL, 'C:/xampp/htdocs/...', '%message%nLine: ...') called at (vendormagentoframeworkObjectManagerFactoryAbstractFactory.php:121)
#2 MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject('MagentoFramewor...', array('<layout xmlns:xs...', &MagentoFrameworkAppArgumentsValidationState#0000000058d80d55000000006a5c4095#, array(), NULL, 'C:/xampp/htdocs/...', '%message%nLine: ...')) called at (vendormagentoframeworkObjectManagerFactoryDynamicDeveloper.php:66)

How to solve this error?

Log error:

(2021-03-01 04:07:53) report.INFO: Cache file with merged layout: LAYOUT_frontend_STORE1_5161502e12d09aab87e298d5a11fd6c6e_page_layout_merged and handles default, cms_index_index, cms_page_view, cms_index_index_id_home, am_mega_menu_layout: Please correct the XML data and try again. Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 953

Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 988
 () ()
(2021-03-01 04:07:53) report.ERROR: Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 953

Element 'block', attribute 'destination': The attribute 'destination' is not allowed.
Line: 988
 () ()

Disable title block on edit screen for a custom post type

I have a custom post type with a custom block to collect required data and store it in post meta data or standard fields like title or slug, so I don’t want to display the Title block. I can’t disable title support in the CPT, because too much else depends on it.

The only successful attempt so far has been using CSS to target the id “post-title-0” of the for the title and can clearly enqueue a small CSS file depending on the post type, but I don’t want to depend on something set by WordPress that I can’t control; it feels that something in Javascript would be a better way to go if possible. I was wondering if WP provde any hooks for this but haven’t found any.

I’m a javascript novice, having started learning it in the last few weeks in order to write some custom blocks, so am not clear on the extent of what can be acheived with it. (I have 50 years experience of programming, just not in JS).

It would be OK to only hide the title until the post has been saved.

I did see one relevant post on here but it was for the Gutenberg plug-in and I didn’t know if I could adapt it for current versions.

Has anyone any ideas?

6.0 marshmallow – How to block any app from being installed apart from one app?

I want to restrict the phone to install (Android 6) any app including all existing network apps (chrom, facebook etc) apart from one specific application.

I am thinking of editing the operating system, but I do not know which files to edit?

I would be happy to help.

On save CMS page or CMS block gives 404 on admin side if content has image src

Facing strange issue while saving CMS page or CMS block on admin side.

If Content of the page or block having image tag then on save it gives 404 error: Page not found.

<img src="{{media url=&quot;Chrysanthemum.jpg&quot;}}" alt="" />

Checked following points

  • Running Magento 2.3.6 with PHP 7.3

  • Disabled WYSIWYG editor completely from system configuration

  • Tried this option – Use Static URLs for Media Content in WYSIWYG

  • Checked pub folder permission with 775 and 777

  • pub folder having .htaccess by default

  • Web server rewrites is enabled on server level

  • Ran those upgrade/di:compile/s:s:d -f command multiple times

  • Also using the adminer i tried to update the direct db entry then also facing the same issue.

Any known issue which may be related to MySQL or some other?