texts: How to get different size image on views

texts: I have view that fetch content and I show it on a block. My view shows 16 nodes and each node has title, date and image. For images I use imagecache to get correct size image. I have set this image to use the imagecache preset on view field settings. But now, I would need that the 1st and 7th image are different size (other images are 300x300 but 1st & 7th should be 750x400). How can i do this? Is it possible to achieve somehow in views configuration or on template level? Its drupal 6.


texts:
I'm tying to show all the taxonomy terms from a specific vocabulary linked to the current node being viewed. I'm doing this with a new block defined in my module.

In my hook_block_view i need to give a $block['content'] a value, i'm putting a 'foobar' in it because i won't use it, and i add a new key 'tags' which is a array with my tags to render. Then in my block.tpl.php i check the block name and change the rendering if my custom block is rendered.

I guess there must be a better way of doing this...

I would love to add a custom template file, that will be used on my specific block. Is this possible?

Thanks,
Jonathan


texts: How can I debug an AJAX error in VBO? (PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri'

texts:
I have a view that lists all the user accounts on my site.  With VBO, I have a rules component, Resave user account (action set, action: save entity (user), no force saving immediately).

Recently, when I attempt to re-save all user accounts, I got an error on id=4037:

  An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging
  information follows. Path: /en/batch?id=4037&op=do StatusText: Service
  unavailable (with message) ResponseText: PDOException:
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
  '' for key 'uri': INSERT INTO {file_managed} (filesize, status,
  timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1,
  :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0
  [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] =>
  1375690632 ) in drupal_write_record() (line 7153 of
  /Volumes/Bullfrog/om/includes/common.inc).

And when I attempted to save all accounts again, the error occurred on id=4039:

  An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging
  information follows. Path: /en/batch?id=4039&op=do StatusText: Service
  unavailable (with message) ResponseText: PDOException:
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry
  '' for key 'uri': INSERT INTO {file_managed} (filesize, status,
  timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1,
  :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0
  [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] =>
  1375691655 ) in drupal_write_record() (line 7153 of
  /Volumes/Bullfrog/om/includes/common.inc).

So, if I simply continue to re-save again and again, eventually all the accounts will get re-saved, but to execute this bulk operation takes about 20 minutes each time, so I will waste several hours this way.  How can I analyze what is the cause of this error?


texts: I have created a sample context just for testing its work, and now it appears on every page because I have used a block in my context. I want to remove the sample context. I have searched in Drupal docs but nothing useful there. Any ideas how to solve it.


texts: Disable language code in URL for default language

texts:
I'm using drupal 7 and i18n module.

I select the user language with the language code in the URL like this:
mysite.com/fr/node/1
mysite.com/en/node/1
etc

The default language is French.

How could I manage to get only "mysite.com/node/1" when selected language is French?
For now, I only get "mysite.com/fr/node/1".
If I go to the root of my website "mysite.com", and I overlay the links, they're all pointing to "mysite.com/fr/...".

Is there anyway I could disable the /fr/ as the default language?

I tried playing around with the selection's rule weight, without success.


texts: How to return content with shortcodes from drupal module?

texts:
I'm using drupal 7 to develop a module.

This module has a menu with a page callback 'page callback' => 'my_function' and the function has to return HTML.

In the function I'm returning array('#markup' => $markup); where $markup has HTML with shortcodes: [button path="node/2" (class="additional class")]Order now[/button].

The shortcodes are appearing directly in the browser without transformation.
I created a page on the web administration page with the same content and the shortcodes are transformed.

How can I return HTML that has shortcodes from a module?


texts: Call to undefined function menu_load() in .../public_html/includes/menu.inc on line 579

texts:
I really need your help. Actually, my journey begin with the installation Drupal and some modules. After a couple of days I suddenly get an issue "500 Internal Server Error".

I asked my hosting provider why this happened, they said "That because of the file .htaccess and you should add to this file php display error". So i did this and I get a new issue :

  Fatal error: Call to undefined function menu_load() in public_html/includes/menu.inc on line 579.

By the way that's line 579 else {$return = $function($value);}.
P.S I am a beginner in PHP. I really want to study Drupal more and create cool sites, but this problem...


texts: List ALL contents Taxonomy Terms with Views

texts:
I am trying to figure out how to use views to list out ALL my taxonomy terms that are grouping node titles.
Example:

Taxonomy Term 1
- Node Title 1
- Node Title 2

Taxonomy Term 2
- Node Title 3

Taxonomy Term 3
-Message: There are currently no Node titles at this time, please check back

Taxonomy Term 4
- Node Title 4
- Node Title 5

like : https://docs.acquia.com/


texts: How to create an add content link with views

texts: I have a view of the Project node type (created by the pm module) that works well. For authorized users I would like to create a link button that will allow them to create a new project. I've spent the last several hours surfing the web trying to find out how to do this. I am new to Drupal so a solution that avoids using CSS & php would be most welcome.


texts: How to parse JSON feed from a d8 into another d8 site using Feeds Migrate Module

texts:
This is the JSON output from a view using REST export

    [
  {
    "spotlight-title": "Spotlight 3",
    "spotlight-body": "
This is spotlight 3
"
  },
  {
    "spotlight-title": "Spotlight 2",
    "spotlight-body": "
this is spotlight 2
"
  },
  {
    "spotlight-title": "Spotlight 1",
    "spotlight-body": "
This is the first spotlight
"
  }
]

And in my other d8 site that i'm trying to consume the JSON output through the Feeds Migrate module I've tried setting $.* and $.[] in the JSON Item Selector and having no luck. I quickly get the error "An AJAX HTTP error occurred.
HTTP Result Code: 500" in the recent log messages I see "Notice: Undefined index: $.[] in Drupal\migrate_plus\…"

What am I supposed to to be setting as the Item Selector? I followed these steps to get JSON REST export from view https://internetdevels.com/blog/views-rest-export-drupal-8

Thanks!


texts: How to update a menu link created with MenuLinkContent::create()?

texts:
I know how to search for menu items created with *.links.menu.yml:

$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
$menu_links = $menu_link_manager->loadLinksByRoute('user.page');
foreach ($menu_links as $menu_link) {
  // Do something
}

However I'm looking for a way to search for and update a menu item created with MenuLinkContent::create():

$home_new = MenuLinkContent::create(array(
  'title' => t('Home'),
  'link' => array('uri' => 'internal:/'),
  'menu_name' => 'main',
));
$home_new->save();

After creating this menu item, how do I look it back up again to modify it?


texts: How can I have a view to load more rows on clicking a "Load more" button?

texts:
We have created a view, myview, where we want to display 3 nodes (content type = basic) and add a View All button on page load. The purpose of the 'View All' button will be to show 6 more (the view is supposed to show max 9).

How can we display 3 nodes with a View All button?

What we tried, but the view did not display the view all button nor did it allow me to limit to total of 9. I also could not find an appropriate view hook to do what i am looking for.

View settings:

Change pager plugin to full
change pager plugin to mini


texts:
Setup:

I have a main module (called public) and several sub-modules that extend the support offered by the public module.
A sub-module (let's call it sub) functions can be accesed only by users with the role that that sub-module creates (guess what, called sub).

Some of the pages defined in public_menu() are extended by the pages defined by sub_menu().

For example, if the public module declares:

$pages["public/asl/info"] = array('page callback'=>'public_asl_info', ...);

the sub module declares:

$pages["sub/asl/info"] = array('page callback'=>'sub_asl_info', ...);

also, consider that sub_asl_info() extend public_asl_info() like this:

function sub_asl_info( $id)
{
    $public_page = public_asl_info( $id);
    $dip_page = sub_asl_dip_info( $id);

    $page = $public_page.$dip_page;

    return $page;
}

there are more complex cases, but this is enough to explain the setup :)

How i solved it (wrongly) so far:

function sub_menu_alter( &$item)
{
    if( !has_role( 'sub'))
        return;

    $item['public/asl/info']        = $item['sub/asl/info'];
    $item["public/operatori/info"] = $item["sub/operatori/info"];
    $item["public/ospiti/info"]     = $item["sub/schedario"];
    $item["public/query"]           = $item["sub/query"];
    $item["public/tassonomia"]  = $item["sub/tassonomia"];
    $item["public/comunicazioni"]   = $item["sub/comunicazioni"];
}

The redirects are hard saved inside the menu_router table, so with more than one user logged it doesn't work.
I came to this solution based on how i solved the same problem but for blocks, however, using _block_view_alter() doesn't hit the same wall.

How do i solve this (programmatically)?

Possibly without using yet-another-module, unless really neccessary.


texts: Pass custom query strings across website

texts:
I want to use some custom query strings for tracking purposes and for visibility rules. The goal is, to provide a link such as www.example.com#affiliateid=1 and the string is preserved through the whole web session. Ideally, # should be used instead of ?, as it is ignored by google and prevents duplicate content.

However, each time I click a link on my site, the parameters are lost.

I don't really know where to start -
are they usually passed and is this a problem with url rewrite or would I have to learn drupal that it should append the strings to each link?

Thank you!


texts: How to check if an edited form is editing a translated node

texts:
I have a content type named film.

Original language of a film is FR.

Let say I have 2 translatable fields on a total of 10 fields in film.

I am using this code to alter the add/edit form of film:

function mymodule_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  switch ($form_id) {
    case 'node_film_edit_form': // edit
    case 'node_film_form': // Add
      alter_film($form, $form_state, $form_id);
      break;
    ...
  }
}

In the alter_film function, I would like to add a custom submit only if the edited form is for French (Original language)

function alter_film(&$form, FormStateInterface $form_state, $form_id) {
  ...
  //HERE IS MY PROBLEM:
  //HOW TO KNOW IF IT IS TRANSLATED FILM
  if (! $is_translated_film){
    $form['actions']['submit']['#submit'][] = "submit_film";
  }
  ...
}

The question is: what check could be made to know which form is edited: the original language form (10 fields) or the translated language form (2 fields)

As a side question, I don't understand why there is no difference in the dpm($form); output if I execute one in the French form and the other one in the English form.
I am asking this, because in /admin/config/regional/content-language, I have checked Hide non translatable fields on translation forms.
And I would expect to have 10 fields in the french form array and only 2 (translatable) fields in the translated form array.

In the translated form, only 2 fields are displayed as expected, but I am wondering why the 10 fields are included in the array.... I ask that just out of curiosity


texts: Symlinked folder not recognized by file_exists?

texts:
A module I'm working on maintains a list of files in the private file system folder in Drupal. I use hook_file_download to control access to these files.

I generate links to these files, which end up like: http://sample.com/system/files/my_folder/file.pdf

My website path is /var/www/sample.com/www and the private folder path is configured to be /var/www/sample.com/private.

Now, if the file is placed is /var/www/sample.com/private/my_folder/file.pdf, everything works fine and I can properly control access to the file and deliver it. However, if my_folder is located elsewhere and symlinked in, then things break. I've tracked part of it down to the PHP function file_exists returning false, which is called in file_download.

I'm not sure where to go from here. Everything I've searched for thusfar indicates that symlinks should work just fine. The permissions on the symlinked directory are OK - the directory is 755 and the files are 644.

What else could this be?

I've tried this on the latest PHP 5.3 and PHP 5.4 with no difference.

EDIT: It's worth mentioning that I can get file_exists to return true if I pass the absolute path to the symlinked file. Drupal is passing a stream wrapper though (private://my_folder/file.pdf). So looks like it could be related to the streamwrapper somehow?


texts:
I'm looking for a schedule appointment form in Drupal 7 which looks like the below image:

Before I'm going to start building a custom module I'd like to know if there's any other module like this? And I also need to integrate Google Calendar with this.


texts: How can i add our own field in Ubercart billing address?

texts:
I have used Ubercart in my project.
I would like to add my own one field in Ubercart Address field.

How can I?

Does any one had same experience?


texts: Add Fields to Field Group programatically

texts:
I have used "Field Group" module and created some groups in backend. Now i want to programatically add a field to the group.  How can I do that.

I am using Hook_form_alter, I have noticed that every field has an 'und'attribute in which the field group it belongs to is listed, but if a create and 'und' array and add a field group name to it, it does not work.

How should I do it?


texts: Fatal error: Class 'Archive_Tar' not found in ArchiveTar.php on line 8

texts:
Rather than re-explaining the whole process that got me here, I'm hoping I can just reference this question: Can't access specific admin pages

In that question, I was hitting errors while trying to update Drupal. I updated composer as well.

After clearing caches, restarting PHP and restarting my docksal project, the errors went away, and the admin seems usable except the specific thing I need

A backup tar was lost during all of that, so I'm trying to create a new back-up, so I'm back to safety. But, when I go to the export page, here: page /admin/config/development/configuration/full/export, I click the export button, and it gives me a fatal error:

  Fatal error: Class 'Archive_Tar' not found in /var/www/docroot/core/lib/Drupal/Core/Archiver/ArchiveTar.php on line 8

When I look in the log, I see this message:

  The file /tmp/config.tar.gz was not deleted because it does not exist.

This is Drupal 8.7.3 , if that helps.

I would just do drush archive-backup, if I could. But that option has ben removed.

Not sure if I gave enough info, above. Let me know.


texts:
I am dabbling fresh with Drupal 7 and so far having little success with getting the Menu to behave the way I want it to. My CSS and PHP basics are strong, but understanding Drupal's system is in itself a huge challenge and hence my doubts.

For those acquainted with the Bartik theme, the main menu defaults itself in the header.

I am trying to create a floating/persistent menu that encapsulates the entire width of the website. But I am not sure where I need to go in and make the required changes.

One option I have is to remove the main menu from the Bartik header and then introduce the main menu block in the 'featured' region. Here the menu is rendering itself horizontally instead of vertically the way i want it to be.

Essentially the question is, How do I alter the main menu in the Bartik theme? Where do I need to get in and make changes.OH, and I have sub-themed it, just to let you know.


texts: D7 multi-role comment permission per content type - how-to?

texts:
I'd like to extend (...or create) a content type/node that allows:
commenting by two or more roles though one role's members can not see the other roles' comments/replies as well as one role that is granted permission to see all comments/replies for that content type/node.

Has anyone already solved this and what would they recommend as an approach to solve this requirement?


texts: Display main menu expanded in footer, drop down in header

texts: I'm trying to show the Main menu in two places, once as a dropdown menu at the top, then again in the footer as a fully expanded (non-collapsible) set of links. I'm using the Superfish module to handle the top menu, and Menu Blocks to place the menu in my footer region. I'm using D7 and am sub-themeing the Bootstrap theme. Ideally, I'm looking for a way to simply output the Main menu as a very simple unordered list of links, without any of the dropdown classes or scripting applied to it. Where would be the best place to do this? I tried overriding theme_menu_link but that didn't seem right (since I can't figure out how to get the region.)


texts:
I tried two versions:
1.

$form_state = array();
form_load_include($form_state, 'inc', 'system', 'system.admin');
$form_state['values']['var'] = 'theme_settings';
$form_state['values']['logo_upload'] = file_save_upload('/path/to/logo.jpg');

drupal_form_submit('system_theme_settings_submit', $form_state);

2.

 variable_set('logo_path', '/path/to/my/uploaded/logo.jpg');

but none of them worked.


texts: How do I get flood control to respect X-Forwarded-For?

texts:
We're using JWilder's excellent dockergen switchboard to proxy vhosts on our main server. Like most nginx proxies, it sets an X-Forwarded-For header but it can't mask it's own IP address on each request. As a result, when one user attempts to many incorrect logins, all users are locked out of the server until the timeout expires. I've set the flood control to be fairly permissive but I'd rather just tell Drupal to respect the header because too many people are being locked out and permissive settings are a security risk.

TCP documentation states that applications which perform IP-level logic should respect the X-Forwarded-For header. How can I get Drupal's flood control to do so, and to stop locking legitimate users out of the server?

Apparently, Aquia had the same problem some years ago so there must be some solution...


texts: Can I pass file name as a parameter to menus page arguments?

texts:
I have a hyperlink, in that I am passing the dynamic foldernames and filenames as url like below.

 $data .= '
' ."--". $filenames .'
';

When I click on this, it will go to the particular menu, in the menu I am calling a function to do delete functionality. Below is the menu implemetation

 $items = array();
    $items['/delete/%/%'] = array(
    'title' => "Delete Files",
    'page callback' => 'delete_public_files',
    'page arguments' => array($arg1, $arg2),
    'access arguments' => array('administer custom settings'),
   'type' => MENU_CALLBACK,
  );

I am getting confused while using the arguments here. Can anybody help me that how I have to hit this sitename/custom/delete/foldnames/filenames url. On the samy way how can  call delete_public_files function with $foldnames and  $filenames as arguments.


texts:
I am using this example: https://gist.github.com/2596787 as a base for importing some static HTML to a Drupal 7 fresh install.  Using drush ms:

Group:                Total  Imported  Unimported  Status  Last imported

HtmlfilesNodeMigration

HtmlfilesNode         2046   0         2046        Idle    2013-01-23 13:58:01

I can see that the Migration class seems to be setup.  However when I go to run the migration from drush I get:

Unrecognized migration: HtmlfilesNodeMigration                           [error]

Trying through the UI, I get

Fatal error: Class 'HtmlfilesNodeMigration' not found

Any ideas, pointers etc would be a great help.  I can post the info/module/inc files I am using if needed.


texts: Overriding permissions of existing page blocks all users

texts:
Problem

I'm trying to block access to Drupal's taxonomy pages for anonymous users.

I'm using the solution set out in this answer, but for Drupal 7 rather than 6.

I'm using hook_menu_alter and hook_permission to create a new access argument for taxonomy pages. The permission is successfully created, but no matter what roles I tick the pages remain blocked. Any ideas what I'm doing wrong?

Example Code

function custom_module_menu_alter(&$items) {
  $items['taxonomy/term/%']['access arguments'] = array('access taxonomy permission');
}

function custom_module_permission() {
  return array(
    'access taxonomy permission' => array(
        'title' => t('Access taxonomy pages'),
    )
  );
}


texts: Applying Updates to Multiple Drupal Sites

texts:
I have over 100 drupal 7 websites on my single server. Applying updates to each site individually is a lengthy task.

Is there any simple way through which we can update all the websites at once, or can we use a single module folder for multiple Drupal websites?


texts: Custom Drupal (Block)Module not showing in Blocks

texts:
Relatively new to Drupal. I have created a custom Module that is supposed to create a block. I refferenced a successful module that accomplished the same end goal (implementing a custom HTML build).

I have done the "Disable > Delete > Clear Cache > Re-Install/Activate Module" process a few times, with no luck. Any help or insight would be appreciated!

Here is my code for the .info file:

name = History of Alcohol Timeline
core = 7.x
package = Legal Thinking Age
php = 5.2.4
version = 7.x-1.0
project = lta_hoa

Here is my code for the module:

<?php

function lta_hoa_timeline() {

$output = <<<TIMELINE

  ...

TIMELINE;

return $output;

}

function lta_hoa_block_info() {

  $blocks['lta_hoa'] = array(
            'info' => t('History of Alcohol')
        );

  return $blocks;

}

function lta_hoa_block_view($delta = ''){

  // Setup blocks
    $block = array();
    switch ($delta) {
      case 'lta_hoa':
      drupal_add_css(drupal_get_path('module', 'lta_hoa') .'/css/jquery.fancybox.css');
      drupal_add_css(drupal_get_path('module', 'lta_hoa') .'/css/media-queries.css');
      drupal_add_css(drupal_get_path('module', 'lta_hoa') .'/css/style.js');
      drupal_add_js(drupal_get_path('module', 'lta_hoa') .'/js/jquery.fancybox.pack.js');
      drupal_add_js(drupal_get_path('module', 'lta_hoa') .'/js/jquery.timelinr-0.9.53.js');
      drupal_add_js(drupal_get_path('module', 'lta_hoa') .'/js/lta_hoa.js');
      $block = array(
          'subject' => t('History of Alcohol'),
          'content' => lta_hoa_timeline()
        );
        break;
        default:
          break;
    }

    return $block;
}


texts:
On my Drupal 7 site once I have around 1500 records associated to a given content type then when viewing any of these nodes instead of seeing the content I sometimes get the following error message "Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 8 bytes) in /www/dev/drupal/includes/cache.inc on line 434".
If I have less than 1500 records for a given content type (i.e. 1000 records) then viewing any of these contents always display without this error.
How can I prevent this error from occurring for a given content type that has at least 1500 records associated to it.


texts: This menu looks really nice. Im trying to do one similar. Any suggestions on how to start and what modules should I use.


texts: How to customize Schema.org at node level?

texts:
I am using the Schema.org module for schema tags, which allows me to customize schema tags at content type.

How can I customize schema tags at node level?


texts: node shows all taxonomy terms with images (the not matching are greyed)

texts:
I need the node to show all terms of the taxonomy 'months' (not only the matching ones) with only the matching ones in evidence, i.e. not greyed.

I can imagine I can define a couple of image fields for the terms (one coloured, the other one greyed) but can't figure out how to have my node show all of them and choose the coloured image for the matching ones.

many many thanks

Angelo


texts: What does full path mean with sweaver module?

texts:
I am new to Drupal and am struggling to learn how it uses CSS. I am not very familiar with CSS. I am using the Outreach theme and the Sweaver module. Sweaver shows a "full path". See image of my full path.

Do each of these items in the path represent different CSS files? If so, where do I find these files? I am trying to remove an underline.


texts: How to print add to cart form for drupal 8 commerce on my custom page programatically

texts: I have a site where I created a custom page to list products (can't use views module due to custom requirements for printing that list). On the list page for each product I have variation sku available. I want to show add to cart form with qty field on this custom list page. I have searched for a solution but couldn't find one for drupal 8. I know how to do it in drupal 7 but can someone help me with how we can have this in D8?


texts: Get custom field of node in frontend as its type

texts:
I have a requirement in drupal. In this i have a content type 'sports' and created some custom fields of type dropdown, checkbox and file.

I want to get the custom field with its type as html in front end.

Example In dropdown i have

<select>
<options value="15">Cricket</options>
<options value="16">Football</options>
<options value="16">Basketball</options>
</select>

I want the same in frontend to display as html


texts: How to bulk delete content of a given type?

texts:
I need to delete all content of a content type. I'm allowed to select up to 50 node per deletion process. My problem is that I have 900 nodes then I need to repeat this 18 times.

Anyway to select all nodes to mass delete them?


texts: How to make a responsive theme in Zen 5? Modules and procedures to keep or to leave from older Zen versions

texts:
I'm using Zen theme back from 2007, when Drupal 5 comes out (anyone remembers those subtheme directories put into the main zen directory?). Thanks to this theme reliability and awesome community, the small team I work in completed several projects for customers in Drupal 5, 6 and 7. Since the theme base is standard, projects change hands smoothly and common solutions were standardized internally.

Now, customers start to get more demanding about mobile devices and building a separate theme or a simple alternate stylesheet for mobiles is not enough anymore. "Responsive" become a term used by the marketing people too. And here starts our problems as developers.

A video from July 2012 by Palantir is a good starting point, and the Responsive web design handbook is extensive. Maybe, too extensive. The number of new concepts is overwhelming (to me).

Compass, SASS, the use of a Ruby CSS preprocessor (compass) running as a server to generate CSS files from SASS, and not to improve loading times by the client are some of the new design concepts implemented through Zen Grids. Respond.js and HTML5 shim seems to be new retrocompatibility concepts. Zen Grids seems to be able to do most of the work Panels and templates used to do.

Anyone here started from a previous Zen theme and set of tools like view blocks, Panels and Mini panels, field templates, conditional stylesheets and now have successfully changed the working method to adapt to Zen 5 new features? What should I keep and what should I have better to forget after entering in the Zen 5 world? Here some tools that seems to make obsolete some old companions:

Field / view field templates > Fences?
Panels > Zen grids?

How blocks and views will adapt in this new approach, looking for responsiveness? How navigation? I used awfully a lot Menu Block and now I see responsive menus like this popping out. Conditional stylesheets are something I can forget of because of Compass? How can I adapt user-loaded images through IMCE / TinyMCE?

I don't want to use old, unfit tools in a new environment, so what's the best, practical approach while selecting modules and designing the theme from a "old school" Zen enthusiast point of view in your experience? Priorities for my team is to keep low the number of contrib modules and identify a standard process to create quickly complex responsive layout for nodes and for views keeping code as clean and maintainable as possible. Thank you very much.


texts: Block displaying one parent and many children nodes using only Views 3 Drupal 7?

texts:
I'm trying to generate a block that looks like this in Drupal 7 Views 3:

Parent Node (fields)

Child Node 1 (fields)
Child Node 2 (fields)
Child Node 3 (fields)
...

Parent node is a different content type than child node. For the time being, I've added a matching taxonomy field to the two content types. So to potentially establish a relationship, this value would be the same.
What is the best way to achieve this? It seems like a simple enough goal that Views should be able to handle. I prefer to thoroughly understand the core software w/ Views, before I blindly install a bunch of modules that I may not need.


texts: How do I migrate a Kickstart site from one server to another?

texts:
I created a site using Commerce Kickstart.
Then I added all the products and stuff. Now I want to move this site on a new server as it is.

I have downloaded all the files from the original site. Also exported the database.

Is it possible to use these files and database to migrate the site on new server with different domain name as well as different database name?

If no, what should I do?


texts: Iterate through multiple value content field in Twig template

texts:
I need to take control over the rendering of a field_admin_tags field in a node.html.twig template.

This WORKS:

{{ content.field_admin_tags }} — Renders everything (label + all field values)
{{ content.field_admin_tags.0 }} — Renders only the first value in the field, and no label

PROBLEM: I have no control over the markup surrounding the tags, e.g.

...

.

So my idea was to iterate over the render array.

But that DOES NOT work:

{% for tag in content.field_admin_tags %}
  {{ tag }}
{% endfor %}

I get: Exception: Object of type Drupal\node\Entity\Node cannot be printed.

I think I'm iterating over the keys/values of the render array vs the items inside the field (if I print out an "X" in each loop, I get 20 X's while I only have two or three values in this field).

I'd like to iterate over content.field_admin_tags.0, content.field_admin_tags.1, etc.

Any idea how to fix this? Thanks.


texts: Rules Link - Insert into System Node Content Template Variant

texts:
I'm trying to incorporate a Rules Link into an edited Panels Node Template Variant (Structure -> Pages -> Variant). The Rules Link is a simple "Apply Now" but I'm a little confused as to what I should be inserting as a Content. Previously it was working fine (the Rules Link added to the Content Node Field set and when any said content type was viewed it was there).

This item when I look at the content types available (Activity through to Widgets), I select Form (and available content) or Node or Node Token Type), all I get on the saved Node Template when viewing is basic text 'Entity info.' in the said Block and no actual Rules Link (ie general 'blue' URL link).
My efforts to get it to show in the Node Variant is not a success and I've tried the Content types available for insert. I roughly understand what is happening and how things 'should' work and presumed what I did before would merely work in the edited Node, it seems quite self explanitory but not having much joy at this stage or maybe I'm merely missing a small point.

Could someone share with us the general process of getting a Rules Link to show in a Node Content Template Variant in order for the Rules Link to process to the next stage. Thanks.


texts:
I use message_notify with drupal commons. One of the preset messages is commons_q_a_question_answered. I tried to send this message via rules module without success (action "Send message with Message notify") and using the example module with a php custom action, no success too.

Do you have the same problem ? do you solve it ?

I reported a bug in the module here


texts: Sorting not working in the view SORT CRITERIA

texts:
In my view want to sort the result according to the work rank  field value and in content value are in numeric number . its not showing result according to ascending order . its showing random .

How can sort the result according to the work rank field value in asc order?


texts: Commerce Kickstart 2 Display color as visual colour

texts:
In the 'Tops' Content type/Product Variation, the color selection in the 'catalog' shows up as multiple color blocks below the 'From $00.00' price information.

I've made up a new Content type and Product Variation, also with color. How do I get all the available product variation colors to show up as blocks of color below the price instead of just a single link to the first variations colour?


texts: Omega Theme Renders a Container inside of a Container

texts:
I currently have a view listing a set of products via rendered entities as Teasers. However the Omega Theme is taking each teaser and adding the container-24 class to it eliminating the ability for me to have the teasers display inline. Below is an image attached, why is Omega doing this?

http://i.imgur.com/H1izEsp.jpg


texts: Display taxonomy term description within the content page

texts:
I've a content type with some fields, one of the field is associated with a taxonomy and it has some terms (each term has its own description). Here, when I input the field with the terms and submit the content. The content page appears as:

[title] : title of the content.

[field1] :

[field2] :

[taxonomy] : [term1]

             [term2]

             [term3]

The content page is viewed with all the fields and taxonomy terms with an anchor/link. I would also like to include the description in its display as

[term1] : [description]

[term2] : [description]

[term3] : [description]

Any Ideas on how to get this done.


texts: Node form redirect based on submit button value

texts:
I've read and experimented with several ways to redirect a form once submitted. However, I only want to redirect a node form if the operation is t('Save').

If I set $form['#redirect'] = 'blah' in form_alter, it will redirect on all types of form submits. If I add a submit handler and then set $form_state['redirect'], this just gets overridden by drupal's node_form_submit.

What is the correct way to redirect a node submit only if the submit operation was say t('Save')?

NOTE: I found out that the generic form_alter attempt of $form['#redirect'] interferes with the node delete submit handler, as it has to redirect to node/%node/delete. So hence I am looking for a more accurate method.


texts: In Drupal 7, Where is field settings data stored? (Not the field data)

texts: I'm trying to update my field's data tables structure manually via phpmyadmin as I cannot modify it via the fields settings page since i have data in them. The thing is, where do I update the "fields settings" to encompass these table structure changes?


texts: How to create a block with views filter form available on each page of the site?

texts:
This is for a site of a small real estate agency.

I have a property_offer content type set up and offer type vocabulary, with 4 terms (Buying, Selling, Put out to lease and Take on lease). Then I have created a view with page display, for the front page of the site it lists all the offers, and there is also a page for each of the 4 terms.

How do I create an exposed filter for this view which must be available as a block so I can put it in a region of the site and it'll be available on all the other pages too?


texts:
A Form having a form element of term reference with checkboxes widget. I want to insert a image tag with each taxonomy term name,

For example here is the html of taxonomy term reference

< div class="form-item form-type-checkbox
form-item-field-user-interest-und-24">
  < input type="checkbox" id="edit-field-user-interest-und-24"
name="field_user_interest[und][24]" value="24" checked="checked"
class="form-checkbox ajax-processed">
  < label class="option
like-taxonomy-term" for="edit-field-user-interest-und-24">-uejo
< /label>
< /div>

so how can i insert image tag inside div tag so that its html become this

< div class="form-item form-type-checkbox
form-item-field-user-interest-und-24">
  < input type="checkbox" id="edit-field-user-interest-und-24"
name="field_user_interest[und][24]" value="24" checked="checked"
class="form-checkbox ajax-processed">
  < label class="option
like-taxonomy-term" for="edit-field-user-interest-und-24">-uejo
< /label>
< img src="image=path" alt="image-text">
< /div>


texts:
I am creating a radio button like this:

$form['paymentMethodSelect'] = array(
    '#type' => 'radio',
    '#title' => $this->t('How would you like to make payment?'),
);

This works and creates a single radio button. Now according to documentation, to create multiple radio buttons, you change "radio" to "radios". But if I do that:

$form['paymentMethodSelect'] = array(
    '#type' => 'radios',
    '#title' => $this->t('How would you like to make payment?'),
    '#default_value' => 'eft',
    '#options' => [
        'eft' => 'EFT (Electronic Funds Transfer)',
        'cc' => 'Credit Card',
    ],
);

But if I do that then I end up with this:

Any idea why I am not seeing two radio buttons as expected?


texts: Join table query in hook_views_query_alter not selecting field from joined table

texts:
I have the following query

SELECT
    node.nid AS nid,
    node.created AS node_created,
    'node' AS field_data_field_gm_tanknummer_node_entity_type,
    'node' AS field_data_field_gm_naam_node_entity_type,
    'node' AS field_data_field_gm_adres_node_entity_type,
    'node' AS field_data_field_gm_postcode_node_entity_type,
    'node' AS field_data_field_gm_jaar_node_entity_type,
    'node' AS field_data_field_gm_bedrijf_levensduur_node_entity_type,
    'node' AS field_data_field_gm_bedrijf_antibiotica_node_entity_type,
    'gemiddelde_waarden:page' AS view_name
FROM
    {node} node
left JOIN
    {field_data_field_gm_tanknummer} field_data_field_gm_tanknummer
ON
    node.nid = field_data_field_gm_tanknummer.entity_id
WHERE
    (( (node.status = :db_condition_placeholder_0)
AND
    (node.type IN (:db_condition_placeholder_1))
AND
    (field_data_field_gm_tanknummer.field_data_field_gm_tanknummer_value IN (:db_condition_placeholder_2)) ))
ORDER BY
    node_created DESC LIMIT 10 OFFSET 0

where I join the table field_data_field_gm_tanknummer.

I want to select the field field_data_field_gm_tanknummer_value from that table but the query cannot find this field.

This is my function

function misc_views_query_alter(&$view, &$query) {
  if ($view->name == 'gemiddelde_waarden') {

    //create the join
    $join = new views_join();
    $join->table = 'field_data_field_gm_tanknummer';
    $join->field = 'entity_id';
    $join->left_table = 'node';
    $join->left_field = 'nid';
    $join->type = 'left';
    //add the join the the view query
    $view->query->add_relationship('field_data_field_gm_tanknummer',$join,'node');

    $query->where[1]['conditions'][2]['field'] = 'field_data_field_gm_tanknummer.field_data_field_gm_tanknummer_value';
    $query->where[1]['conditions'][2]['value'] = array(
      0 => _misc_tanknummers()
    );
    $query->where[1]['conditions'][2]['operator'] = 'IN';
  }
}

Is there something wrong with the join?


texts: "Notice undefined index" for an existing element in $form array

