定制 liquidlight/typo3-call-to-actions 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

liquidlight/typo3-call-to-actions

Composer 安装命令:

composer require liquidlight/typo3-call-to-actions

包简介

Shared Call to Action repository and plugin, to allow display of your CTAs

README 文档

README

Note: This readme is very much in draft and needs to be written properly

The Call to Actions extension allows you to have shared Call to Action/Promo boxes which are then displayed throughout the site. It gives editors and integrators a single place to add, edit and update website Call to Actions (CTAs).

CTAs can be shared between multi-site instances and can be customised with different types and themes, along with having styled buttons and images

To Do

  • Create proper TYPO documentation
  • Make the plugin appear in the wizard in version 10
  • Add new icon

Installation

Install via the TYPO3 Extension Repository or composer:

composer req liquidlight/typo3-call-to-actions

Create a SysFolder (called "Call to Actions" or similar) and create a new "Call to Action" record inside

Hint: If you only want Call to Actions to be made in this SysFolder, edit the page and add the following to the Page TSconfig [TSconfig] field

mod.web_list.allowedNewTables = tx_calltoactions_domain_model_calltoactions

Once the Call to Action record is made, navigate to the page you wish to add it and create a new content element

Plugins -> Call to Actions

Using the Items browser, select the Call to Action you wish to display

Note: The whole page tree is displayed as Call to Action records can be created anywhere

Customisation

Templates

If you wish to override the Templates or Partials, add the following to your constants (replacing site_package with the name of your custom site package extension)

site.fluidtemplate.call_to_actions {
	templateRootPath = EXT:site_package/Resources/Private/Templates
	partialRootPath = EXT:site_package/Resources/Private/Partials
}

From create a files which are the same names as the originals

You may also wish to overwrite the Button, Image or Details partial too - which can be found in the Partials folder

Types & Themes

If you wish to change or add to the Theme and Types dropdowns, you can do this via Typoscript

Add the following to setup

tt_content.call_to_actions {
	classes {
		type {
			0 {
				title = Simple
				value = simple
			}
			1 {
				title = Featured
				value = featured
			}
		}

		theme {
			0 {
				title = Light
				value = light
			}
			1 {
				title = Dark
				value = dark
			}
		}
	}

The numbers are indexes - if you wish to replace one use the same index, however if you only want to add then you can include just that one with an incremental number

title is what is shown in the drop down, while value is what is output in the template.

e.g.

tt_content.call_to_actions {
	classes.type {
		2 {
			title = Highlight
			value = highlightCTA
		}
	}
}

Relating to records

Note: Experience in overriding TCAs is required for this

If you want to add Call to Actions on a specific record, such as News or any other custom record type, you will need to override the TCA.

In the example below, a field is added after the bodytext on the tt_news table

<?php

defined('TYPO3_MODE') or die();

call_user_func(function () {
	$columns = [
		'tx_sitepackage_call_to_actions' => [
			'label' => 'LLL:EXT:call_to_actions/Resources/Private/Language/locallang.xlf:call_to_actions',
			'config' => [
				'default' => '12',
				'type' => 'select',
				'renderType' => 'selectMultipleSideBySide',
				'foreign_table' => 'tx_calltoactions_domain_model_calltoactions',
				'foreign_table_where' => 'AND tx_calltoactions_domain_model_calltoactions.sys_language_uid IN (-1,0)
					ORDER BY tx_calltoactions_domain_model_calltoactions.title ASC',
				'minitems' => 0,
				'maxitems' => 100,
				'size' => 10,
			],
		],
	];
	\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_news', $columns);
	\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
		'tt_news',
		'tx_sitepackage_call_to_actions',
		'',
		'after:bodytext'
	);
});

Next, add the field to the ext_tables.sql file in your site_package

#
# Table structure for table 'tt_news'
#
CREATE TABLE tt_news (
	tx_sitepackage_call_to_actions text,
);

Update the database schema to add the new field.

To render the promos in your template will depend on how your record is rendered - an example snippet of PHP to do this is:

$cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);

/**
 * Promos
 */
// Get the default config
$ctas = $GLOBALS['TSFE']->tmpl->setup['tt_content.']['call_to_actions.'];
// Set the records to be our UIDs
$ctas['dataProcessing.']['100.']['uidInList'] = $record['promos'];
// Remove the field gathering
unset($ctas['dataProcessing.']['100.']['uidInList.']);
// Render the element
$record['promos'] = $cObj->cObjGetSingle('FLUIDTEMPLATE', $ctas);

liquidlight/typo3-call-to-actions 适用场景与选型建议

liquidlight/typo3-call-to-actions 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.3k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 11 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「TYPO3 CMS」 「CTAs」 「Promos」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 liquidlight/typo3-call-to-actions 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 liquidlight/typo3-call-to-actions 我们能提供哪些服务?
定制开发 / 二次开发

基于 liquidlight/typo3-call-to-actions 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2.3k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2021-11-17