D8 NOTES 2018-10-17

bootstrapDropdown.php
line 110 bug

http://www.ajax-cross-origin.com/
据说也许可以突破ajax同源限制

\Drupal::service('config.installer')->installDefaultConfig('module', $module);
不要前缀\也可以运行drush ev
能够重新导入yml配置文件,

alu_features_views_src_course_landing

drush updatedb --entity-updates
[
drush ev "drupal_set_installed_schema_version('fillpdf', 8012)"
Note: In Drupal 7 you need to add extra include 'includes/install.inc';.
drush ev "\Drupal::keyValue('system.schema')->set('fillpdf', (int) 8102)";
]
  - 'core/drupal.ajax'
  - 'core/drupal'
  - 'core/drupalSettings'
  - 'core/jquery.once'
    

    https://www.drupal.org/docs/8/api/routing-system/structure-of-routes
    
    
cnproxy.cn.alcatel-lucent.com
135.245.48.34  8000  -->google
(ie)http://cnproxy.cn.alcatel-lucent.com/proxy.pac
console.log(jQuery(window).width());

drush upwd "user name" --password=new-password

https://www.drupal.org/node/2192175/revisions/7382931/view

调用一个方法比写一个方法要好,
因为写的一个方法可以被别人和以后调用

调用方法比直接调用属性要好
因为方法还可以被升级
而调用属性就没有回旋的空间了




drupal 8 notes
drush pmu MODULENAME
drush cr

.install hook_update_N($sandbox)

\Drupal::service('module_installer')->uninstall(['field_ui']);

$node = \Drupal::routeMatch()->getParameter('node');
if ($node instanceof \Drupal\node\NodeInterface) {
  // You can get nid and anything else you need from the node object.
  $nid = $node->id();
}

config的读取
example.settings.yml就在
$config = \Drupal::config('example.settings');
print $config->get('message');
print $config->get('langcode');

config的保存更新
$config = \Drupal::service('config.factory')->getEditable('example.settings');
$config->set('message', 'Hi')->save();
print $config->get('message');

function template_preprocess_html(){
}

$brandIds = \Drupal::entityQuery('node')
    ->condition('type', 'brand')
    ->sort('title', 'asc')
    ->execute();
    
In your terminal, go inside your Development site and write the command drush config-export. This exports the configuration to your sync directory. The current contents of your export directory (called "sync" by default) will be deleted.
Use a tool (rsync, Git, FTP, SCP) to copy the content of the Development sync folder to the Live site's sync folder.
Using a terminal, go inside your Live site and write the command drush config-import
Drush will display the available configuration changes and prompt you with "Import the listed configuration changes? (y/n): ". Type "y" to confirm.


Example:
$current_url = Url::fromRoute('<current>');
$path = $current_url->toString();
//OR of you want to get the url without language prefix
$path = $current_url->getInternalPath();
$path_args = explode('/', $path);

Method 2: (Get first argument from url on Drupal 8)
$request = \Drupal::request();
$current_path = $request->getPathInfo();
$path_args = explode('/', $current_path);
$first_argument = $path_args[1];

An existing way in Drupal 8 to get a route from a path name:
$the_path = 'pathname_to_find_route_for';
$url_object = \Drupal::service('path.validator')->getUrlIfValid($the_path);
$route = $url_object->getRouteName();

$params = \Drupal\Core\Url::fromUserInput($path)->getRouteParameters();
if (isset($params['node'])) {
  $node = \Drupal\node\Entity\Node::load($params['node']);
}

$entity->get('field_name')->getValue();

get image in drupal8
https://drupal.stackexchange.com/questions/137319/getting-the-image-url-from-a-field-image-on-a-node

twig
field_image.entity.url

styled image
use Drupal\image\Entity\ImageStyle
$styled_image_url = ImageStyle::load('large')->buildUrl($node->field_image->entity->getFileUri());


The node object is loaded by the function load() of Node class of core Drupal system. The object of the node will hold the pieces of information like Content type, created timestamp, author and revision values. Similarly we able to access node field values. The below is the example accessing the Node properties field values of the node.

Syntax:

use Drupal\node\Entity\Node;
$node = Node::load(NID);
print_r($node);

Node Properties:

$id = $node->id();
$title = $node->title->value;
$vid = $node->vid->value;

Node field values

$field1 = $node->get('FIELD_1')->getValue());
$field2 = $node->get('FIELD_2')->getValue());

Examples:

Get Node object:

use Drupal\node\Entity\Node;
$node = Node::load(NID);
print_r($node); // Node Object.

Node Content Type:

use Drupal\node\Entity\Node;
$node = Node::load(NID);
print $node->bundle(); // Content type of Node.

Node NID:

use Drupal\node\Entity\Node;
$node = Node::load(NID);
print $node->id(); // Node Id.

Node Properties(Revision Id, Title, Author Id, Timestamp, etc..):

use Drupal\node\Entity\Node;
$node = Node::load(NID);
print $node->vid->value; // Revison Id.
print $node->title->value; // Node Id.
print $node->uid->value; // Author Id.
print $node->created->value; // Created Timestamp.

Node Field values:

use Drupal\node\Entity\Node;
$node = Node::load(NID);
$tags = $node->get('field_tag')->getValue());
print $tags;

cuddly-slider:
  version: 1.x
  css:
    theme:
      css/cuddly-slider.css: {}
  js:
    js/cuddly-slider.js: {}
  dependencies:
    - core/jquery
        
        
        
sass scss/style.scss css/style.css

    content: "›";
    display: inline-block;
    margin-left: 0.5rem;
    transform: rotate(-90deg);

use Drupal\menu_link_content\Entity\MenuLinkContent;
$items = array(
  '1' => 'Menuitem 1',
  '2' => 'Menuitem 2',
  '3' => 'Menuitem 3'
);

foreach($items as $nid => $title) {
  $menu_link = MenuLinkContent::create([
    'title' => $title,
    'link' => ['uri' => 'internal:/node/' . $nid],
    'menu_name' => 'main',
    'expanded' => TRUE,
  ]);
  $menu_link->save();
}

By the way, how to create Menu programmatically:

\Drupal::entityTypeManager()
  ->getStorage('menu')
  ->create([
    'id' => 'menu_test',
    'label' => 'Test menu',
    'description' => 'Description text',
  ])
  ->save();
    
    
    jquery('a[data-trigger]').click(function(){
        alert('a');
        return false;
    });

\Drupal::service('module_installer')->install($module_list, $enable_dependencies);


down vote
accepted
    

MenuLinkTreeInterface::getCurrentRouteMenuTreeParameters() is what you want. To use the example above:

$menu_tree = Drupal::menuTree();
$parameters = $menu_tree->getCurrentRouteMenuTreeParameters('main');
$parameters->setTopLevelOnly();
$main_menu_top_level = $menu_tree->load('main', $parameters);


wottf的报错
https://stackoverflow.com/questions/24104736/networkerror-404-not-found-fontawesome-webfont-woffv-4-0-3


button style:
.btn-outline {
    background: transparent none repeat scroll 0 0;
    border: 1px solid #124191;
    color: #124191;
}
hover{
#00b9e0
}
$builtForm = \Drupal::formBuilder()->getForm('Drupal\your_module\Form\Your‌​Form');
$renderArray['form'] = $builtForm;

return $renderArray;

 public function build() {    
    $form = \Drupal::formBuilder()->getForm('Drupal\demo\Form\DemoForm');
    return $form;
  }
    
    
questions regarding document library part:
1, Page 50, Fig 4.5-1, #Item C: Please tell if the doc library is for the first level navigation link "Document & Training"? if not, please tell what secondary navigation links in doc library page are ? Please also tell how to navigation to doc library page from each PG main page.

2, Page 52, said "The Document type will be displayed below the description in a grey box", Please tell what "Document Type" shall be defined?

3, It is already defined that 'XX_INT_RESTRICTED' and 'XX_EXT_RESTRICTED' will have access to restricted documents, but also said in page 58 said "    The publisher will have the ability to apply and maintain the access permission to each document in their own section of the repository", please tell we need to give 'publisher' a role list selection for further permission settings for each document file?

4, Please tell if it is ok to trim document discription as max length of certain number (like 240 characters) when/if the description is too long.

5, Regarding Fig 4.5.2-1, please tell if the home link in secondary navigation is placeholder, please tell what the first navigation link shall be?

6, Regarding Fig 4.5.2-1, please tell if the header navigation and page content shall be the same width, and banner shall be the browser's width?

function nok_custom_preprocess_region__navigation(&$variables){
  kint($variables);
  $node = \Drupal::routeMatch()->getParameter('node');
  //kint($node);

  $bundle = $node->bundle();

  $logo = render($variables['elements']['devportal_branding']);
  $logo = $logo->__toString();

  $from = ['_site_page','_secondary_page','_document_landing','_documents','_'];
  $to   = ['','','','',' '];

  $group = ucwords(str_replace($from, $to, $node->bundle()));
  kint($group);
 
  $group = '<a ></a>';



}


