Skip to content

Instantly share code, notes, and snippets.

@PechenkiUA
Created November 6, 2023 10:40
Show Gist options
  • Save PechenkiUA/30a2da5d0cf285e468d1450644a5512e to your computer and use it in GitHub Desktop.
Save PechenkiUA/30a2da5d0cf285e468d1450644a5512e to your computer and use it in GitHub Desktop.
coder_blog_setting_ml
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>coder_blog_setting_ml</name>
<version>0.1</version>
<author>Oleksandr</author>
<link>https://example.com</link>
<code>coder_blog_setting_ml</code>
<description>coder_blog_setting_ml description</description>
<file path="admin/controller/blog/setting.php">
<operation>
<search><![CDATA[$data['breadcrumbs'] = array();]]></search>
<add><![CDATA[
$data['languages'] = $this->model_localisation_language->getLanguages();
]]></add>
</operation>
</file>
<file path="admin/view/template/blog/setting.twig">
<operation>
<search><![CDATA[<div class="tab-pane active" id="tab-general">]]></search>
<add position="after"><![CDATA[
<ul class="nav nav-tabs" id="language">
{% set idx = 0 %}
{% for language in languages %}
<li {% if idx == 0 %} class="active" {% endif %}><a href="#language{{ language.language_id }}" data-toggle="tab"><img src="language/{{ language.code }}/{{ language.code }}.png" title="{{ language.name }}" /> {{ language.name }}</a></li>
{% set idx = idx+1 %}
{% endfor %}
</ul>
<div class="tab-content">
{% set idx = 0 %}
{% for language in languages %}
<div class="tab-pane {% if idx == 0 %} active {% endif %}" id="language{{ language.language_id }}">
{% set idx = idx+1 %}
]]></add>
</operation>
<operation>
<search><![CDATA[<div class="tab-pane" id="tab-option">]]></search>
<add offset="2" position="before"><![CDATA[
</div>
</div>
{% endfor %}
]]>
</add>
</operation>
<operation>
<search regex="true"><![CDATA[
~name="(configblog_meta_title|configblog_html_h1|configblog_meta_description|configblog_name|configblog_meta_keyword)"~
]]></search>
<add><![CDATA[
name="$1[{{ language.language_id }}]"
]]></add>
</operation>
<operation>
<search regex="true"><![CDATA[
~{{.?(configblog_name|configblog_html_h1|configblog_meta_title|configblog_meta_description|configblog_meta_keyword).+?}}~
]]></search>
<add><![CDATA[
{{ $1[language.language_id] }}
]]></add>
</operation>
</file>
<file path="catalog/controller/blog/*.php">
<operation>
<search><![CDATA[
public function index() {
]]></search>
<add position="before">
<![CDATA[
private function mlBlogConfig($setting){
$config = $this->config->get($setting);
$lang_id = (int)$this->config->get('config_language_id');
if (is_array($config) && isset($config[$lang_id])){
return $config[$lang_id];
}
return $config;
}
]]>
</add>
</operation>
<operation>
<search regex="true"><![CDATA[
~\$this->config->get\(\'(configblog_name|configblog_html_h1|configblog_meta_title|configblog_meta_description|configblog_meta_keyword)\'\)~
]]></search>
<add><![CDATA[ \$this->mlBlogConfig('$1') ]]></add>
</operation>
</file>
</modification>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment