Home
JetDrupal
  • Home
  • Drupal 开发
  • Web Dev
  • Speak in English
  • Contact
本作品采用知识共享署名 4.0 国际许可协议进行许可。
Powered by Drupal © 2022 Ng

Drupal 整站迁移

drush si
drush -y entity:delete shortcut_set
drush en module_name
drush then theme_name
drush cget system.site
drush ci

drupal
2022.03.06
1 min

VIM:power of g

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

vim
2022.01.05
1 min

(ZT) Lessons learned from 15 years of SumatraPDF

Lessons learned from 15 years of SumatraPDF, an open source Windows app.
Opensource
2021.08.12
1 min

Base theme for Drupal with starterkit - Glisseo

Glisseo

Features

  • Modern CSS, which includes CSS variables for styling and CSS grids for layouts!
  • Two starter themes:
    • SCSS: The SCSS based starter theme.
    • PostCSS: The PostCSS based starter theme. This one will give you full control over your styles and when they must be attached.
  • ITCSS architecture for style structure. If you're not familiar with ITCSS, it's recommended to watch this presentation by Harry Roberts (@csswizardry) to get inspired.
  • BEM methodology for template class naming. In variation of Harry Roberts (@csswizardry) as well.

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
2021.05.23
5 mins

开发了一个 drupal commerce 商城主题

开发了一个 drupal commerce 商城主题

drupal
commerce
2019.07.18
0 min

在 Block 中自定义 一个 Form

首先自定义一个 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'))));
  }
}

 

block
form
2019.07.12
2 mins

写了个中国省市区联动模块

地址:中国省市区联动模块

想法来自: http://tshi0912.github.io/city-picker/

主要目的为了练习自定义字段,其文件结构如下:

  • foo_bar_fields.info.yml
  • src/
    • Plugin/
      • Field/
        • FieldType/
          • FooItem.php
        • FieldFormatter/
          • FooBarFormatter.php
        • FieldWidget/
          • FooBarWidget.php

参考:https://www.drupal.org/project/chinese_address

 

drupal
module
2019.07.12
1 min

Two useful drupal 8 modules

1. TOC Formatter:可以显示内容大纲列表,并且在 H2 标签处增加 Move to Top 链接。

TOC Formatter

 

drupal
module
2019.06.28
1 min

understand drupal 8 service

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

drupal
service
2019.06.19
1 min

Introduction to Drupal 8 Theme Development

一个不错的 d8 主题开发入门 PDF 教程,内容提要:

  • Anatomy of theme file system
  • Creating your first theme
  • Twig templates, and where to find them
  • Twig syntax
  • Working with template suggestions
  • Modifying content with hook_preprocess()
  • Render arrays
  • Custom templates with hook_theme()
2019.06.13
1 min

“低保” 用英语怎么说

“老吾老,以及人之老;幼吾幼,以及人之幼。” 孟子倡导的“仁爱”精神,是中华文化的根本。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.

2019.05.13
1 min

“国库、小金库” 用英语怎么说

外汇储备作为一个国家金融实力的标志,是充实国库、稳定本国汇率的物质基础。但是,外汇储备增长过快、规模过高也会给经济带来很多不利影响。针对目前外汇储备充实国库的现状,央行提出了三项解决措施:不再“宽进严出”、变“藏汇于国”为“藏汇于民”、鼓励企业“走出去”。

请看《中国日报》的相关报道:China has noticed the negative impacts brought by its huge foreign exchange reserves, at more than US$870 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.

2019.05.13
1 min

Pagination

  • Current page 1
  • Page 2
  • Next page
  • Last page Last