texts:
Basically This is my Array

 array(
        [product_id] => Array
        (
         [#type] => hidden
         [#value] => 39
        )
      )

and I am trying to get the value which is '39'

$cartId = $form['product_id']['#value'];

and yes I get the value without any issues, but in my site it gives me a notice saying "Notice: Undefined index: product_id in  ..."

This is my entire code

function MyModule_form_alter( &$form, $form_state, $form_id )
{
    $cartId = $form['product_id']['#value'];
    print_r ($form['#value']);
    if ($form_id == 'commerce_cart_add_to_cart_form_'.$cartId)
    {
        $form['add_to_wishlist']['#weight']= 49;
    }
}

any ideas how to fix this? because I couldn't figure the cause of it as it works well!


texts: array value within Rule's PHP action always gives 0 instead of related uid

texts:
I want to fetch the latest Ubercart order's associated uid and if it is NOT the same as the newest user's ID then my Rule should validate and send an email to a selected address.

In the Rule I created, I've written the following PHP action in order to first check what $uids[0] is giving me. When this works as require, I'll put the same code as a PHP condition, replacing the watchdogs with return FALSE & TRUE.

The problem I'm facing is that $uids[0] always gives 0 instead of the last order's user ID.

$query = db_query("SELECT uid, created FROM {uc_orders} order by created desc");
$uids = array();
while ($records = db_fetch_array($query)) {
    $uids[] = $records['uid'];
}
$latestaccountuid = $account->uid;
$latestorderuid = $uids[0];

$message = "Latest account id:".$latestaccountuid." .Latest order uid:".$latestorderuid;

if ($latestaccountuid == $latestorderuid) {
watchdog('FALSE', $message);
//return FALSE;
}
else {
watchdog('TRUE', $message);
//return TRUE;
}


texts: site is logging me out when navigate to different page?

texts:
A few things have been going on since upgrading my vps from one cpu to two and the providers explained they had to set me up on an older kernel, something about my set up not compatible on normal kernel for upgrade.

Anyway just when the site has gone live and I'm out advertising it, I came back only to notice it keeps logging me out when I navigate around.

Somehow I think this also has something to do with upgrade and with my having a subdomain because when I did the upgrade my site.com was still loading but my drupal.site.com was not until they did the switch. Then I couldn't log in as admin so found the .htaccess file had recreated itself in my drupal folder with upgrade so I had to delete it in order to log in at all. It's a long story but in order to have clean urls had to do away with .htaccess and configure settings and httpd.conf instead.

I'm not sure what to do as the site is now live and I keep watching for member signups. At the same time if it is going to cause all sorts of problems, I want to fix them now before anyone joins.

My question is what could be forcing me to log out considering all of the above? the urls are all consistent.


texts: CKEditor custom plugin to add richcombo select list

texts:
I am building a CKEditor plugin for Drupal 8. I've done plugins that show a button in the editor toolbar, but this one should render a select list. The list is not showing up in the configuration page (admin/config/content/formats/manage/basic_html), so I cannot add it to the toolbar. I can't see what I am missing.

This code works fine on a standalone CKEditor setup (outside of Drupal):

'use strict';

CKEDITOR.plugins.add( 'widgets', {
  requires : ['richcombo'],

  init: function( editor ) {
    console.log('In CKEDITOR.plugins init()');
    var config = editor.config;

    editor.ui.addRichCombo('widgets', {
      label : "Widgets", // label displayed in toolbar
      title : 'Insert Widget', // tooltip text when hovering over the dropdown
      multiSelect : false,

      // use the same style as the font/style dropdowns
      panel : {
        css: [ CKEDITOR.skin.getPath( 'editor' ) ].concat( config.contentsCss ),
      },

      init : function() {
        // dropdown options:
        // this.add( VALUE, HTML, TEXT );
        // VALUE - The value we get when the row is clicked
        // HTML - html/plain text that should be displayed in the dropdown
        // TEXT - displayed in popup when hovered over the row.
        this.add( "
Widget 1
", "Widget 1", "Widget 1" );
        this.add( "
Widget 2
", "Widget 2", "Widget 2" );
      },

      // this function is called when a row is clicked
      onClick: function(value) {
        editor.insertHtml(value);
        console.log(value);
      },
    });
  }
});

The above code was placed in /modules/custom_widgets/js/plugins/widgets/plugin.js

Besides, /modules/custom_widgets/custom_widgets.module is empty, /modules/custom_widgets/custom_widgets.info.yml sets "ckeditor" as a module dependency, and this is the code of my D8 plugin, in /modules/custom_widgets/src/Plugin/CKEditorPlugin/Widgets.php:

<?php

/**
 * @file
 * Definition of \Drupal\custom_widgets\Plugin\CKEditorPlugin\Widgets.
 */

namespace Drupal\custom_widgets\Plugin\CKEditorPlugin;

use Drupal\ckeditor\CKEditorPluginInterface;
use Drupal\Component\Plugin\PluginBase;
use Drupal\editor\Entity\Editor;

/**
 * Defines the "Widgets" plugin.
 *
 * @CKEditorPlugin(
 *   id = "widgets",
 *   label = @Translation("Widgets")
 * )
 */
class Widgets extends PluginBase implements CKEditorPluginInterface {

  /**
   * {@inheritdoc}
   */
  function getDependencies(Editor $editor) {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  function getLibraries(Editor $editor) {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  function isInternal() {
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  function getFile() {
    return drupal_get_path('module', 'custom_widgets') . '/js/plugins/widgets/plugin.js';
  }

  /**
   * {@inheritdoc}
   */
  public function getConfig(Editor $editor) {
    return [];
  }
}

Any help is greatly appreciated, as all examples I could find were about adding a custom button or a custom contextual menu entry, but nothing about combo lists.


texts: How to check the modules installed date?

texts: How to check which modules was installed on what date?  I am using Drupal 6. I can not find any answer in Google.


texts: Vote Up/Down Widget only visible to admins

texts:
I have installed the Up/Down Vote module under Drupal 6.x and it is working fine when I use it under my admin login.  However other logged-in users do not see the widget.

Below are screens of the installed modules and all of the config I can access.

What do I do to enable for other users?


texts:
I use this PHP snippet on the server side after a submission of a webform:

function mymodule_webform_submission_insert($node, $submission) {
 // $node will give you the node id of your webform
 // $submission will give you the id of your data which you inserted in web form
 $sid = $submission->sid ? $submission->sid : FALSE;
 if($sid){
   dsm($sid); // yes, the sid is shown after a submission
   if(!isset($_SESSION['mymodule'])){
     $_SESSION['mymodule'] = array();
   }
   $_SESSION['mymodule']['webform_id'] = $sid;
   drupal_add_js(array('mymodule' => array('webform_id' => $_SESSION['mymodule']['webform_id'])), 'setting');
 }
}

... and then on the client side I have ths JS snippet:

(function ($) {

     Drupal.behaviors.mymodule = {
    attach: function (context, settings) {

                var sid = Drupal.settings.mymodule.webform_id;
                console.log('the submission ID is: '+ sid);
        }
    };

}(jQuery, Drupal));

.. but the variable sid is "undefined" in the console (after a submission) no matter what I try to do. Can anyone see what I am doing wrong?


texts: How do I change certain page titles in Drupal, most notably the create new account, log in, and request new password tab headings?


texts: Disable double confirmation for Simplenews

texts:
I have a simplenews registration block on my site. If people sign up for a newsletter, they receive a mail with a confirmation link. When they click on the link they come to a page with another confirmation button, which must be clicked if you realy want to register.

Thats the default behavior called Double-Opt-In in simplenews.

What I want for registration ist that you receive a mail with a confirmation link, if you click it you come to the page which says something like 'You are registered!'. I want to disable the need of this second button, any ideas?

Thanks in advance


texts: How to get the uncached version of request headers?

texts:
We need to programmatically get the request headers using the mymodule_preprocess_page hook. To do this we tried the following, however, because we have CDN, Varnish, and Drupal Cache all enabled, the request headers are being pulled from cache so if in the initial request the header value we are looking for is set to false, it is false in all requests afterwards.

How can we get the uncached request headers?

Here is what we tried, but it didn't work.

function mymodule_preprocess_page(&$variables) {
  $request = \Drupal::request();
  $request_hdrs = $request->headers;
  // This is the one that seems to be always caching. (true or false)
  // my-header is coming from another server.
  $request_custom = $request->get('my-header');

  // log this for troubleshooting
  \Drupal::logger('mymodule')->log(RfcLogLevel::INFRO, 'header value'.$request_custom);

  if($request_custom) {
    // based on the header value, redirect to another url.
    $response = new Symfony\Component\HttpFoundation\RedirectResponse('www.myurl.com');
    $response->send();
    return;
  }

}


texts:
Is it possible to programmatically register a custom entity type as an Organic Groups group? I know I can add a group field to the entity type using the UI, but I would like to register the entity type as a group in the module code. Users should be able to add such an entity and then these entities should automatically be a group and the checkbox should be hidden from the administration form.

Of course I could 'check' the checkbox and hide it by altering $form and $form_state, but I feel it is a better practice to register it as group in the entity type definition, if possible at all.


texts: Easily add term to vocabulary with long list of terms

texts:
A client is complaining about the way on how to add terms to a vocabulary in taxonomy.

It's a long list of terms and sub-terms. So I told him when he adds a term he can select a Parent term and set the weight in the Relations block.

But the list of parent terms is long and not very clear. Isn't there a way to make this more user friendly? Maybe search in parent terms or .. ?


texts: Render page with theme wrapper from custom controller?

texts:
I've created a page layout using panels in the Drupal admin UI (page_machine_id). I'm trying to load that page into a custom controller like so and render one of the variants (Drupal 8):

public function profile() {
    $page = \Drupal\page_manager\Entity\Page::load('page_machine_id');
    $variants = $page->getVariants();
    $pageVariant = end($variants);
    $viewer = new \Drupal\page_manager\Entity\PageVariantViewBuilder();
    $pageArray = $viewer->view($pageVariant);
    return new Response(render($pageArray));
}

This renders the page content correctly, but does not include the theme wrapper around it and I can't figure out how to get the theme to show.

Thanks.


texts:
The Chosen module no longer get applied to Webform select fields with the most recent updates to a Drupal Commerce 2.0 site that I am working on. I am using Chosen version 7.x-2.0-beta4+1-dev (part of Commerce Core) and Webform version 7.x-4.0-beta1. After further investigation, I noticed that the library for Chosen is not being loaded on pages with webform selects. I did some research and found the article below suggesting that, "...there is a bug in [the] Webform [Module] that removes all the #pre_render callbacks from select elements when used in Webforms..."

https://www.drupal.org/node/2122061[1]

Looking through the Webform module's source code I found the following method which should render select components. Although it doesn't appear that anything is missing.

/**
* Implements _webform_render_component().
*/
function _webform_render_select($component, $value = NULL, $filter = TRUE)

I did come across another post that mentioned CKeditor causing issues, but after updating to 4.4.4 (from 3.6.7) , the results were the same. I have also configured Chosen to apply to ALL select selectors for testing purposes.
Has anyone found a solution or work around to this issue?


texts:
I just inherited a Drupal 7 website from another agency. The site was fairing well in our DEV and STAGE environments. The problem started occurring when we switched DNS over to our PRODUCTION site.

We have all the nodes (from the same content type) that seem to be "randomly" disappearing.

I've made sure to upgrade the core to the latest and any security fixes for any modules that are being used.

I was wondering what I could do to troubleshoot this issue - as I'm exhausting all my efforts and nothing seems to be working.


texts:
After install Taxonomy Access and access the basic admin content page "admin/content"
with an admin role called "publisher" which has the authority to administer the content the page does not show any content at all as in the attached image
even i created admin views to show specific content and it works well with the "publisher" role, any reason why the basic admin page is empty !?


texts:
I am having issues sending a POST request to create a node with Drupal 8 Core REST. Here are the steps I have went through several times. Note that these steps are in effort to produce a working example, I am not worried about the security implications as of yet.

Install latest version of drupal 8
Enable all core web services modules (HAL, HTTP Basic Authentication, RESTful Web Services, Serialization)
Go to permissions page. Find RESTful Web Services permissions and allow delete, get, patch, and post for all users. Find Node Article permissions, allow create, delete and edit for all users.
Launch Dev HTTP Client in Chrome. Input the following request:

After hitting Send, I receive the following message which I believe should be a 201 and not a 200 if a node were to successfully be created. I think the REST part is working, its just I cant seem to figure out how to get POST to create a node.

I am having trouble finding any documentation on making post requests to Drupal 8 REST. Insight into how to construct these requests so that Drupal can parse them successfully would be very helpful.


texts:
Possible Duplicate:
  How do I use Webform fields in a view?

I have a webform with 3 fields.Name,Loan amount,and profession.I redirect the form submission to a custom url which is a view page and am passing the sid i.e. submit id as a  token.Now i want to access the 3 values in views using contextual filters.I need help on this.any help will be appreciated.Thanks.


texts: Send to 403 page if all Selection Rules aren't met for all Variants

texts: I have a couple Variants set up for my node type with Selection Rules via Page Manager. If for some reason none of the rules are met for all the variants, it renders the node using the default node system instead of sending to a 404.  How can I send the user to a 403 page instead?


texts: How to filter view content by book outline?

texts:
How can a book page include a view (as a block) that lists all items of a specific content type that are also part of the book outline and are children of the current book page?

This is intended to show a grid of teasers (videos), navigated by a table of contents.

A contextual filter may be the way to go, but unfortunately, there’s not much in the way of book outline information available to select from.

I could imagine a workaround where I would create a taxonomy that mirrors the book outline and use that for the contextual filter. If possible, I’d like to avoid this redundancy, though.

Any idea how this would work?


texts: Print module's default setting is annoying

texts:
We often use the print module to create PDF of nodes; most of the times, it works out-of-box.
For our requirements, however, one thing that makes me very annoyed is its default settings.

When the print module is installed, the "Print friendly page" option is enabled for all the available content types, even though it is required only for a few content types. Every time I have to disable it manually by editing the individual content type edit tab form.

Is there a global option I can use to disable the option for all the content types, and enable it for the content types I really need it?
Does this way works for everyone, or did I miss anything?


texts:
Is there any way to show all the upload fields on a node?
Right now a user has to upload a single file and then get another field and so forth. Instead I would like to show the max number of permitted upload fields.


texts: How to add a class to a checkbox in a form?

texts: I would like to add the class 'checkradios' to checkboxes in an entity form, is it possible do this in the theme layer?


texts: How to display the un promoted to front page link in teaser mode contextual links?

texts:
I'm trying to enhance the frontpage teaser's contextual links. On front page content we click on Configure link, and it shows Edit, Delete and Node Export by default.

I'd like to also add a Unpromote from/to frontpage link.

Is this possible? If so, how can it be achieved?


texts:
I have a taxonomy, say 'Unit'. Besides the name of the Unit, there is a field called 'SubUnit'. All users in my Drupal site have assigned a Unit.

On the node add forms (and on the Views, for filtering), I would like to get only the 'SubUnits' corresponding to the assigned Unit per user. That is, only visualize on the dropdown list 'his' units.

I have seen around this answer, but it's from 2011, maybe there is an updated and easier way to do it? there is no way to create a filter based on the results of a view? (i can pass Únit as contextual filter and get its subunits)


texts: How to add a colon for Webform field labels?

texts:
I know you can add colon in field.tpl.php for site wide content type node fields, but looks like it's not webform field related.

And webform doesn't have any webform-field.tpl.php type of templates to edit?

By default, webform fields has no colons e.g. Full Name label needs to be Full Name:.

I know I can add that with CSS, e.g.

.form-item label:after {
  content: ":";
}

But this won't work because I need colons to be printed in subnmitted email template too.

And emails dont support ::after ::before CSS I think, or there is complication with various web email providers, etc.

I know you can add a manually : when creating the label name and like that for every field (but its tiring if multipage long forms), but that's impractical for various reasons like e.g. https://www.drupal.org/node/1922550


texts: Multilingual translation for anonymous users

texts:
I have enabled i18n module in my site. But it didn't work properly for me.

I have created two quizzes in three languages with english language as a source language. I am using language dropdown block for switching to different languages.

The problem is that, the quizzes are translating to corresponding language well for administrator and authenticated users. But the quizzes are not properly translated for anonymous users. It remains in english only.
   Same problem for basic page also.

I have checked permissions but I found there is no issue in permission. Please tell if anybody knows solution for this. Thanks in advance.


texts: Programmatically remove an entity reference field

texts:
I am new to Drupal 8. What I want to achieve is to delete the taxonomy term (entity reference) and its association from the nodes where it is referenced. Node has multiple languages, revisions, content moderation, etc.
Below is the code I used to delete the association from node followed by delete the term.
$tid = 20;
$nodes = \Drupal::entityTypeManager()->getStorage('node')->loadByProperties(['field_mycollections' => $tid]);
foreach($nodes as $node){
      if(null != $node) {
          $collections = $node->get('field_mycollections')->getValue();
          $index = array_search($tid, array_column($collections, 'target_id'));
          $node->get('field_mycollections')->removeItem($index);
          $node->save();
      }
}
$term = Term::load($tid);
$term->delete();

$tid is again coming from foreach (foreach $tids as $tid {}).
This way, the term is deleted, node association is removed. Now the issue is, when I edit the translated node (say spanish) through UI, I am getting error "Non-translatable fields can only be changed when updating the original language.". If I resave english version (default language) through UI and then saves spanish version, it saves.
I assume, this is because "removeItem" method removes the term from node__field_collections table but not from the node_revision__field_collections table.
Can anyone please help me here on resolution?


texts: Composite Primary Key for a Content Type

texts:
Is there any way to create a composite primary key or equivalent for a content type in D7? I really need a way to stop the duplicate content for the same content type.

Thanks


texts: How to setup Customer profile manager, so user has possibility to select their existing billing address?

texts:
I have entity form to which I've added Customer profile reference (commerce_customer.module) which has the reference to user's Customer Profile - Billing information (which by default consist Postal address).

However it is always showing blank postal address fields to enter new Postal address without possibility of using/selecting the existing one.

Is there any way that I can configure Customer profile manager widget so user can select his address from already existing one (by choosing either from the list or entering a new one)?


texts:
How can i load the user page (profile) in a block or in the body of a another page?
I tried to put a block in the user page but does not work.
Any ideas?
Thanks.


texts: Migrating database from Mysql to SQLite in Drupal7

texts:
I want to convert my site's database from MySQL to SQLite. So i got the DBTNG-Migrator and tried using it. I changed the settings.php files as follows -

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'driver' => 'mysql',
      'database' => 'db_name',
      'username' => 'root',
      'password' => 'password',
      'host' => 'localhost',
      'port' => '',
      'prefix' => '',
    ),
  ),
  'dest' => array (
        'default' =>
          array (
            'database' => 'drupal/sqlite_db/.ht.sqlite',
              'driver' => 'sqlite',
              'prefix' =>'',
            ),
        ),
);

I had changed the permissions of the folder sqlite_db so that it is writable by others. Then i go to the configuration page of DBTNG and go to Migrator database check. There i choose the destination as sqlite and mysql as origin. When i hit check i get a lot of warnings and this error-

PDOException: SQLSTATE[HY000]: General error: 1 no such table: accesslog:
INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp)
VALUES (?, ?, ?, ?, ?, ?, ?, ?); Array ( [0] => Migrator [1] =>
admin/structure/dbtng/migrator/check [2] => http://localhost/drupal/admin
/structure/dbtng/migrator/check [3] => 127.0.0.1 [4] => 1 [5] =>
Rz1A861RV5SIJ4jGM_CqnriF-L6nhUObQ5ILcNV4iMo [6] => 900 [7] => 1352377186 )
in statistics_exit() (line 93 of /var/www/drupal/modules/statistics
/statistics.module).

If i change the destination to sites/default/files/.ht.sqlite there is a different error -

block does not existing in dest
PDOException: SQLSTATE[HY000]: General error: 1 no such table: block: SELECT
b.* FROM {block} b WHERE (b.theme = :db_condition_placeholder_0) AND
(b.status = :db_condition_placeholder_1) ORDER BY b.region ASC, b.weight
ASC, b.module ASC; Array ( [:db_condition_placeholder_0] => gtt
[:db_condition_placeholder_1] => 1 ) in _block_load_blocks() (line 727 of
/var/www/drupal/modules/block/block.module).

Both the tables accesslog and block are present in the database. Do i need to manually create all the tables here?
I have 184 tables in the db. How can i solve these issues.


texts:
I have a Drupal commerce webshop with two main products having multiple variations.

Those variations have labels containing HTML tags.

My problem is when I add to cart HTML tags are displayed in text...
Does someone know how to solve this ?

Thank you


texts: How to convert the Drupal View Query to MySQL query?

texts:
There are some views in my site. I have configure the setting to fetch the Views query. I want to convert those query to MySQL query to run & getting the result directly.

How can I do this?


texts:
I have just inherited a Drupal 8 codebase from someone, and upon getting it all set, I noticed that there is an open-link icon against every link (see screenshot), and every link is opening in a new tab. Is this a settings type behaviour?

I am three hours old to Drupal (come from React background).


texts:
My site is on http://drupal8.local/. How do I get the drupal8.local part of that URL?

Url::fromRoute('<'current'>') or base_path() returns the path parth of the URL; For example, for http://drupal8.local/a/b/c/d/e/f, they return '/a/b/c/d/e/f' when I just need to get 'drupal8.local'.

How can I get that part of the URL?


texts: Creating a Drupal user with user_save doesn't automatically join an existing CiviCRM contact record

texts:
I have a custom module that will create a Drupal user programmatically using user_save as follows:

  //set up the user fields
  $fields = array(
    'mail' => $email,
    'pass' => $password,
    'name' => $username,
    'status' => 1,
    'init' => $email,
    'access' => REQUEST_TIME,
    'roles' => array(2 => 'authenticated user'),
  );

  //the first parameter is left blank so a new user is created
  $account = user_save('', $fields);

I have first done a check using the CiviCRM API to make sure that if an existing contact is already in the database and has a Drupal account associated with it, we don't create a new one. Also I check to make sure the email address isn't registered from the Drupal side.

The problem is, when I create a new user, it is not linking up to an existing CiviCRM contact record that uses the same email address and I'm ending up with a duplicate contact record.

How can I force the site to link to an existing record if the email address is a match?


texts: Use form_alter to change description under reset password field for user_pass form

texts:
I'd like to change the text below the reset password field. I took a look at this answer, and it talks about changing the button, but I need a bit of help to change the text.

Here is the debug output and it looks like I need to access #description

[name] => Array
        (
            [#type] => textfield
            [#title] => E-mail
            [#size] => 60
            [#maxlength] => 254
            [#required] => 1
            [#default_value] =>
            [#description] => A password reset message will be sent to your e-mail address.
            [#input] => 1
            [#autocomplete_path] =>
            [#process] => Array
                (
                    [0] => ajax_process_form
                )

This is how I would change the button:

function footheme_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'user_pass') {
   $form['actions']['submit']['#value'] = t('reset password');
   print "boom";
 }
}


texts: In a Views template, how can I mimic the effect of "Link this field to its taxonomy term page"?

texts:
I have a view of taxonomy terms that displays Fields, including Taxonomy term: name and Taxonomy term: Term ID.

I am attempting to use a views template to customize the output of this view.

In the Views UI, if I click Taxonomy term: name, I can get an option to Link this field to its taxonomy term page.

I would like to use the link generated by this option in my views template output.

However, when I dpm($row), only the term name and term ID are returned.  How does Views create the link to the taxonomy term, and how can I mimic this in my template file?


texts: request new password link does not work if not logged in

texts:
When anonymous user comes to the site, the login block offers a link to "Request new password".  This returns the user to the home page with no action happening.  If a user is logged in, using the same link brings one to the reset password by email link.

What I want is a form taking username and returning email address with a link to the one time password change.


texts:
I have a custom module that do some processes after a user entity is updated. I need to just trigger a timestamp update so my module can act on them accordingly. I wrote a script that is going through all my ~350000 users and doing this :

$loaded_user = user_load($uid);
user_save($loaded_user);

While this is working, the process is taking too long to finish. Is there a faster way to do this?


texts:
I'm looking simple markup field (similar to Field Hidden which would provide dummy field which can place hold some html code (such as field title and its description without showing any field).

So basically something equivalent to this Form API element:

$form['markup'] = array('#markup' => 'foo bar');

but as a proper field (so no custom coding or styling involved) which can be attached to Entityform.


texts: How do I create a custom exposed filter?

texts:
I try to create a custom exposed filter in views 3 of Drupal 7

Where can I learn about how to create a custom exposed filter for Views 3 and D7?

Someone put some code example in the URL above, but it seems it is in views 2!? Does any one know how to make it in Views 3.

In the module:

/**
 * Implements hook_views_api().
 */
function modulename_views_api() {
  return array(
    'api' => 2,
    'path' => drupal_get_path('module', 'modulename') . '/inc',
  );
}

/**
 * Implementation of hook_views_handlers() to register all of the basic handlers
 * views uses.
 */
function modulename_views_handlers() {
  return array(
    'info' => array(
      // path to handler files
      'path' => drupal_get_path('module', 'modulename') . '/inc',
    ),
    'handlers' => array(
      // register our custom filter, with the class/file name and parent class
      'modulename_handler_filter_filtername' => array(
        'parent' => 'views_handler_filter',
      ),
    ),
  );
}

function modulename_views_data() {
  $data = array();

  $data['node']['filtername'] = array(
    'group' => t('Custom'),
    'real field' => 'my_custom_filter_field',
    'title' => t('My custom filter'),
    'help' => t('Some more detailed description if you need it.'),
    'filter' => array(
      'handler' => 'modulename_handler_filter_filtername',
    ),
  );

  return $data;
}

In modulename_handler_filter_filtername.inc

class modulename_handler_filter_filtername extends views_handler_filter {

  /**
   * Options form subform for setting exposed filter options.
   */
  function value_form(&$form, &$form_state) {
    parent::value_form($form, $form_state);

    // get list of years from database
    $query = db_select('node', 'n');
    $query->addExpression("FROM_UNIXTIME(n.created, '%Y')", 'year');
    if (isset($this->view->filter['type'])) {
      $query->condition('n.type', $this->view->filter['type']->value, 'IN');
    }
    $result = $query->orderBy('year', 'ASC')
      ->execute()
      ->fetchAllAssoc('year');

    $years = array(
      '0' => t('All'),
    );
    foreach ($result as $k => $v) {
      $years[$k] = $k;
    }

    // create form element with options retrieved from database
    $form['value']['year'] = array(
      '#type' => 'radios',
      '#options' => $years,
      '#default_value' => end($years),
    );
  }

  /**
   * Alters Views query when filter is used.
   */
  function query() {
    // make sure base table is included in the query
    $this->ensure_my_table();

    // retrieve real filter name from view options
    // this requires 'real field' filter option to be set (see code above)
    $real_field_name = $this->real_field;
    // get the value of the submitted filter
    $value = $this->view->exposed_data[$real_field_name];

    // finally, alter Views query
    if (is_numeric($value) && $value != 0) {
      /*
        Having several custom exposed filters, make sure subsitution patterns
        (e.g. :filtername_value below) don't match across different filters.
        I spent some time figuring out why all my filters had the same value.
        It looks like the query skeleton is built first and then all replacements
        are made in bulk. Prefixing value with filter name looks good imo.
      */
      $this->query->add_where_expression($this->options['group'],
        "FROM_UNIXTIME(node.created, '%Y') = :filtername_value",
        array(':filtername_value' => $value));
    }
  }
}


texts: Correct Way For Rules to Update A Users Purchased Pay-Per-Node Value In Users Balance Account

texts:
Using Ubercart Pay-per-Node module, a user purchases posting Node rights to upload a set amount per order. Generally a Balance is set in their Ubercart Purchase history but on my testing site no such Balances are amended. Possibly because I haven't or cannot get the Rules to show to correct structure and data, After many hours, I'm totally confused and not sure if it can even be done now.

I have the Pay-Per-Node set as a Feature within a Product, but cannot seem to find the said data in Rules.

It works aok if I manually add purchase units via the Ubercart backend admin.

Can someone shed some light on this please on the general Rules process and how a Balance would or should be updated in ones account?  I cannot see any relevant data details in the mySQL to help.


texts: Add extra information across cart/checkout/invoice in Ubercart

texts:
I would like to add extra information in cart, checkout and invoice in Ubercart. Idea is to show discount ammount that was implemented by hook_uc_cart_alter - I want to add above the Total Price, Another value - Discount, and show that discount on all forms.

I can add extra values by appending in hook_tapir_table_alter, but i am not sure if this right way, or is it only for viewing purpouse? Is there other more reliable method ?

Thanks.


texts: Get the ID of the group to which the node is added

texts:
Using Drupal 8 with the Group module, I have an action that is run via hook_node_insert that needs to know the group id of the group that the node is added to.
Im using this code to get the group id of the group(s) that the node is a member of:
function get_groups_from_node($nid) {
  $group_ids = array();
  $ids = \Drupal::entityQuery('group_content')
    ->condition('entity_id', $nid)
    ->execute();

  $relations = \Drupal\group\Entity\GroupContent::loadMultiple($ids);
  foreach ($relations as $rel) {
    if ($rel->getEntity()->getEntityTypeId() == 'node') {
      $group_ids[] = $rel->getGroup()->id();
    }
  }

  return $group_ids;
}

When I feed the nid of an existing group node into the function, it works, but not for the newly created ones that are cought by the hook.
function mymodule_hook_node_insert (NodeInterface $node) {

  $nid = $node->nid->value;
  $groups = get_groups_from_node($nid);

}

The information does not seem to be available at the time of node creation - I guess the hook fires before the node is actually added to a group?
Should I use another hook, or is there a better way?


texts: extend $.fn or Drupal.ajax.prototype.commands for calling javascript after ajax callbacks

texts:
Use case: You call ajax, and want to call some custom javascript (js) with some parameters as part of the response.

Issue: Two different solutions exist.

Questions:

is there a preferred method or is this just a matter of style?
are there differences in the benefits of each approach?

(there are a few questions eg 1 which supply different methods)

(Sorry these two examples may not be perfect - so feel free to edit)

Extend JQuery: $.fn

php:

$commands[] = ajax_command_invoke(
  NULL,
  'mymodule_command',
  array($data)
);

js:

$.fn.mymodule_command = function(data) {
  // dialog ajax id
  var dialogAjaxId = data.id;
  var blah = JSON.stringify(data.values);

};

Extend Drupal: Drupal.ajax.prototype

see this example

php:

$commands[] = array(
  'command' => 'mymodule_command',
  'arguments' => array(...),
);

js:

Drupal.ajax.prototype.commands.mymodule_command = function(ajax, response, status) {
  console.log('mymodule_command', ajax, response, status);
  console.log('arguments', response.arguments);
};


texts: Intercept data of a field of a node Drupal 8

texts:
How can I intercept the data of a field when the user add's a node?

Below is the use case:

The user can input a address in a field, when the user submits the node.
Drupal should make a rest request to the google maps distance matrix api. Then the returning value should be posted in that node. I can find enough example modules to export data from drupal through rest but not the other way around.


texts: For a Drupal multi-site installation, is there any method to activate a module for all sites on the system at once instead of logging into the admin for each site individually?


texts:
I want to check if user exists based on some profile2 field. I have tried the following. Works fine. I want to know if it is proper or not. If it is not proper, is there any other way around?

function checkUserExistsByProfile($company_id){

        $query = 'SELECT field_somefield_value
        FROM {field_data_field_somefield} AS fn
        WHERE fn.field_somefield_value  =:rids';
        $result = db_query($query, array(':rids' => array($company_id)));

        $field_value = $result->fetchCol();
        return count($field_value);

    }

Please suggest.

UPDATE:

I have tried solutions suggested by  Mołot, Bulat as follows.

Profile Field name is field_ngouniqueid

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'user')
->fieldCondition('field_ngouniqueid', 'value', (int)$company_id, '=');
$results = $query->execute();

$users = user_load_multiple(array_keys($results['user']));

But users is an empty array always. But it has a record with value $company_id

Solution:
it should be $query->entityCondition('entity_type', 'profile2')


texts: How to display multiple multi-value fields inside one for loop?

texts:
Here is what I've come up with but it seems I can't do [key] to increment along with the body for loop...

 {% for key, item in content.body if key|first != '#' %}

{{ item }}

  {{ content.field_text.[key] }}

   {{ content.field_image.[key] }}

{% endfor %}


texts: Cached "Page not found" for anonymous users

texts:
My site's drupal version is 6.19. There are always logs like the following.

the recent log entries shows

type: page not found
location:http://www.example.com/display.html
referrer:
  message: 500.shtml
  severity: warning
  hostname: 95.64.11.29 or others (maybe search engine robot IP)

The URL and the content is right, but when the anonymous user accesses it, it returns the "Page not found" page. Anonymous users have the permissions to access content.

The cache_page table contains the following header for http://www.example.com/display.html:

Content-Type: text/html; charset=utf-8 HTTP/1.1 404 Not Found

Why is the page being cached as "404 Not Found", when it actually exists?

When I access http://www.example.com/display.html as an anonymous user, the site shows "page not found"; when I clear the cache, anonymous users can access the page.
How can I correct the cached content generated by search engine bots?


texts:
I have Drupal module with a form and it works just fine (/my_module/search)
I need menu hook for my_module/search/% and to be auto submitted and repopulate the form with the argument form url. So basically I need the same form just with the argument form URL submitted.


texts:
I almost titled the question "Hello world of theming a module", as that quite well describes what I'm looking for. I feel maybe it's to much "slang" though. There's probably a lot of people out there in this situation. I know a lot about programming, but very little about (Drupal) theming.

So, for a trivial "Hello world" module like:

function _modules_page_callback($data) {
  return '' . $data . '';
}

What does the equally trivial version look like, that moves the HTML into the theme-layer?


texts: Using Views' Contextual filters in a Panel for one taxonomy term

texts:
I have one taxonomy term, Country, which is linked to another, People. One people is from one country.

How can I make a view in my Panel, using Contextual filters, in order to show the specific view I prepared for "Country" ? I tried to use contextual filters to do so, and it works when I use the preview with the Country ID - but not in Panels.


texts:
I need to display an image in the page footer using  tag. In my page.tpl.php I have  the following block.

<?php print t('Copyright'); ?> &copy; <?php echo date("Y"); ?>

I can`t use print $logo since I can use another image for the logo.


texts: Adding jQuery to a view (exposed filter: search terms)

texts:
I'd like to add some jQuery (for search highlighting) to my Drupal 7 Views with exposed search terms filter. The point is that when a user clicks a search terms (or terms) the jQuery then highlights those words they searched for in the returned results.

I created the following preprocess function in my template.php file:

    // add jquery.highlight-5.js just to the search views page
    function themename_preprocess_node(&$variables) {
      if(arg(0) == 'node' && arg(1) == '8' && arg(3) == null) {
        drupal_add_js(drupal_get_path('theme', 'themename') .
'/js/jquery.highlight-5.js');
      }
    }

But as I put this together I realize I don't know what to put in arg(1) for my Drupal View. Anyone know how to find out the 'nodeid' of the Drupal View?


texts: How do I implement hook_form_alter() in a module?

texts:
I am trying to alter a form for the Question content type, whose ID is node-question-form.
I set up a module and tried to implement hook_FORM_ID_alter(), but it's not invoked. Even the simplest implementation as the following is not working.
function constellator_form_alter(&$form, &$form_state, $form_id) {
  echo "alter the form";
  exit;
}

I have been stuck with this since this morning. Nothing is working for me.


texts: Is there a way to get the list of the available services in  Drupal 8?


texts: different form state redirects in a hook_form_alter

texts:
i have the code in template.php:

THEMENAME_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'answer_node_form' && !isset($form['nid']['#value'])) {
    //dpm($form);
    // redirect after we created a new node
    $form['actions']['submit']['#submit'][] = 'node_reference_redirect';
  } elseif ($form_id == 'answer_node_form' && isset($form['nid']['#value'])) {
    // redirect after we have made changes to a node - node/17/edit
    $form['#submit'][] = 'node_save_reference_redirect';
  }
}

function node_reference_redirect($form, &$form_state) {
  $form_state['redirect'] = 'node/' . arg(1);
}

function node_save_reference_redirect($form, &$form_state) {
  $form_state['redirect'] = '/index.php';//$form['field_answer']['und'][0]['nid']['#default_value'];
}

function named node_reference_redirect() works as expected - it redirects after creating a new node: node/add/content-type, but the 2nd redirect - when we are doing changes to an existing node: node/[nid]/edit, when we press "save" it doesn't redirects to a index.php for example... Can't figure out what's wrong. Any ideas? Thanks


texts: How can I programmatically change the active theme?

texts:
How can I programmatically change the active Drupal 8 theme?

In Drupal 6, we used the following code.

global $custom_theme;
$custom_theme = 'garland';

In Drupal 7, we used hook_custom_theme().

In Drupal 8, what's the correct way to do this?


texts: How do I add fields to an existing custom entity? (repost)

texts:
I have a custom entity that isn't showing the ability to add fields. I need to add a field to it, and I want to do it through the UI. The entity was created in a custom module, which I can modify.
How can I make the entity fieldable?
Here is the annotation from the entity class:
/**
 * Defines the Quiz entity.
 *
 * @ingroup qwizard
 *
 * @ContentEntityType(
 *   id = "qwiz",
 *   label = @Translation("Quiz"),
 *   bundle_label = @Translation("Quiz type"),
 *   handlers = {
 *     "storage" = "Drupal\qwizard\QwizStorage",
 *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
 *     "list_builder" = "Drupal\qwizard\QwizListBuilder",
 *     "views_data" = "Drupal\qwizard\Entity\QwizViewsData",
 *
 *     "form" = {
 *       "default" = "Drupal\qwizard\Form\QwizForm",
 *       "add" = "Drupal\qwizard\Form\QwizForm",
 *       "edit" = "Drupal\qwizard\Form\QwizForm",
 *       "delete" = "Drupal\qwizard\Form\QwizDeleteForm",
 *     },
 *     "access" = "Drupal\qwizard\QwizAccessControlHandler",
 *     "route_provider" = {
 *       "html" = "Drupal\qwizard\QwizHtmlRouteProvider",
 *     },
 *   },
 *   base_table = "qwiz",
 *   revision_table = "qwiz_revision",
 *   revision_data_table = "qwiz_field_revision",
 *   admin_permission = "administer quiz entities",
 *   entity_keys = {
 *     "id" = "id",
 *     "revision" = "vid",
 *     "bundle" = "type",
 *     "label" = "name",
 *     "uuid" = "uuid",
 *     "uid" = "user_id",
 *     "langcode" = "langcode",
 *     "status" = "status",
 *   },
 *   links = {
 *     "canonical" = "/admin/structure/qwizard/qwiz/{qwiz}",
 *     "add-page" = "/admin/structure/qwizard/qwiz/add",
 *     "add-form" = "/admin/structure/qwizard/qwiz/add/{qwiz_type}",
 *     "edit-form" = "/admin/structure/qwizard/qwiz/{qwiz}/edit",
 *     "delete-form" = "/admin/structure/qwizard/qwiz/{qwiz}/delete",
 *     "version-history" = "/admin/structure/qwizard/qwiz/{qwiz}/revisions",
 *     "revision" = "/admin/structure/qwizard/qwiz/{qwiz}/revisions/{qwiz_revision}/view",
 *     "revision_revert" = "/admin/structure/qwizard/qwiz/{qwiz}/revisions/{qwiz_revision}/revert",
 *     "revision_delete" = "/admin/structure/qwizard/qwiz/{qwiz}/revisions/{qwiz_revision}/delete",
 *     "collection" = "/admin/structure/qwizard/qwiz",
 *   },
 *   bundle_entity_type = "qwiz_type",
 *   field_ui_base_route = "entity.qwiz_type.edit_form"
 * )
 */

This question was originally posted here, but was closed:
How do I add fields to an existing custom entity?
I tried all the suggestions there. Thanks.


texts: How to change path of file from absolute to relative?

texts:
In my website, some of the images are having absolute path of old server .../old_directory/sites/, but now I have changed my server, I want that these images should be picked from /sites/ path of my current instance.

Anyone has any suggestion??


texts: views with different content types case studies

texts:
For my first Drupal site ever I was thinking of filling the frontpage with a view that has different content types. I'm even mixing page content type with a custom event content type so now I have problems with styling the view because of different content fields in different view items.

Does anybody know of case studies where people have succesfully mixed custom with stock content types because this is becoming a nightmare.


texts: Are Drupal .php files associated with a module cached?

texts:
I am wondering if they are, as that would explain why a simple change to one of my variables in my config.php file is not showing up in the DOM.

Here is what is making me suspect this.

In my fls_price_calculator_2012 module in my includes directory I have a file called config.php.

I am trying to change my $START_DATES_OPTIONS_COMBINATIONS['Specialty Tours'] variable to look like the following:

$START_DATES_OPTIONS_COMBINATIONS['Specialty Tours']['Surf Camp - Saddleback College'] = array('June 29, 2014', 'July 6, 2014', 'July 13, 2014', 'July 20, 2014', 'June 28, 2015');

Simply adding June 28, 2015 as a last option to the array.

The php file is included in my .module file for the module, following this line:

include_once('includes/config.php')

in my fls_price_calculator_2012.module file.

The variable itself is added into a hidden <input> variable in the DOM in the same .module file like so:

$tour_start_dates = '<input type="hidden" id="tour_start_dates" etc...>'
foreach ($START_DATES_COMBINATIONS['Specialty Tours'] as $key => $value){
  //populates the above created input with the keys and values
}

once it is all loaded in the DOM, I search via the Javascript console for the #tour_start_dates element but I get the only the old value for Surf Camp - Saddleback College and I don't understand how that is happening.


texts: I installed drupal 8 using composer, which installed at location /var/www/html/drupal8/web. I updated apache root directory to this location, which allows me to access the site at mysite.com (rather than mysite.com/drupal8/web). However, when I login to the admin console of drupal, none of the admin links work, such as content, structure, configuration, etc. All of these links are trying to use mysite.com/drupal8/web/.... which no longer works. Removing "drupal8/web" will allow me to access the associated sections of the site. Content on the site works correctly, but I'm unsure how to correct the administration links. Any help would be greatly appreciated.


texts: render($content) puts comment form above markup - why?

texts:
In my node--blog.tpl.php file, I have the following code:

<?php if ($teaser):?>
    <!-- Do some stuff -->
<?php else:?>
    <!-- A little HTML -->
    <?php print render($content);?>
<?php endif;?>

When I load up a blog page, the comments form is actually above the content.  This isn't some CSS quirk - it's above the content in the HTML structure.

How have I managed that, then?  Can anyone suggest a way to ensure the comments form appears in its rightful place, below the content?


texts: submit handler not working when using hook_form_alter

texts:
I am using hook_form_alter to add validation and submit handlers to the registration form:

<?php
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'user_register_form') {
    $form['#validate'][] = 'blah_register_validate';
    $form['#submit'][] = 'blah_register_submit';
  }
}
?>

They were both working fine until I added the following hook:

<?php
function MYMODULE_user_login(&$edit, $account) {
  drupal_goto('user');
}
?>

The validation function still works but the submit function gets bypassed completely - it doesn't get called at all by form_execute_handlers() in form.inc. As soon as I remove hook_user_login, it works again. Anyone have an idea why?

Update:

hook_user_login() gets called by user_login_finalize() in the User Module. Unfortunately,  this happens before my submit function gets called - so obviously when I use drupal_goto() the submit function will never get called. Can anyone confirm if I am adding the submit handler correctly, is there another way?


texts:
I recently installed Drush 8.1.2 from the tarball distribution available on Github and composer install-ed it (this is after trying to use the .phar to very similar ends).

Oddly, whenever I try to run drush from my shell (with or without subcommands), I get no output for a while, then drush just keeps printing Killed over and over, every few seconds.

Running ps aux | grep drush reveals dozens of spawned drush processes; simply sending an interrupt via ^C doesn't make the Killed stop. Because the processes spawn about as quickly as I can kill them, don't respond to killall, and cause surprisingly large amounts of when inputting commands, I have to reboot the system to kill the processes.

The same thing happens with the .phar version. This is not an issue with drush available via apt, but that's drush 5, which is horribly outdated. The same thing happens with drush-8.1.1, the previous release. This also occurs when installing globally via:

$ composer global require drush/drush:dev-master

According to my host's monitoring tools, this also sends my CPU usage skyrocketing up to about 70% until reboot, as well.

I'm on an otherwise brand-new Ubuntu 16.04 VM, with Drupal 8 installed.

Update: I've now tried the snippet at drush.org (below) on my laptop (running OS X 10.11, 8GB RAM) as well as on a much larger cloud instance with similar CPU and RAM specs, running Ubuntu. The out-of-memory error persists on this new box, but the installation succeeds without issues and produces a working drush on my laptop.

# Download latest stable release using the code below or browse to github.com/drush-ops/drush/releases.
php -r "readfile('http://files.drush.org/drush.phar');" > drush
# Or use our upcoming release: php -r "readfile('http://files.drush.org/drush-unstable.phar');" > drush

# Test your install.
php drush core-status

# Make `drush` executable as a command from anywhere. Destination can be anywhere on $PATH.
chmod +x drush
sudo mv drush /usr/local/bin

# Optional. Enrich the bash startup file with completion and aliases.
drush init

I suspect that drush requiring more than 8GB of RAM for normal operation isn't expected behaviour; it's probably pointless to spawn boxes with higher-performance CPU and RAM configurations at this point.

Notes:

I've allowed PHP to allocate 384M of RAM in my php.ini -- the process still respawns and prints Killed, all while making my system lag intensely.
as much as I'd like to bring out strace, the lag on my system is a major impediment. Keystrokes take a second or two to register as long as the processes are spawning.
This particular box has PHP 5.6, but the issue is also present on a box running PHP 7.0.


texts: custom module date formatter for publication date

texts: I have a Drupal 8 contrib module AP Style Date that provides a formatter for dates to conform to the AP Style Guide date rules. When using the module Publication Date, this formatter does not come up as an option. The AP Style Date does come up in views and in managing field display for other date types. Is there a modification that needs to be made to the AP Style Date module or something in the publication date that needs to be modified?


texts:
I  am having a taxonomy problem that I can't figure out and my searches haven't helped. Basically, I have created a taxonomy to tag my pages and I can use this field with views etc without any problem. However, when I have created links to those taxonomy terms, the page is coming up as empty (except the term is listed at the top).

If I use /all, then it seems to be working without problem.

So, this works: /taxonomy/term/all

this doesn't: /taxonomy/term/17 (though that term does exist)

this doesn't /taxonomy/term/17/all

In addition, I am using the taxonomy menu module. If I add a new term, it shows up in the menu, but if the counter is enabled, they all show up as "0."

(Drupal 6)

slowly going crazy....

Thanks


texts: Gallery Formatter ( jQuery Gallery )not working in some nodes due to 403 error in thumbnail

texts:
I'm using Gallery Formatter module in a node type. My problem is that just in some nodes the module seems not to work. The images are loaded, when you click on a thumbnail the main image changes, but the infinite carroussel is not applied to the thumbnail images and the direction arrows are not generated (images below).

This is how the gallery should look like:

This is how the gallery looks like (just in some nodes):

I inspected the elements to see the differents and looks like the carroussel styles are not applied.

The propper structure is:

...

...

...

         ...

And the defectuous structure is:

...

...

...

         ...

I've checked the font code and the js and css of the module are properly loaded in both nodes:

@import url("http://mysite.example/sites/all/modules/galleryformatter/gallerystyles/greenarrows/greenarrows.css?o5448l");
@import url("http://mysite.example/sites/all/modules/galleryformatter/theme/galleryformatter.css?o5448l");

 ...

I can't find the difference that makes the gallery work in one node and not the other one.
They are nodes of the same type, generated the same way, they have no significant differences.
If i inspect the js It looks like there is an image returning a 403 error:

  http://mysite.example/sites/default/files/styles/thumbnail/public/85114_10.jpg/p/itok/TeF8kbN
  Failed to load resource: the server responded with a status of 403
  (Forbidden)

Which seems to be the root of the problem since I've found the same error for some thumbnail in the few cases where the gallery seems not to work.

I'm not suere what causes this 403 error, may be a problem with image styles?
Is it possible to avoid the Gallery Formatter crash when this happens?


texts: What is wrong with my custom Entity form validation?

texts:
I add

public function validateForm(array &$form, FormStateInterface $form_state) {
}

to MymoduleMyentityForm.php which starts with

namespace Drupal\association\Form;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;

Then I run the form and when I submit it, I get this error: Uncaught PHP Exception Drupal\Core\Entity\EntityStorageException: "Entity validation was skipped." at /Applications/MAMP/htdocs/JdP8/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php line 770

Any idea why?
What am I doing wrong?