Drupal 8에서 프로그래밍 방식으로 뷰를 만들려고합니다. Drupal 7에서 crud 로그 모듈과 비슷한 점이 있습니다. 인터넷에서 참조를 찾을 수도 없습니다. \ XAMPP \ htdocs를 \ 드루팔 인스턴스 \ 모듈 2. YML 정보 파일을 만듭니다 : C -프로그래밍 방식으로 Drupal 8 뷰를 만드는 방법
1
A
답변
0
나는 내가 following-- 1. 폴더를 생성 한 ---- 프로그래밍 방식으로 뷰를 만드는 데 성공했다 --first_view.info하고 다음 코드를 추가 ---- 이름 : 먼저보기 유형 : 모듈 설명 : 나의 첫 드루팔 8보기 패키지 : 사용자 정의 핵심 : 8.x의 3.이 파일을 설치 만들기 --- first_view.install 그리고 다음 코드를 추가하십시오.
<?php
/**
* @file
* Install, schema, and uninstall functions for the First View module.
*/
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\taxonomy\Entity\Term;
/**
* Implements hook_install().
*/
function first_view_install() {
}
/**
* Implements hook_uninstall().
*/
function first_view_uninstall() {
}
/**
* Implements hook_schema().
*/
function first_view_schema() {
$schema['first_view_table'] = [
// Example (partial) specification for table "node".
'description' => 'The base table for first_view.',
'fields' => [
'id' => [
'description' => 'The primary identifier for a node.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
'name' => [
'description' => 'The name of Employee.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
],
'age' => [
'description' => 'The age of employee.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'is_active' => [
'description' => 'The activity of employee.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
],
'timestamp' => [
'description' => 'The timestamp of employee.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
],
'project_code' => [
'description' => 'The project code of employee.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => 0,
],
],
'unique keys' => [
'id' => ['id'],
],
// For documentation purposes only; foreign keys are not created in the
// database.
'primary key' => ['id'],
];
return $schema;
}
4.은 --- first_view.views.inc 을 파일을 생성하고 추가 다음 코드를 위의 단계에 따라
<?php
/**
* Implements hook_views_data().
*/
function first_view_views_data() {
$data = [];
$data['first_view_table'] = [];
$data['first_view_table']['table'] = [];
$data['first_view_table']['table']['group'] = t('First View table');
$data['first_view_table']['table']['provider'] = 'first_view_module';
$data['first_view_table']['table']['base'] = [
'field' => 'id',
'title' => t('First View table'),
'help' => t('First View table contains example content and can be related to nodes.'),
'weight' => -10,
];
$data['first_view']['table']['join'] = [
'node_field_data' => [
'left_field' => 'id',
'field' => 'id',
'extra' => [
0 => [
'field' => 'published',
'value' => TRUE,
],
1 => [
'left_field' => 'age',
'value' => 1,
'numeric' => TRUE,
],
2 => [
'field' => 'published',
'left_field' => 'is_active',
'operator' => '!=',
],
],
],
];
$data['first_view_table']['table']['join']['node_field_data'] = [
'left_table' => 'foo',
'left_field' => 'id',
'field' => 'id',
'extra' => [
['left_field' => 'project_code', 'field' => 'project_code'],
['field' => 'age', 'value' => 0, 'numeric' => TRUE, 'operator' => '>'],
],
];
$data['first_view_table']['id'] = [
'title' => t('Example content'),
'help' => t('Relate example content to the node content'),
'relationship' => [
'base' => 'node_field_data',
'base field' => 'id',
'id' => 'standard',
'label' => t('Example node'),
],
];
$data['first_view_table']['name'] = [
'title' => t('Name'),
'help' => t('Just a Name field.'),
'field' => [
'id' => 'standard',
],
'sort' => [
'id' => 'standard',
],
'filter' => [
'id' => 'string',
],
'argument' => [
'id' => 'string',
],
];
$data['first_view_table']['project_code'] = [
'title' => t('Project Code'),
'help' => t('Just a Project code field.'),
'field' => [
'id' => 'standard',
],
'sort' => [
'id' => 'standard',
],
'filter' => [
'id' => 'string',
],
'argument' => [
'id' => 'string',
],
];
$data['first_view_table']['age'] = [
'title' => t('Age'),
'help' => t('Just a numeric field.'),
'field' => [
'id' => 'numeric',
],
'sort' => [
'id' => 'standard',
],
'filter' => [
'id' => 'numeric',
],
'argument' => [
'id' => 'numeric',
],
];
$data['first_view_table']['is_active'] = [
'title' => t('Is Active'),
'help' => t('Just an on/off field.'),
'field' => [
'id' => 'boolean',
],
'sort' => [
'id' => 'standard',
],
'filter' => [
'id' => 'boolean',
'label' => t('Published'),
'type' => 'yes-no',
'use_equal' => TRUE,
],
];
$data['first_view_table']['timestamp'] = [
'title' => t('Timestamp'),
'help' => t('Just a timestamp field.'),
'field' => [
'id' => 'date',
],
'sort' => [
'id' => 'date',
],
'filter' => [
'id' => 'date',
],
];
$data['views']['area'] = [
'title' => t('Text area'),
'help' => t('Provide markup text for the area.'),
'area' => [
'id' => 'text',
],
];
return $data;
}
을 그건 ...하는 .... 우리가 설치할 때와 사용 가능 모듈이 데이터베이스에서 생성되는 모듈 ... 뷰의 일부 데이터를보기 위해 채워 넣어야합니다 ... 더미 데이터를 테이블에 추가하는 것을 잊지 마십시오 ..... 그 후에 구조 /보기 --- "보기 추가"를 클릭하십시오 ----보기에 이름을 지정하십시오 --- 그러면 "보기"드롭 다운 상자에서 테이블 이름을 볼 수 있습니다 ---이 경우 테이블 이름은 "First View Table"입니다.이 기사가 도움이 되었기를 바랍니다 ....
관련 문제
- 1. Drupal 8 - 프로그래밍 방식으로 노드 엔터티 참조 변수를 만드는 방법?
- 2. 안드로이드 프로그래밍 방식으로 뷰를 만드는 방법
- 3. Drupal 8 단락을 프로그래밍 방식으로 번역하다
- 4. 뷰를 프로그래밍 방식으로 숨기는 방법?
- 5. 프로그래밍 방식으로 스크롤 뷰를 만드는 방법은 무엇입니까?
- 6. 프로그래밍 방식으로 뷰를 확대
- 7. Drupal 7에서 프로그래밍 방식으로 다국어 메뉴 링크를 만드는 방법
- 8. 프로그래밍 방식으로 계층 분류학을 만드는 방법 drupal 7
- 9. drupal 프로그래밍 방식으로 엔티티를 생성합니다.
- 10. 프로그래밍 방식으로 NSPopover를 만드는 방법
- 11. 이전 뷰를 프로그래밍 방식으로 다시 탐색하는 방법
- 12. 프로그래밍 방식으로 뷰에 뷰를 추가하는 방법
- 13. 뷰를 사용하여 프로그래밍 방식으로 탭 전환하는 방법?
- 14. iOS 뷰를 핸들러에 프로그래밍 방식으로 연결하는 방법
- 15. 프로그래밍 방식으로 이미지 모서리를 만드는 방법
- 16. Ubercart : 프로그래밍 방식으로 제품을 사용하여 주문 만들기 Drupal 8
- 17. Drupal 8 : 프로그래밍 방식으로 노드를 만들고 양식 API를 사용하여 리디렉션
- 18. 프로그래밍 방식으로 UINavigationBar를 만드는 방법
- 19. 프로그래밍 방식으로 sitecollection을 만드는 방법
- 20. 프로그래밍 방식으로 큐브를 만드는 방법
- 21. 안드로이드 - 프로그래밍 방식으로 뷰를 배치
- 22. 뷰를 프로그래밍 방식으로 전환하려면 어떻게해야합니까?
- 23. ConstraintLayout에서 뷰를 프로그래밍 방식으로 추가하기
- 24. 프로그래밍 방식으로 Drupal 블로그 항목
- 25. 프로그래밍 방식으로 drupal 테마 할당
- 26. 프로그래밍 방식으로 Drupal CCK 필드
- 27. 프로그래밍 방식으로 iOS 앱보기를 만드는 방법
- 28. FreeMarker를 사용하여 프로그래밍 방식으로 JSF 뷰를 만드는 방법은 무엇입니까?
- 29. ios- 프로그래밍 방식으로 뷰를 만드는 경우 viewcontroller가 복잡해집니다.
- 30. Drupal 8 commerce store 설정을 얻는 방법
정말로보기 (Drupal의 용어로보기)를 만들거나 사용자 지정 데이터베이스 쿼리를 만들려고합니까? – MilanG
"프로그램"을 "보기"로 만들려고했습니다. 어제 당신의 답변에 감사드립니다 ... 어제 그것을 만들었습니다. – Rekha