Drupal 整站迁移
drush si
drush -y entity:delete shortcut_set
drush en module_name
drush then theme_name
drush cget system.site
drush ci
drush si
drush -y entity:delete shortcut_set
drush en module_name
drush then theme_name
drush cget system.site
drush ci
Glisseo
The theme provides only a basic styles for HTML elements (and some Drupal specific ones), a small set of tools and a pre-organized structure. This means that you need to design the site and connect all the necessary libraries and extensions by yourself. It's a price for the flexibility and freedom that a theme gives you. It's a canvas with some important brushes.
开发了一个 drupal commerce 商城主题
首先自定义一个 Form:
/**
* @file
* Contains \Drupal\resume\Form\WorkForm.
*/
namespace Drupal\resume\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
class workForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'resume_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['employee_name'] = array(
'#type' => 'textfield',
'#title' => t('Employee Name:'),
'#required' => TRUE,
);
$form['employee_mail'] = array(
'#type' => 'email',
'#title' => t('Email ID:'),
'#required' => TRUE,
);
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Register'),
'#button_type' => 'primary',
);
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
drupal_set_message($this->t('@emp_name ,Your application is being submitted!',
array('@emp_name' => $form_state->getValue('employee_name'))));
}
}
地址:中国省市区联动模块
想法来自: http://tshi0912.github.io/city-picker/
主要目的为了练习自定义字段,其文件结构如下:
1. TOC Formatter:可以显示内容大纲列表,并且在 H2 标签处增加 Move to Top 链接。
TOC Formatter
Service: A class instance that is easily accessible and reusable by the system.
可以理解为全局静态变量,随时拿过来用。(仅做理解)
d8 中常见的一种使用情形:
\Drupal::service(‘service.name’);
一个简单实例:
my_module\my_module.services.yml
services: my.custom.service: class: \Drupal\my_module\MyService
一个不错的 d8 主题开发入门 PDF 教程,内容提要:
法国人曾这么描述"福利彩票":政府发行彩票是向公众推销机会和希望,公众认购彩票则是微笑纳税。据悉,去年中国福利彩票共销售约495亿多元人民币,筹集福彩公益金170多亿元。其中,公益金除部分上缴国家财政外,全部用于社会福利事业。
请看《中国日报》相关报道:The sale of China Welfare Lottery, the only national lottery approved by the Chinese government, hit a record high of 49.5 billion yuan (6.2 billion U.S. dollars) in 2006, up 20 percent from the previous year Half of the money has been turned over to the coffer of the central government. The remaining funds were used for social welfare purposes.
drupal 商城安装:
composer create-project drupalcommerce/project-base demo --stability dev