Skip to content
Marie-Louise edited this page Sep 7, 2019 · 56 revisions

Everything Drupal!!

exporting a feature

  1. Go to features
  2. then click the type of of content so for example Entity - Node, Entity - Paragraph...
  3. and then got to then check the state, look for your page (landing page for example) click it
  4. and see it's been overidden then select this
  5. go to view
  6. and then click create new feature

debugging indexing using solar

problem: the search isn't picking up certain keywords in 'Find Grants Awarded' page.

Solution : the content is in the database, it's just not being located correctly. This is an indexing problem.

which index is 'Find Grants Awarded' using ? : previously it was Funded project index, now it's the multi entity index - why is funded project index being phased out ?.....ask annika & dipak

The index is populated with a long list of fields, where are they coming from? Solr needs to be configured to include fields for each index. The function public function alterItems(array &$items) located -> /corporate/www/sites/all/modules/custom/corp_search/includes/callback_paragraph_view.inc adds the fields within a paragraph to the index.

the values (paragraph types) that were being passed into the array within the function were field_paragraphs_content which generates x amount of fields, field_sections which generates x amount of fields - however it seems as though these were linked to the whole site except the content in the 'Find Grants Awarded' page.

to try to solve the issue I had to identify the paragraph type that was actually being used in that page and pass the machine name in as a value field_grantholder_institution

  public function alterItems(array &$items) {
    $paragraphs_fields = array('field_paragraphs_content', 'field_sections', 'field_grantholder_institution');

installing module in command line drupal 7

download zip file from contrib module site, copy the folder to sites/all/modules/contrib the run drush en <module_name> to enable

getting images to appear in local env

run drush en stage_file_proxy

if there's an error, find settings.php

add

$conf['stage_file_proxy_origin'] = 'https://WellcomeWeb:2!5Eust0nRd@wt-corporate-master.codeenigma.net';
$conf['stage_file_proxy_use_imagecache_root'] = TRUE;

if you can edit and need to change permissions, the cd in the right dir and run git config core.fileMode false, sudo chmod 777 settings.php

Vagrant

Twig

challenge

Exporting Features

drupal hooks

Drupal data structures

Importing or updating database

Request a copy of the database Once you receive it, save a copy for database locally in your drupal file system (local site folder).

  1. Go to vagrant terminal (virtual machine) using following command

    $ vagrant ssh

  2. Run following command to import database

    $ mysql -uroot -proot drupal < /drupal_file_system_path/your_database.sql

so in the case of 14th nov:

$ mysql -uroot -proot drupal < var/www/corporate/www/mariadb-init/corpdb081118.sql

Updating the database

First request a copy of the db from a backend dev on the team. copy the db into the directory for your local site in the mariadb-init folder then enter the directory for the vagrant and then vagrant up then vagrant ssh then drush sql-cli < /mariadb-init/dump-file.sql

MUST USE THIS COMMAND

but if I'm inside mariab-init then run drush sql-cli < dump-file.sql

and it should take a few minutes but will work 😃

(this was executed on weds 6th feb, for tkt #3724)

after updating changes in master (that needed to be reset etc)

run...

$ drush updatedb , or drush updb

$ drush fra -y (this is a feature revert)

$ drush cc all 

Creating a new admin account using one time log in

run this command inside the drupal vm :

$ drush uli

then run but copy from user to your local site URL:

http://default/user/reset/1/1542213062/V9RBeawoSy9wbQY62Rd1pLco3JmhkAxc959CfUYGawA/login

/user/reset/1/1542213062/V9RBeawoSy9wbQY62Rd1pLco3JmhkAxc959CfUYGawA/login

Revert changes in the UI

  1. Go to features
  2. then click the type of of content so for example Entity - Node, Entity - Paragraph...
  3. and then got to then check the state, look for your page (landing page for example) click it
  4. and see it's been overidden then select this
  5. go to view
  6. and then click revert changes

Drupal dashboard

d7 dashboard

to check details for solr etc this is the place to go, click solr, open

to update solr, go to the drupal UI > configuration > search and meta data > Search API > Corporate prod (0verridden)

solr host: localhost

path : 8983

solr path: /solr/d7

save settings

Drupal Theming

  • overview of template.php

three steps to theming

  • template files (.tpl.php) -replacing tpl.php.varaible
  • theme functions overriding

inside the developers theme directory

MyTheme dir/ folder

  • myTheme.info
  • page.tpl.php
  • template.php

template.php

contains pure php a place for extensive logic or sql queries

to provide a new variable in the file, you must create a new function and then prefix the name of the theme at the start. also need to add underscore so for example.

myTheme_preprocess(&$vars, $hooks) the name of the hook should be the same name as the tpl.php file which is...

theme functions are never called directly. So for example it is written as follows: -theme('username', $object)

Clone this wiki locally