.logo::before {
  background-image: none;
  content: " ";
    display: block;
    vertical-align: middle;
}
article.full .field--name-body img {
    max-width: 100%;
    position: static;
    width: 100%;
}
article.homepage .image-container {
    margin-left: 0;
    margin-right: 0;
}

      <div class="alert alert-success alert-dismissible" role="alert">
      <a href="#" role="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></a>
      <h4 class="sr-only">Status message</h4>
      <ul class="item-list item-list--messages">
        <li class="item item--message">abcd</li>
      </ul>
      </div>
            
            <div class="alert alert-success alert-dismissible alert-warning" role="alert">
      <a href="#" role="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></a>
      <h4 class="sr-only">Warning message</h4>
      <ul class="item-list item-list--messages">
        <li class="item item--message">abcd</li>
      </ul>
      </div>
            
            <div class="alert alert-success alert-dismissible alert-warning alert-danger" role="alert">
      <a href="#" role="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></a>
      <h4 class="sr-only">Error message</h4>
      <ul class="item-list item-list--messages">
        <li class="item item--message">abcd</li>
      </ul>
      </div>

andrew.specogna@nokia.com
{{ url('<front>') }}

"D:\Program Files (x86)\mysql\5.7.9.0\bin\mysqldump.exe" --user=bde7f347b7a5c4 --password=03aa3abd --host=eu-cdbr-azure-west-b.cloudapp.net --skip-ssl --default-character-set=utf8 nok_ipaas_qa_we_apicmsportal_sdb_01 > qa_all_180116.sql

D:\home\data>

"D:\Program Files (x86)\mysql\5.7.9.0\bin\mysqldump.exe" --user=bde7f347b7a5c4 --password=03aa3abd --host=eu-cdbr-azure-west-b.cloudapp.net --skip-ssl --default-character-set=utf8 nok_ipaas_qa_we_apisdlsportal_sdb_01 > qa_all_180116_sdl.sql

$ drush cr -l http://sdl.devportal

在linux中
-x 是参数
--a=xxx一般这种格式

time card
31803
tinokia

https://nok-ipaas-int-we-apicmsportal-wba-01.scm.azurewebsites.net/DebugConsole

D:\Ruby24-x64\bin;D:\Ruby22-x64\bin;C:\Users\qiuq\AppData\Roaming\npm;D:\phpStudy\php\php-5.6.27-nts\php.exe;C:\Users\qiuq\AppData\Roaming\Composer\vendor\bin;D:\phpStudy\php\php-5.6.27-nts;C:\Program Files\Git\mingw64\bin;E:\behat\behat\v3.0\bin;D:\drush\vendor\drush\drush;D:\phpStudy\MySQL\bin;C:\Users\qiuq\AppData\Roaming\drupalconsole;C:\Users\qiuq\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt

http://www.uupoop.com/
在线photoshop

/sites/content/files/pictures/ios-spm-83.png
/sites/content/files/pictures/android-spm-83.png

TRUNCATE cache_config;
TRUNCATE cache_container;
TRUNCATE cache_data;
TRUNCATE cache_default;
TRUNCATE cache_discovery;
TRUNCATE cache_dynamic_page_cache;
TRUNCATE cache_entity;
TRUNCATE cache_menu;
TRUNCATE cache_render;
TRUNCATE cache_toolbar;
[Do not DELETE tables]

$update_free_access = TRUE;
//能让任何人直接运行update.php

//必备技能
\Drupal::logger('custom_module')->notice($message);
// Logs an error
\Drupal::logger('custom_module')->error($message);

时间: 2018年2月4日 16:00~21:30
地点:上海西岸艺术中心


D:\Ruby24-x64\bin;D:\Ruby22-x64\bin;C:\Users\qiuq\AppData\Roaming\npm;D:\phpStudy\php\php-5.6.27-nts\php.exe;C:\Users\qiuq\AppData\Roaming\Composer\vendor\bin;D:\phpStudy\php\php-5.6.27-nts;C:\Program Files\Git\mingw64\bin;E:\behat\behat\v3.0\bin;D:\drush\vendor\drush\drush;D:\phpStudy\MySQL\bin;C:\Users\qiuq\AppData\Roaming\drupalconsole;C:\Users\qiuq\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt

compass是基于sass的一个工具
sass scss/style.scss css/style.css --style compressed

cd site\wwwroot\themes\custom\devportal\scss

git diff HEAD^ HEAD --stat
git diff <branch> <branch> --stat
--stat 可以简化结果

提交之后转圈圈状态-看是否有提交:
https://portal.azure.com/#resource/subscriptions/a0f64e1b-edaf-4bca-a009-84cbc4dadd62/resourceGroups/ipaas-int-we-apicmsportal-01/providers/Microsoft.Web/sites/nok-ipaas-int-we-apicmsportal-wba-01/DeploymentSource

php wincache 下载
http://windows.php.net/downloads/pecl/releases/wincache/1.3.7.9/



转载于:https://www.cnblogs.com/qinqiu/p/9804120.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值