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
delete all line match pattern
:g/pattern/d
delete all lines not match pattern
:g!/pattern/d
:v/pattern/d
VIM 中强大的 g 命令
copy all match lines to the end of file
:g/pattern/t$
move all match lines to the end of file
:g/pattern/m$
copy all lines matching pattern to register ‘a’
qaq:g/pattern/y A
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 教程,内容提要:
"老吾老,以及人之老;幼吾幼,以及人之幼。" 孟子倡导的"仁爱"精神,是中华文化的根本。2006年岁末,中国政府一"仁政"举措是 —— 明年将在全国范围内建立农村最低生活保障制度。这也是维护最广大人民群众利益的最直接的体现。
请看《中国日报》相关报道:For the first time the country's entire rural residents living in abject poverty can expect the State to cover their subsistence allowances, thanks to the government's latest move to narrow the disparities between cities and rural areas.
外汇储备作为一个国家金融实力的标志,是充实国库、稳定本国汇率的物质基础。但是,外汇储备增长过快、规模过高也会给经济带来很多不利影响。针对目前外汇储备充实国库的现状,央行提出了三项解决措施:不再"宽进严出"、变"藏汇于国"为"藏汇于民"、鼓励企业"走出去"。
请看《中国日报》的相关报道:China has noticed the negative impacts brought by its huge foreign exchange reserves, at more than US870ドル billion, and is taking steps to relieve the pressure. The State Administration of Foreign Exchange has started to free up the country's foreign exchange regime with a shift from stockpiling foreign exchange reserves in State coffers to letting businesses and individuals hold more foreign currency.