texts: How to switch OG group members in bulk to another group

texts:
D7. I have Organic Group (OG) installed. Out of the approximately 150 groups on my website, one is sticky and titled "Welcome New Members." It has about 2,000 members.
Recently, a problem developed with that group only and a user gets a 500 error when posting. Another kind of error is "The website encountered a difficulty. Please... blah blah."

The other groups seem to be working fine.

I could be wrong, but it seems to me that the easiest way to fix this is to create another group and transfer all the group members, along with their posts to the new group. Then I could delete the original group and its content.

Looking at the data base table "og_membership" I see that all members of all groups are mixed together in the same table.

I need to extract those nodes and users that belong to that one group. I guess a dump of selected users and nodes based on the group ID could do the trick. But how do I upload them back into the same table with a different gid or etid so they also belong to the new group? Or is there a way in the data base to "search and replace" a group ID (gid) with another?

I have tried the following formula but I am being told it is the wrong syntax (etid is the entity ID:)

update [og_membership] set [etid] = replace([etid],'[776]','[10177]');

Any pointer would be greatly appreciated. :)


texts: Authentication error when deploying site's content

texts:
I have two sites site01 and site02 each having some content (book pages) in them. I want to copy the content of site01 to site02 without overwriting its existing content.
I am using Deploy module to do this, by following this procedure.
Everything is OK until I click "Deploy" on site01. When I do I get the following error:
I see that someone else got a similar error, but I was not able to understand the solution applied by the person. Does anybody have any clue about this?
UPDATE
I tried same scenario using two different machines in LAN, and it worked fine! I was able to do the deployment smoothly.
But, on same server it is failing. I don't know what may be the reason.


texts: Where does drush store the different module versions for a multisite installation?

texts:
I wonder where the different module versions are kept on a multisite installation.

Before I (re)discovered drush, I had several more sites sharing the core code
 and sites/all/modules a symlink to a common modules dir.

On upgrading core I set that link in the new sites/all dir.

And then I started using drush. So when I do drush up in the sites/my1stsite dir and it updates the modules, how can the other my2ndsite still have the old modules? (and be able to drush up-date itself?)


texts: Select Panel Node Layout on Node edit form-further question

texts:
I have a site where the content creators have the ability to select between 4 node layouts before they are able to add content to the node. I have managed to figure out how to do this via this post.

Select Panel Node Layout on Node edit form

However, the layout only takes effect when the node is saved. I was wondering if there is a way to select the layout from the field as the answer in the link suggests, but then have it automatically load the layout with out having to save.


texts:
I am using the Print module.

I have enabled the node/%node template in panels and used a selection rule to select my specific node type and added fields into the panels regions etc. That all works fine.

I need to be able to use the Print module to see a print-friendly version of this node. However when I go to /print/[nid] I just get a completely blank page.

So is it possible to have a printer friendly version of a panels page? i.e in a template file or another method?


texts: How to add custom field to the user profile according to its role in Drupal 7?

texts:
i need to add some custom fields to the user. These fields are not the same for every user, but they vary according to their roles. How can i do that?

I saw that you can add some custom fields in the configuration menu but those cannot be differentiated according to the role.


texts: Rendering a content of a page using tpl php

texts:
Our custom theme has page.tpl.php which takes care of the whole site. But I have a page which actually needs to display a collection of nodes. I have written a custom page--url.tpl.php where the url is the path for the page in question. But this way overrides the whole page.tpl.php.

What would be best method so that I just need to display my custom content when my page.tpl.php calls <?php print render($page['content']); ?>? Will modules be the only way? from which I will create my block and add it to the page?

Note: We like to have COMPLETE control over our page. And we are getting rid of views from our site.


texts: How do I ensure new dependencies added to the info.yml of an existing enabled module are picked up?

texts:
I've added
dependencies:
 - core/jquery
 - core/drupal

to mymodule.info.yml
(where mymodule is my module name).
How do I ensure Drupal "sees" these new dependencies?
For example, can I clear the cache, drush cr ?
Or is there another drush command to run or something else to do?
When does Drupal read the info.yml file? When module enabled - yes - but what other times?
I would prefer a command to get it to read that file rather than uninstall my module and reenable my module as this could be inconvenient with regard to config/content needing to be re-setup.
Thank you.
Background
I'm working on solving a problem where anonymous users see Uncaught ReferenceError: Drupal is not defined in console, based on a solution  that adds the dependencies I mentioned above: Anonymous Users See Uncaught ReferenceError: Drupal is not defined In console.
Potentially related: jQuery not Loading for “Anonymous” Users


texts: How can I trigger the EntityTypeEvents::UPDATE event?

texts:
I tried to trigger event on each entity update. This is my src/EventSubscriber/MySub.php

    use Drupal\Core\Entity\EntityTypeEvents;
    use Symfony\Component\EventDispatcher\EventSubscriberInterface;

    class MySub implements EventSubscriberInterface{

      public function onEntityTypeUpdate(EntityTypeEvents $event)  {
            drupal_set_message("returned from onEntityTypeUpdate");
       }

      public static function getSubscribedEvents() {

          $events[EntityTypeEvents::UPDATE][] = array('onEntityTypeUpdate');

    return $events;
  }
}

This is my services.yml file

services:
  custom_sub:
    class: '\Drupal\custom_sub\EventSubscriber\MySub'
    arguments: ['@entity.manager']
    tags:
      - { name: 'event_subscriber' }

But the message is not displaying after updating the content or content type. Please guide.


texts: How to place facet block in views page header? (not regions)

texts:
I've created a search with Search API module and Facets module. I've added two taxonomy term name fields to my search index and created two facets for those fields. Just for testing I've placed the facet blocks in my main content area, and fulltext search and faceted filtering are working as expected.

Now I want to place the facet blocks in the header of the view, and not in a page region. I've checked the block source file and ID of the facet blocks is facet_block. Facet blocks are derived blocks, so my best guess was that the block ID should be facet_block:MACHINE_NAME_OF_FACET.

I've added a Global: Rendered entity - Block to the header of the view. As block ID I've entered the schema from above, e.g. facet_block:museum for my "museum" facet.

However, the facet block doesn't show in the views header. (The same facets placed via block layout still work fine.)

Can anybody tell me how to render facet blocks inside a view header?

(I'm looking for a no-code-solution, without preprocessing or editing templates)


texts: PDOException: SQLSTATE[HY000] [2002] Connection refused Upon Drupal 7 Installation

texts:
I have already installed LAMP in my Ubuntu 18.10 server. I have also downloaded Drupal 7 files. But after I navigate to http://10.0.34.74/drupal-7.65/ in my browser. The error below occurs:

Error
The website encountered an unexpected error. Please try again later.

PDOException: SQLSTATE[HY000] [2002] Connection refused in lock_may_be_available() (line 167 of /var/www/html/drupal-7.65/includes/lock.inc).

Below are the configuration settings I edited in my settings.php file :

$databases = array (
             'default' => array (
                          'default' => array (
                                       'database' => 'pizzago',
                                       'username' => 'root',
                                       'password' => '1234',
                                       'host' => '10.0.34.74',
                                       'port' => '',
                                       'driver' => 'mysql',
                                       'prefix' => '',
                                       ),
                          ),
              );

Do I have to put something on the port?
I have make sure that MySQL is running. Actually I have log in on it using:

 MySQL -u root -p

I have also created an empty database named pizzago. Where am I missing?

P.S:

The password above is not true.

UPDATE :

When I tried changing database host to localhost, since my database is just within the server. Another error occurs:

 PDOException: SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' in lock_may_be_available() (line 167 of /var/www/html/drupal-7.65/includes/lock.inc).


texts:
How do I figure out which PHP function is called from a Drupal path/URL (e.g. "/mysite/?q=flag/flag/like/&destination=node/1&token=xyz")?

Thx in advance!


texts:
I get notification for TB Sirate Starter update despite that I use new fresh drupal installation, never setup TB Sirate Starter. This repeated many times and on many of my new drupal project.

I only tested it in the past on my local server. But I always setup fresh and clean drupal installation.

Is there any soultion


texts: Theme specific Drupal modules? Possible?

texts:
Anyone know if it is possible to have Drupal modules enabled/active only when a current theme is present?

Working on a feature where I only need one module to be enabled when the site is accessed via a specific theme controlled by the ThemeKey module in Drupal 7.


texts: drush and connecting with a non-localhost database

texts:
I am attempting to update a Drupal website and the associated modules with drush 7. The MySQL database resides on another server within the same network. When attempting to run any command where drush would connect with the MySQL database the following error is returned:

  Command pm-list needs a higher bootstrap level to run - you will need
  to invoke drush from a more functional Drupal environment to run this
  command.

Running drush pml --debug I see that drush appears to be reading the correct database credentials:

  Executing: mysql --defaults-extra-file=/tmp/drush_EDQIvN
  --database=dlc_ode --host=correct.internal.ip.address --silent  < /tmp/drush_ltZVnl

But on the line just below:

  ERROR 1045 (28000): Access denied for user
  'root'@'ip-ip.of.localhost.us-west-2.compute.internal' (using
  password: YES)

Neither the user root nor the AWS domain is correct. I am new to drush and am not certain what is overriding the database credentials in the settings.php file.

I can connect with MySQL from the command line with no problem using mysql -u username -p. Drupal itself connects fine.

Any suggestions of what I am overlooking will be appreciated.

Thank you.


texts: Drupal substracts 2 hours from the CCK date field when saving. Why?

texts:
I have defined a CCK field of the date type with an Hour granularity
it looks like this:

When I save it, it subtracts 2 hours from each one.

I think it is caused from the set timezone.

My current timezone is "Europe/Madrid."

  Mac-Pro:~ usuario1$ date
     martes, 13 de diciembre de 2011, 17:33:23 CET

The server's timezone is the same.

  Server:~ root$ date
     mar dic 13 17:32:43 CET 2011

Why is Drupal doing this?

The dates have to be the same just as I type them.


texts: Is there a way to test instantiating a service in an isolated unit test?

texts:
I have the a service definition in a custom Drupal 8 module which I would like to test. I've managed to test everything else in my module with unit tests, so my whole suite runs in a fraction of a second, and I'd like to avoid introducing anything Simpletest-based. (My CI infrastructure wouldn't support it anyway.) Is there any way to test my service definition in an isolated unit test? Here's my service definition:

my_module.services.yml:

services:
  my_module.client:
    class: Drupal\my_module\Client
    factory: Drupal\my_module\Client::create
    arguments: ['@state', '@config.factory']

The manual test I've been performing is to run this Drush command:

drush ev 'var_dump(\Drupal::service("my_module.client")->_serviceId == "my_module.client" ? "PASS" : "FAIL");'

That's a sufficient smoke test while I'm developing. For a regression test, I'd also like to assert that the class returned is an instance of the correct type.


texts: How to add an ascending row number (using some token) in front of each row in Views?

texts:
I can't figure out how to make a soccer league table that would look like this: http://prntscr.com/8va7h7

This is how the table looks now: http://prntscr.com/8va8eu

Everything works but I don't know how to show the team position on the table. Is there a way to make this work using tokens so they count the number of rows?


texts: How to not print a Menu Block if a Menu Block exists

texts:
I've been using a whitelist/blacklist PHP script to control the display of 2 different menu blocks, and its becoming bloated.

Menu_block 1 is the primary menu.
Menu_block 2 is the supplementary menu.

I'm trying set the block visibility for Menu_block 1 via PHP - IF Menu_block 2 exists return FALSE, else return TRUE.
Print Menu_block 1 unless Menu_block 2 exists.

PHP visibility for Menu_block 1

<?php
  if(isset($block = module_exists('menu_block', 'block', '2')) {
    return FALSE;
  }
  return TRUE;
?>

I'm not even sure if this is actually possible.


texts: Should I use all these template files or will theme hooks do the job?

texts:
Since templates are slower than theme hooks, I'm wondering if I might be able to use them for my application. Here's what I'm trying to do:

Right now I have about 10 content types on my site and I've created a separate template file for each because I want each to have a <div> with a specific 'id' so I can target those pages with CSS. I also give each a separate template file so I can determine on a case by if they should have a secondary sidebar or not.

Those are the only reasons I'm using all these template files.

Two Part Question:

Can what I'm trying to do be reasonably accomplished with theme hooks, and if so, how?


texts: How to get custom field labels translated

texts:
I want to get the labels and descriptions of custom fields translated in Dutch, but no matter what I try they always remain in English (the language I use for creating them). I hope my steps below makes sense because I don't understand why it isn't working.

What I do is I create a field (with the site language set to English) in either a profile (using the Profile 2 module) or directly in the account.

Then I edit the field and use the translate button (provided by Field translation in i18n) to add a Dutch translation. But if I then switch the site language to Dutch, the field label and description are still in English.

If I edit the field again (with the site language still set to Dutch), the translate tab now shows the Dutch translation with status original and English as "niet vertaald" or not translated. If I edit the Dutch translation, I'm presented with the English version.

I can change that again to the Dutch text and it will show correctly (in Dutch). Nice, but when I switch the site back to English the field remains Dutch! When I edit the field, the translate tab shows the Dutch text in the English language, but the status for English is back to original.

I cannot make heads or tails of this. Am I completely missing something or is this perhaps a bug? I'm using Drupal 7.


texts:
I'm trying to submit a module to packagist.org so that it can be directly installed via composer. I've followed the necessary steps and created the composer.json as required. Now when I'm trying to submit the module to packagist.org its giving me the following error:

  The vendor is already taken by someone else. You may ask them to add
  your package and give you maintainership access. If they add you as a
  maintainer on any package in that vendor namespace, you will then be
  able to add new packages in that namespace. The packages already in
  that vendor namespace can be found at drupal


texts: How to filter on taxonomy term but only match one field on the node, where two fields (primary and secondary) both use the same vocabulary

texts:
Using Drupal 7 Views > Contextual Filter, how can I filter on taxonomy term but only match one field on the node, where two fields (primary and secondary) both use the same vocabulary?  I have a vocabulary "Category" and I have organization nodes that can reference a category in either a Primary or Secondary field.  The concept is that organizations can primarily serve one topic of interest but can secondarily serve others.

I thought I had great, early success, but on closer inspection, the term is matching against both fields (like taxonomy ought).  I have had no luck in setting up only the primary field as the contextual filter for a term name, nor have I been able to first filter on taxonomy and then filter on the primary field.

What am I missing here?

Edit: Hmmm.. I wonder if it's because content fields in Views maybe match on "value" and category fields present themselves as "tid"?

Note: I don't think this is the same as Drupal 7 views contextual filters taxonomy name 2 fields using same vocabulary but I do love the way that one was titled!


texts:
I noticed that, in the current page crumb module, there is no .module file.

Why is that no longer necessary? As a test I added a .module file, but it seems it is not being read.  Where can I find documentation about using or not using a .module file in Drupal 8?


texts:
I have created a custom field list, but of all documentation I have read, I can't find a clear example on how to add data on the list.

The code so far is this:

/**
 * Adds field.
 */
function _my_installed_fields() {
  $t = get_t();
  return array(
    'my_dropdown_list' => array(
      'field_name' => 'my_dropdown_list',
      'label' => $t('Select an item'),
      'type' => 'list_text'
    )
  );
}
/**
 * Adds instances.
 */
function _my_installed_instances() {
  $t = get_t();
  return array(
    'my_dropdown_list' => array(
      'field_name' => 'my_dropdown_list',
      'type' => 'list_text',
      'label' => $t('Select an item'),
      'widget' => array(
        'type' => 'options_select'
      ),
      'display' => array(
        'example_node_list' => array(
          'label' => $t('Select n item'),
          'type' => 'list_text'
        )
      )
    )
  );
}

I need to let only one value to be selected and saved.


texts:
UPDATE:
After investigting this I have concluded that the problem concerns ALL new image styles, but "old" ones are still working. Old ones are the built-in (e.g. thumbnail) and one image style of my own.

Also:
I use the patch to create the in core/modules/image/image.module, if it is a factor.

I have run a really strange problem: New image styles I have created don't work on one server (of course the production). I have tried to re-create the image styles, flush the caches etc ad nauseaum, but still the same thing. I have an exactly similar (apart the dimensions) image style that works just fine. The file permissions and owners are the replica of the working one...

The effect is Focal Point Scale and Crop (working dimensions 550 x 250, non working 1290 x 400). And in the development it's working just fine.

Any ideas, anyone?

wbr
hank


texts: Content Filter based on Heirarchical Taxonomies

texts:
I have one taxonomy named "Project Parameters" with hierarchical select and another taxonomy names "Project Sub Parameters" with hierarchical select.

I Want to filter the content with those taxonomies like on selection of Project parameter display its sub parameters and click on sub parameters with ajax call i need content filter

I Had created view and with contextual filter i achieve that but that load the page. I want to do same functionality with ajax only, No page reload.

Is it Possible? Please Help Me.. I am stuck since last 2 days.


texts: How to customize better exposed filter template?

texts:
I'm creating a Drupal site with articles gathered around themes. I created a vocabulary named Theme, to which I added a field picture.

I created a view (named articles) in which I show my articles as a page and added an exposed filter on the theme. I then added Better Exposed Filter module to remove the apply button and apply the filter on selection.

My issue is that I would like to customize the filter to present it as the theme label and the theme picture. I found the template named bef-links.html.twig but was unabled to override it (I tried bef-links--articles.html.twig).

My questions are how can I override the bef template and how can I access my theme picture to customize my filter (is it necessary to do a preprocess to retrieve it ?) ?


texts: How can nested subdirectories and symbolic links be used without conflict with a multi-site Drupal installation?

texts:
My question is basically a reflection of the question found here (which unfortunately does not have a clear answer): http://groups.drupal.org/node/20604

Please note that this is not a question about multi-site setup, but it is rather a question about a complicated edge-case; please read through before jumping to suggestions. Also, take a look at the link above if you need more info.

Note also multi-site works generally fine, just not this case.

Some truths:

I am using symbolic links (on RHEL5 to be exact)
I am using Drupal 6.20
I am using Apache
I am using subdirectories (NOT subdomains, switching to subdomains is not an acceptable answer)
My Drupal site directories are nested two levels deep (e.g. /campus/bus, /campus/news)
The Drupal sites all use the same code base in the /campus directory
The Drupal sites all use different (their own) databases

In my case, there are dozens of sites, but the first conflict I noticed was as follows. There are two sites at urls such as the below structure:

drupal.drupalsite.com/campus/bus

drupal.drupalsite.com/campus/news

In the sites/[foldername] the respective folders are:

drupal.drupalsite.com.campus.bus

drupal.drupalsite.com.campus.news

The campus folder in the web root contains the Drupal install, and also the symbolic links, so in /var/www/campus there are e.g., news -> ./, bus -> ./.

On the 'bus' subsite, attempting to go to https://drupalsite.com/campus/bus/news makes Drupal confused. It seems to drop everything in the request after the last directory. e.g., drupalsite.com/campus/bus/news will instead resolve to drupalsite.com/campus/bus and drupalsite.com/campus/bus/news/headlines will return a 404 not found.

For another data point, I put a var_dump on $dir in the conf_path() function to see how many directories were being looked at for each request. For a non-conflicting URL, such as bus/undergraduate-programs I got the following:

drupal.drupalsite.com.campus.bus

However for a conflicting URL such as bus/news/headlines I get

drupal.drupalsite.com.campus.bus.news
drupalsite.com.campus.bus.news
com.campus.bus.news
drupal.drupalsite.com.campus.bus

There is a patch which could allow the multi-site setup to be done via sites.php instead of via the method of using symbolic links, however it would involve hacking core, and thus I am not willing to entertain it, though for reference it is here: http://drupal.org/node/231298#comment-3769752

To note, I also tried most of the suggestions in the original groups.drupal.org. thread as well as numerous hacks in .htaccess and my httpd.conf file, all to no avail.  Please comment if you need further information to answer the question.


texts: How can I use Entity API to integrate my entities with views?

texts:
I've set my entity up with a custom controller but I want views integration.  I tried to follow the entity_test.module example, but it's for one bundle.  I want to create 4 bundles for my entity.  When I check views it does not appear in the list.

Here is my code:

function module_entity_info() {
  $return['module_content'] = array(
    'label' => t('Module Content'),
    'module' => 'module',
    'entity class' => 'ModuleContentClass',
    'controller class' => 'EntityAPIController',
    'views controller class' => 'EntityDefaultViewsController',
    'base table' => 'module_content',
    'fieldable' => TRUE,
    'entity keys' => array(
      'id' => 'cid',
      'bundle' => 'type',
    ),
    // Make use of the class' label() and uri() implementation by default
    'label callback' => 'entity_class_label',
    'uri callback' => 'entity_class_uri',
    'static cache' => TRUE,
    'bundles' => array(),
    'bundle keys' => array(
      'bundle' => 'type',
    ),
    'view modes' => array(
      'full' => array(
        'label' => t('Full content'),
        'custom settings' => FALSE,
      ),
      'teaser' => array(
        'label' => t('Teaser'),
        'custom settings' => FALSE,
      ),
    ),
    'module_property' => array(
      'label' => t('Property'),

      'entity class' => 'Entity',
      'controller class' => 'EntityAPIControllerExportable',
      'fieldable' => TRUE,
      'bundle of' => 'module_content',
      'exportable' => TRUE,
    ),
    'module_agent' => array(
      'label' => t('Agent'),
      'entity class' => 'Entity',
      'controller class' => 'EntityAPIControllerExportable',
      'fieldable' => TRUE,
      'bundle of' => 'module_content',
      'exportable' => TRUE,
    ),
    'module_open_house' => array(
      'label' => t('Open House'),
      'entity class' => 'Entity',
      'controller class' => 'EntityAPIControllerExportable',
      'fieldable' => TRUE,
      'bundle of' => 'module_content',
      'exportable' => TRUE,
    ),
    'module_office' => array(
      'label' => t('Office'),
      'entity class' => 'Entity',
      'controller class' => 'EntityAPIControllerExportable',
      'fieldable' => TRUE,
      'bundle of' => 'module_content',
      'exportable' => TRUE,
    ),
  );

  return $return;
}

function module_entity_info_alter(&$entity_info) {
  foreach (module_content_get_types() as $type => $info) {
    $entity_info['module_content']['bundles'][$type] = array(
      'label' => $info->label,
    );
  }
}

function module_content_get_types($type = NULL) {
  $types = entity_load_multiple_by_name('module_content', isset($type) ? array($type) : FALSE);
  return isset($type) ? reset($types) : $types;
}

I think something is wrong with either module_content_get_types() or module_entity_info_alter because when I try to use dpm statements in those functions nothing is output.  Please advise on any changes that should be made to improve my entity definition.  If you need to see additional code I can provide that as well.


texts:
The document says Entity::create() takes

  "$values (optional) An array of values to set, keyed by property name"

as an arguement.

I also found snippets like

$term = Term::create([
    'name' => $term_name,
    'vid' => $vocabulary_name,
  ]);

and they worked.

But how exactly do you know what kind of values can be set in the array?
In the case above, where did people take the keys 'name' and 'vid' from?


texts: Mark only Event's start date on calendar?

texts:
I am using calendar module, I created a view of calendar type that showing the event start date and end date. I just only want to mark the start date of event (Like change the background color.). How to do that?

Currently showing like this :


texts:
I have added term reference field on one content type i want to alter that term reference list. I have search in drupal.org site but not information is find. Can any one help me how to alter the termreference list.

Present terms display like this : term1,term2

but i want to add another field data also like ex: term1(count-2), term2(count-3)

Term reference:


texts: inserting a date into database with JSONParser module

texts:
i have a json file

{
  "student":[{"firstname":"bharath","marks":"80","dateone":"13/09/2014 06:07:08","datetwo":"18/12/2016 09:08:05"},
        {"firstname":"purna","marks":"70","dateone":"17/03/2012 06:07:08","datetwo":"20/04/2017 09:08:05"},
        {"firstname":"ramesh","marks":"90","dateone":"23/11/2010 06:07:08","datetwo":"14/08/2009 09:08:05"}]
}

i'm mapping the json parser as

parser0 -> field_firstname
parser1 -> field_marks
parser2 -> field_dateone
parser3 -> field_datetwo

i'm able to get firstname and marks in database which are of type varchar but dateone and datetwo are not entered in database which are of datetime type.

Can Anyone please help !!!

Thanks in advance !


texts:
Background

I've installed the Bootstrap theme, created a sub-theme, edited it's INFO file, and the theme itself seem to appear fine while surfing at the site.

The problem

I went to this themes' Style.CSS file and added some CSS, but for some reason, Most (if not all) of the CSS I add requires the !important declaration at the end of each property... Any idea why all of these !important's needed? It is surly not the natural behavior of any theme...

Further details

The site is RTL.
I'm not sure if there is a connection but this problem might do with the fact that my new sub-theme is running online only to me, via the ThemeKey module which let's you associate a specific theme with a specific something (like users).


texts:
I am trying to hide a view block if it has one or less results, i am doing this using the MYTHEME_preprocess_views_view function.

Here is the code

// Removes product range if only one product is availiable!
if($variables['view']->id() == 'brand_product_range') {
  if(count($variables['view']->result) < 2) {
    // $variables['view']->destroy();
    // $variables['view']->setDisplay(false);
    // I want to hide block here!
  }
}

I managed to get the id of view block and number of results in the view, but I don't know how to hide the block, I tried the above methods but they are not working.


texts: Is there a way to add terms for the Spell Checker in editor to reference?

texts:
There are unique terms related to the industry that the spell checker might flag as incorrect.

We are looking for a solution for the client team to add the unique terms so they are not flagged as incorrect when spelt correctly and suggest this term for when it is spelt incorrectly.

Please help.


texts: redirect or rewrite /user/xx links to a module page

texts:
This should be easy to do, but its very hard to Google.

Within the admin and surrounding workflows, various links point to user/foobar. I have a different page to display users, say /faces/xx. I want to intercept (or rewrite) every url linking to user/foobar/ to faces/xx.

Pathauto lets you customize what paths user profiles have. If I set that to /faces/[user:uid], it will create aliases overriding my module router; so that faces/xx looks the same as user/foobar previously did. That is not what I want.

You can redirect users on login or other triggers. That is also not what I am looking for.

Most likely, I can override something in my module that intercepts user/foobar calls and does a drupal_goto('faces/xx'). Or there is a url_alter that I can override that writes out the user/foobar links. That, or something similar, is what Im looking for.

EDIT -- sample code from the module that generates the faces page

function faces_menu() {
    $items = array();
    $items['faces/%'] = array(
        'title'             => t('Face'),
        'access callback'   => true, // more complex in reality
        'page callback'     => 'faces_page',
        'page arguments'    => array(1,2),
        'type'              => MENU_CALLBACK,
    );
    return $items;
}
function faces_page($uid) {
    global $user;
    $output =  array(
        'faces-page' => array(
            'magic'     => voodoo($uid),
            '#theme'    => 'faces_pages'
        )
    );
    return $output;
}

and ofcourse theres a faces_theme() to match it.


texts: Make a rewritten field from Views work in autocomplete

texts:
I have a view which lists all the terms from a vocabulary (400+ terms) as an HTML list. The taxonomy names are rewritten to be output as links and have two arguments: the TID of the current term (the view appears as a block only on taxonomy term pages) and the TID of the taxonomy term that's being displayed/clicked. I did this in order to implement a taxonomy comparison functionality.

My problem is that I need to have an autocomplete field for the terms in the block, since I can't show all the 400+ items at once. I tried the Views Autocomplete Filters and Finder modules, but neither of these wants to integrate with the rewritten field or I simply haven't found a way to set them up. Every time I use the rewritten Taxonomy: Name field, it just behaves like a regular field linking to its own content.

How can I implement this functionality?


texts: Why does saving orders on admin screen always return a 404 error on first save?

texts:
In admin pages, add order (admin/commerce/orders/add), on saving order for the first time always gets a 404 error.  The url returned is missing the new order number: admin/commerce/orders//edit
The order is created.

Permissions seem OK.


texts: Using "Add another" field widget on non-fields (extra_fields or Entity API properties)

texts:
I would like to have a multiple-value property attached to an entity.

Currently, all of the properties are handled with field_extra_field and then stored in a single database table so we don't add the overhead of lots more tables. We don't need all of the neat features of Field API like versioning, so this works.

However, we do need one feature, the multiple value handling. Is there any way to get this without making a real field?


texts: How do I retrieve a string of taxonomy field terms associated with a node in Computed Field module?

texts:
I'm building a catalogue using Drupal 7 for a client (fashion retailer). For purposes of creating an efficient search system via Views, I have created a custom Computed Field (in plain text output) with the following concatenations:

$entity_field[0]['value'] = $entity->field_stylebrand['und'][0]['value'] . " " . $entity->title . " " . $entity->field_styledesc['und'][0]['value'];

Now, I want to ask how I can retrieve the taxonomy terms associated with this node (e.g. "black", "brown", and "navy" from vocabulary "colors") into a plain text string, simply separated by a white-space each (i.e. "black brown navy"), to add into my code?


texts: How to add custom attributes to a field?

texts:
I would like to be able to add a handful of custom attributes to a filefield.  The attributes will be used by other modules to manage the uploaded files.

For example:
Admin creates a filefield and adds a "youtube" attribute, meaning that videos uploaded to this filefield should get transferred to youtube.

I see that the database table content_node_field (which contains a row for each defined field) has a general_settings column that stores serialized data.  I am assuming this is a good place to store my custom field attributes.

Question #1:
How to set/get custom attributes stored under the "general_settings" column?

Question #2:
How to customize the filefield widget so that when admin defines a particular filefield, she can also select values for these custom attributes.

(I am using Drupal 6.)

Thank you!


texts: Clean URL not working on foreign language

texts:
I have migrated a drupal 7's website from current hosting to another new hosting. However, after the migration all seems well except the content with the foreign URL showed error. e.g

http://newDomain.com/article/新-ipad-可能会发布

  Bad Request

  Your browser sent a request that this server could not understand.
  Additionally, a 403 Forbidden error was encountered while trying to
  use an ErrorDocument to handle the request.

but in the original website there's no such problem. I can access the page without problem.

http://oldDomain.com/article/新-ipad-可能会发布

I tried to disable the clean URL on the new hosting, the page displays the content correctly. e.g

http://newDomain.com/?q=article/新-ipad-可能会发布

But once the clean URL enabled, the "Bad Request" error showed again. Wondering how to resolve this issue. Thanks!


texts: change customer email address in ubercart

texts: Is it possible to to change customer's email address in already created order? I have some customers who type wrong email address and complain that they did not receive any email... I tried to change it in customer's info but new email is not reflected in already created order. Thank you


texts: Drupal mail problem - Greylisting in action

texts:
I'm not sure how to solve this one and even not sure if it's a drupal issue or misconfiguration.

I'm running a Drupal site (7.22) and have huge problems with the sending mails. Most of the mails can't be delivered and I (the admin) get immediately a Mail Delivery System message:

  This is the mail system at host OUR_MAIL_HOST.

  I'm sorry to have to inform you that your message could not be
  delivered to one or more recipients. It's attached below.

  For further assistance, please send mail to postmaster.

  If you do so, please include this problem report. You can delete your
  own text from the attached returned message.

              The mail system

  : host
  USER_MAIL_HOST said: 450 4.7.1
  : Client host rejected: Policy
  Rejection-    Greylisting in action; Please try again later. (in reply
  to RCPT TO    command) Reporting-MTA: dns; OUR_MAIL_HOST
  X-Postfix-Queue-ID: D8047189CE9 X-Postfix-Sender: rfc822;
  admin@mail Arrival-Date: Wed, 26 Feb 2014 08:22:24 +0100
  (CET)

  Final-Recipient: rfc822; user@mail
  Action: failed Status: 4.7.1 Remote-MTA: dns;
  USER_MAIL_HOST Diagnostic-Code: smtp; 450 4.7.1
  < OUR_MAIL_HOST[OUR_MAIL_HOST_IP]>: Client host    rejected: Policy
  Rejection- Greylisting in action; Please try again later.

  The original mail content...

So to get a mail through this greylisting-filter requires sending the mail again, but I don't know whether it should be done via Drupal or via the mail server? The admins of the mail server told me to send the mail again, but this means, I have to tell Drupal to send each mail twice if it gets greylisted. This sounds pretty odd to me and I'm sure there is a clean solution. So any ideas? I'm sure I'm not the only one with such a problem.


texts: How to filter view results by currently logged-in user's (NOT AUTHOR'S) role?

texts: I have a view which displays node titles. Each node has different role assigned. Currently no matter what role user has, he sees all the node titles. How do I filter view results, so that it would only display nodes, which has the current user's role only?


texts: Can't find migrate setting in configuration

texts:
I have installed Migrate and Migrate Drupal in admin/modules.

But after installing these module, I can't find it in configuration.

Drupal version 8.


texts: How do you use drupal's devel krumo ddebug_backtrace()?

texts:
I've been trying to debug a weird bug on Drupal 7 for awhile. It happens randomly on my site as it's hard to reproduce. I'm able to finally get ddebug_backtrace() to run when the error happens. The error breaks all of my views on the site when it happens and throws the following error:

  Warning: include(/home/xxx/public_html/.tpl.php): failed to open stream: No such file or directory in theme_render_template() (line 1534 of /home/xxx/public_html/includes/theme.inc).

It's complaining that theme_render_template() can't find a template file as the variable given to the function is just .tpl.php.

I'm able to insert an if statement when this happens within that function as this:

  if($template_file == '.tpl.php') {
    ddebug_backtrace();
    print_r('
xxxx');
    print_r('TEMPLATE FILE: ');
      print_r($template_file);
    print_r('
');
  }

I'm able to get the debug output in krumo as shown below. I'm not exactly sure what I should be looking for. I just understand that each numbered line represents where that function was called within that order. But what I'm trying to look for is a blank variable of some sort which makes it output .tpl.php to give such an error.

Judging from the output, the culprit is the Views module, but I'm not sure where. What should I be looking for exactly?


texts: Children of children not appearing in book navigation menu

texts:
UPDATE: I should mention that this is concerning the Book Navigation Block

I'm using the book module to display children of a book in a side menu. It displays the title of the book and it's children just fine. However the children of the children don't appear even after clicking on the parent page.

I searched in the module settings for book navigation however I can't seem to find a way to display them.

Is there anything that could possibly affect what sub items are displayed in a book?


texts: Email webform results - only filled fields

texts:
Is there a way to email the webform results with only the filled (NOT empty) fields
I don´t want all the fields to be mandatory and 80% of my long long form will be optional and it´s very wierd looking to have all those fields listed in the results, if the fields remain empty


texts:
I have a text field in a content type which the user should be able to choose the color of the text.
Is there a module that I can install when creating the node you can choose the font color of the text field.


texts: Return and display the same form in Ajax Response

texts:
Summary:
I have an AJAX form. When I press the submit button, I want to build the same form, and return it for display again.
It's working fine if I display another form, but not with the same form.
Due to the nature of the problem I'm solving it would be convenient if I can just keep all my logic in one class, instead of having to build another controller, where all my business logic resides, and figure out how to call that controller. I'd be saving myself a lot of duplicate code.
Specifics:
<?php

namespace Drupal\mymodule\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Form\FormBuilder;

use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;
use Drupal\Core\Ajax\AppendCommand;
use Drupal\Core\Ajax\ReplaceCommand;

class MyCustomForm extends FormBase{

  public function getFormId(){
    return 'my_custom_form';
  }

  public function buildForm( array $form, FormStateInterface $formstate, $params = NULL){

    $form['my_entity_reference_field'] = [
      '#type' => 'entity_autocomplete',
      '#target_type' => 'node',
      '#title' => $this->t('Description'),
      '#description' => $this->t('Description'),
      '#default_value' => '',
      '#tags' => TRUE,
      '#selection_settings' => [
        'target_bundles' => ['my_content_type'],
      ],
      '#weight' => '0',
    ];

    if( $params['someparam'] ){

      $form['actions'] = [
        '#type' => 'button',
        '#value' => 'Submit 1',
        '#ajax' => [
          'callback' => '::firstCallback',
        ],
      ];

    }
    else
    {

      $form['actions'] = [
        '#type' => 'button',
        '#value' => 'Submit 2',
        '#ajax' => [
          'callback' => '::secondCallback',
        ],
      ];

    }

    return $form;
  }

  public function firstCallback(array $form, FormStateInterface $form_state){

    $val = $form_state->getValue('my_entity_reference_field');

    if( empty($val) ){

      $response = new AjaxResponse();
      $selector = '.new_form_container';
      $params = [
        'someparam' => false
      ];

      //THIS DOES NOT WORK, BUT IT WORKS WITH ANY OTHER FORM OR BLOCK:
      $content = \Drupal::formBuilder()->getForm('Drupal\mymodule\Form\MyCustomForm', $params);

      $response->addCommand( new HtmlCommand( $selector, $content ));

      return $response;

    }
    else
    {
      // Do something else here. This works fine.
    }
  }

  public function secondCallback(array $form, FormStateInterface $form_state){
    //I never get a chance to see this happening
  }

  public function submitForm(array &$form, FormStateInterface $form_state){
    //required but irrelevant
  }
}

I'm successfully loading and showing the form the first time by doing this in my theme file:
      $params = [
        'someparam' => true
      ];

      $variables['show_my_form'] = \Drupal::formBuilder()->getForm('Drupal\mymodule\Form\MyCustomForm', $params);

And then of course in the template I put {{ show_my_form }}
Again, this works if I call another form in the Ajax callback. But when I call the same form, I'm getting an error.
Am I missing something, or is it not possible to do what I'm trying to do?
(By the way, there is a similar question but it looks like they're using Drupal 7 or earlier...)


texts: I have a panel node and in it I added a node. Is there any way to make Panels load the translation of the node based on the user current language. This is easy to do with Views adding a filter, but I can´t see how to do it with panels (if possible).


texts:
"messages status" div not showing up when submitting page comment.

It's just a regular old page content type and "messages error" div shows up fine in same place... when I try to submit a comment and leave something blank.

But, if I fill everything in, then the comment goes through and shows-up, but it doesn't get me the expected "messages status" div (the div tag doesn't show-up there at all.)

After successfully submitting a comment, it goes to a URL something like this:
http://mywebsite.com/pages/2013/april#comment-4563

page.tpl.php - Looks good:  <?php print $messages ?>

It should say something similar to what another Drupal 6 site of my says:

  Your comment has been queued for review by site administrators and
  will be published after approval.

Someone else set the site up, so I have no idea when it stopped working... I'm going thru opening permissions and disabling various modules...

Does anyone have any clues or answers on why this would happen?

Any help, would be greatly appreciated... Thanks in advance!


texts: Forbid or autocorrect a certain term in a vocabulary

texts:
I am looking for a way to prevent a certain term to be created in a vocabulary. I don't know if there exists a contrib module with this functionality yet. Searches on Google did not deliver so far.

In fact, what I am trying to accomplish is this. In my native language we say "Brussel" but the English version is "Brussels". We have 20 editors and the one uses "Brussels" as a tag, another one uses "Brussel", which ends up with 2 seperate taxonomy overview pages. Yes, I could make it a guideline to use only "Brussel" as a tag, but overtime, they probably forget.

So is there a way that I can 'block' the use of "Brussels" as tag or autocorrect it to "Brussel" when they use "Brussels"?

Thanks for the help already!


texts: Changing user picture HTML output on user profile

texts:
How do I customise the HTML output for the user picture on a user profile? I can output it in user-profile.tpl.php with <?php print $user_profile['user_picture']['#markup'];?>. However this still leaves the original user picture output there too. How do I remove this? The answer in Disable displaying user picture in page--user.tpl.php won't work as that deletes $user_profile['user_picture'], which I'm using.

For an example of this, see http://dev.effectivealtruismhub.com/user/tom-ash . The top, left-floated image is the one I've manually output with  <?php print $user_profile['user_picture']['#markup'];?>. But the right floated one is the one that Drupal auto-generates, in the wrong place in the HTML to be positioned right. How can I remove this auto-generated HTML?


texts: How to change page not found page error message in drupal 8?

texts:
In my drupal 8 site I want to change my page not found page error message. Recently message showing like this "The requested page could not be found.". But I want show message like this "The requested page "/nvzmx,nvm,zxnv," could not be found.".

Note: my question is not about how to create a custom page for "page not found", instead I only want to change this actual error message.


texts: Access one field from another when using entities

texts:
On my Drupal 7 website, I have used Entity Construction Kit to create an entity that contains two fields: field_body_image and field_image_position.

This entity is then attached to a node.

I want to be able to access the value of field_image_position from inside field_body_image. How can I do this?

Steps I have taken to solve the problem:

I know that if you have the fields placed directly on the node (ie. so not using ECK) you can use field_get_items

However, this doesn't seem to work when ECK is involved.

Here is the code I am using in my template.php file

function [THEMENAME]_field__field_body_image(&$variables) {

    //Load the value of field_image_position
    $field_image_positon = field_get_items('node', $variables['element']['#object'], 'field_image_position');
    $image_positon       = $field_image_position['und'][0]['value'];

if ($image_positon == 'image_position_bottom' ) {
print 'Successful' //This is just a test to see if it works, the actual code will be different
}
 However, this does not work.

If I use Devel and do:

function [THEMENAME]_field__field_body_image(&$variables) {
kpr($field_image_positon);
}

Then I can see field_image_position located in the following:

$...['element']['#object']->field_image_position['und'][0]['value']

and

$...['element']['#items'][0]['value']

So how can I access it?

(using     $field_image_positon = field_get_items('node', $variables['element']['#items'], 'field_image_position'); causes a White screen of Death. )


texts:
I just have Drupal 7 and 8 installed in my localhost on Opensuse Leap. With Drupal 7 I cannot pass the clean urls test, however the site is completely functional. By clicking the links on the menu I can access localhost/drupal7/?q=admin/dashboard or localhost/drupal7/?q=admin/people (for example).

In Drupal 8 I can access the front page localhost/drupal8 but when I click some link, for example "Log in", I'm redirected to localhost/htdocs/drupal8/user/login. And I get an Apache 404 error. I don't understand why the server redirects to another directory when both installations are using the same configuration file.

I already tried all drupal.org apache-related tutorials without success.

Does anybody know how to solve this issue?


texts:
Is it possible with Feeds Tamper to find something in a string and replace all the string with something ?

Ex : I've got a .csv file and column 23 can contain something like:
"XL SSR FR RB" or "XL TL RB"

I need to find if this column contains SSR, and rewrite everyting to 1 or 0

Ex : "XL SSR FR RB"  => "1"
     "XL TL RB"      => "0"

Is this something the tamper module can do ?

If it's possible to convert it to boolean it's even better.

Thanks.


texts: Automatically create redirect for a file when the file is renamed?

texts:
When a file is renamed in the file upload widget and the other file is set to temporary, is there any mechanism in the background happening with the Redirect module to create a redirect from the old filepath to the new one that was renamed?

Example, foo.pdf in a file widget, I remove it and upload foo.pdf again. foo.pdf is now called foo_0.pdf - but links that linked to the old filename in the site still exist, therefore is it possible to get those redirected to this one?

edit: linking to related dilemma.


texts: How do I view the author of a comment in a view block?

texts:
I want to create a view block to display information about the author of a comment.

So I created a comment block and added the fields I missed.
My problem, what contextual filter does it need to be added to show only the author of the comment and not all the authors ?

In response to 4K4 :


texts: Why can't I find my uploaded file on disk?

texts:
I have a form with a file upload widget:

$form['myFile'] = array(
    '#tree' => false,
    '#type' => 'file',
    '#title' => t('Choose a file')
);

In the form validation handler, I upload the file and validate it with:

$validators = array(
    "file_validate_extensions" => array(variable_get("allowed_extensions")),
    "file_validate_size" => array(variable_get("max_image_size"))
);
$file = file_save_upload('myFile', $validators);
$form_state['file_storage']['myFile'] = $file;

Then, in the submit handler, I save the file using:

$file = $form_state['file_storage']['myFile'];
file_save($file);

This seems to work fine as I can find an entry for the file in the file_managed table:

+-----+-----+--------------+-----------------------------+------------+----------+--------+------------+
| fid | uid | filename     | uri                         | filemime   | filesize | status | timestamp  |
+-----+-----+--------------+-----------------------------+------------+----------+--------+------------+
|  49 |   1 | download.jpg | temporary://download.jpg    | image/jpeg |     5410 |      0 | 1350312114 |
+-----+-----+--------------+-----------------------------+------------+----------+--------+------------+

The problem is that I can't find the file anywhere on disk:

$ su -
Password:
# updatedb
# locate download.jpg
/home/me/Pictures/download.jpg

As you can see, the only download.jpg found is the one in my pictures folder which I passed into the form. I can't find anything on the server (in /var/www/). So where is the file? Is it a BLOB in the drupal database? Has it simply not been uploaded properly? If so, what did I do wrong?


texts: how to validate file size in drupal file upload

texts:
in here file validate extensions are working,but the file size validate is not working,i just need file size only, resolution doesn't matter,i want to restrict max file size to 1MB

 $form['photo']['file'] = array(
'#title' => t('Photo (Max size 2 MB)'),
'#type' => 'managed_file',
'#description' => t('xvxcds'),
'#default_value' => variable_get('photo', ''),
'#upload_location' => 'public://photo_images/',
 '#upload_validators' => array(
'file_validate_size' => array(1024*1280*800),
'file_validate_extensions' => array('gif jpg jpeg'),
// Pass the maximum file size in bytes
), );


texts: Views global text area replacement patterns for multiple values

texts:
I have a views block that is listing the similar nodes (based on taxonomy terms).

I want to show some custom text and the taxonomy term field's value(s) on the footer of the block.

I added Global: Text area to footer of the views and selected the Use replacement tokens from the first row option.

What I want to show is that My Term's other nodes and I'm using that for what I wanted:

  [field_my_taxonomy_term]'s other nodes.

It works correctly if the field_my_taxonomy_term field has only one value but if it has multiple values (multiple terms) it only shows the first taxonomy term value.

How can I show multiple values on Global: Text area?

This is the replacement patterns part of the Global: Text area:

[title] == Content: Title
[field_my_taxonomy_term] == Content: My Term
%1 == Content: Nid title
!1 == Content: Nid input
%2 == Content: Has taxonomy term ID title
!2 == Content: Has taxonomy term ID input


texts: How to pass PHP variables to Javascript/jQuery?

texts:
I found this way to send variables from PHP to Javascript.

Inside the template.tpl.php file, I have the following code.

<?php
  echo '
'.json_encode($variables).'
';
?>

Within Javascript, I have the following code:

(function ($) {
  $(document).ready(function() {
      var variables = jQuery.parseJSON($('.drupal-vars').html());
      //Remove if youwant to clean the code.
      $('.drupal-vars').remove();
  });

}(jQuery));

I found another solution, but it's more complicated, although it may be better architectured.

Is there a better way to do it?
How ugly is what I am doing here?

The tutorial goes like:

  I'll start by creating a hook_menu() implementation to establish a
  page callback:

<?php
function helper_menu() {

  $items = array();

  $items['js-vars'] = array(
    'title' => t('Javascript Variables'),
    'description' => t('Javascript Variables'),
    'page callback' => 'helper_page_callback_js_vars',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );

  return $items;

}
?>

  Next, I'll define the page callback:

<?php
function helper_page_callback_js_vars() {

  // include module javascript file
  drupal_add_js(drupal_get_path('module','helper') . '/js/helper.js');

  // define variables you'd like to pass to the DOM
  $js_vars = array(
    'js_vars' => array(
      'message' => t('Hello @username', array('@username' => $GLOBALS['user']->name)),
      'an_array' => array(
        'color' => t('red'),
        'name' => t('Eric'),
      ),
    ),
  );

  // pass variables to javascript
  drupal_add_js($js_vars, 'setting');

  // generate some page output
  return "TEST";

}
?>

  And here is the contents of the javascript include file I stuck in my
  module directory:

$(document).ready(function(){

  // debug variables directly in FireBug
  console.debug(Drupal.settings.js_vars);

  // popup mesage passed from Drupal
  alert(Drupal.settings.js_vars.message);

});


texts:
I have been working on a site, that allows users to submit encryption algorithms, for other users to test and/or crack them.

The problem I am having is in the text editor that I want to use to do this with.
Being that I am now very used to, and comfortable with the Stack Exchange Markdown, I wanted to make my site use the same thing.

What I tried, was downloading the Markdown filter module, along with the Markdown Editor for BUEditor and Google Code Prettify modules.

I have been playing around with it for a little while, trying to configure it, and I noticed that there are several problems, that I can't figure out how to solve.

Block quotes don't work: When attempting to make a block quote, instead of making it correctly, it just looks like > this is pseudo block quote text.
Is there a library that I need to / can install to get this to work?
Google prettify is working, but not coloring the code.
Basically, I can get prettify to make the code look like this:

public static void main (String[] args) {
  System.out.println("this is a test example");
}

It is not highlighted.

public static void main (String[] args) {
  System.out.println("this is a test example");
}

What am I doing wrong? Is this just a simple css issue? Is it something bigger? Should I use a different module entirely, and if so, which one? (I am using omega as my default theme. You can see an example of this that I created for debugging purposes here.)

(Note: This is not a question about a module bug, I am wondering if there is something that I have forgotten to set up, or am doing wrong, not the module itself.)


texts: Is there any way to access the information of the groups used in the view within hook_form_views_exposed_form_alter()?

texts:
Is there any way to access the information of the groups used in the view within hook_form_views_exposed_form_alter?

I am trying to find them within the view element:
$form_state->getStorage()['view'] or $form_state->getStorage()['view']->storage.


texts: how to make a custom entity multilingual

texts:
I made a custom entity (ty drupal console). but i would also like to make this entity translatable. I enabled all 4 multilingual core modules but i don't see the "translate" tab in my entity nor can i enable translation form the "admin/config/regional/content-language" page (it says N/A), but i can show the language selector which as no real effect.

is it possible to translate custom entity, if so, how? what am i missing?


texts: Using form elements for various forms in Drupal 7

texts:
I am building a site with several forms that partly contain identical building blocks (for example a fieldset 'payment details'). Ideally, I would like to design my form elements separately and then inject them into each form. My idea was to create functions with &$form as parameter, as in the following code:

function payment_details(&$form) {
  $form['payment_details']['amount'] = array(
    '#title' => t('Payment Amount'),
    '#type' => 'textfield',
  );
}

I then call the function in my form definition.

transaction_form() {
  // ...
  payment_details(&$form);
  // ...
  return $form;
}

While the approach leads to the desired result, Drupal gives me the following warning:

  Deprecated function: Call-time pass-by-reference has been deprecated in drupal_load() (line 1100 of C:\Wamp\www\paradise\includes\bootstrap.inc).

Maybe anyone can give me a better way to reach my goal? At least, can you guys advise on how to fix this problem? I understand from various forum posts that this is a PHP related issue, and that it can be more or less ignored for development. Do you agree?


texts:
I need help with this..
A client wants to write a privacy policy for their site and they are asking what cookies Drupal uses so that they can include a description of them in the policy.
Which cookies does Drupal 7 use, and what are their functions? or at least the list of all cookies that Drupal Core uses.


texts: Displaying a Page Before Drupal Bootstrap starts

texts:
Is it possible to display page before drupal starts.
for example displaying a nice jQuery animated page first and then after some time, loading drupal or providing a link to the drupal site on that animated page.


texts: Should I use Drupal or a Mediawiki to create a site like Wikihow?

texts:
I have some basic experience in using Drupal 7 and I am currently  starting a new project where I want to create a wiki site with the same functionalities of  Wikihow.com. I have done some research and most wiki sites seem to be built on a wiki open source software such as Mediawiki.

Because I have some experience in Drupal and really like it, I would like some advice on whether to build a Wiki in Drupal (perhaps using the Drupal Commons Distribution), or use a wiki platform instead?


texts: How to make Views rows clickable with jQuery

texts:
I am trying to follow Jimajamma's instructions here to make my Views rows clickable.

My View class =

.clickable-row .views-row {
border:12px solid purple;
}

My js file shows ok in the page source here

I am not sure which field is meant by "as long as one field in your view is a link" - I have tried Content: Link,
Content: Path and Content: Nid.

Result here - purple border rows are not clickable.

Can anyone please suggest what I am missing?


texts: Convert one store Ubercart in two stores

texts:
I have installed Ubercart in Drupal 6.  The client likes that the actual store be converted in two stores and that each store has its own administration.

Is it possible?  or have to I create a drupal separated for each store?.

Many thanks for your answers.


texts:
I'd really like to use the Regcode module, but it is not very well maintained and with the progression of depending modules like VBO it becomes rather unstable imho.

So, i'd be glad if anyone can point me in the right direction to solve these problems:

Restrict user registration to "somehow invited" (preferably code-based) people only.
Manage the invites in backend.

I'd also like to know if there's maybe a commercial module that fit my needs...


texts: Anyway to clear cache on Drupal 7 without any extra modules or even going to the performance page?

texts: I'm looking for a way to clear cache easily without installing any fancy modules or going to the performance page. Is there a URL I can just visit to clear the cache? Basically try to find the shortest and fastest way to clear cache without much effort.


texts: Ubercart refuses to believe it is updated

texts:
I perpetualy get the "Security Update Needed" for Ubercart, even after updating.

The Update Modules page gives me: Ubercart (Security update)    Installed Version: 3.0  Recommended Version: 7.x-3.3 (Release notes)

But if I actually go to the modules pages, it shows that I have installed Ubercart 7.x-3.3

Is anything actually wrong? If not, is there any way to get rid of the constant update warning?

Thanks!

As requested by responses, here are the database system tables:

'uc_2checkout', 'sites/all/modules/ubercart/payment/uc_2checkout/uc_2checkout.module'
'uc_affiliate2', 'sites/all/modules/uc_affiliate2/uc_affiliate2.module'
'uc_ajax_admin', 'sites/all/modules/ubercart/uc_ajax_admin/uc_ajax_admin.module'
'uc_attribute', 'sites/all/modules/ubercart/uc_attribute/uc_attribute.module'
'uc_authorizenet', 'sites/all/modules/ubercart/payment/uc_authorizenet/uc_authorizenet.module'
'uc_cart', 'sites/all/modules/ubercart/uc_cart/uc_cart.module'
'uc_cart_links', 'sites/all/modules/ubercart/uc_cart_links/uc_cart_links.module'
'uc_catalog', 'sites/all/modules/ubercart/uc_catalog/uc_catalog.module'
'uc_credit', 'sites/all/modules/ubercart/payment/uc_credit/uc_credit.module'
'uc_cybersource', 'sites/all/modules/ubercart/payment/uc_cybersource/uc_cybersource.module'
'uc_file', 'sites/all/modules/ubercart/uc_file/uc_file.module'
'uc_flatrate', 'sites/all/modules/ubercart/shipping/uc_flatrate/uc_flatrate.module'
'uc_googleanalytics', 'sites/all/modules/ubercart/uc_googleanalytics/uc_googleanalytics.module'
'uc_google_checkout', 'sites/all/modules/ubercart/payment/uc_google_checkout/uc_google_checkout.module'
'uc_order', 'sites/all/modules/ubercart/uc_order/uc_order.module'
'uc_payment', 'sites/all/modules/ubercart/payment/uc_payment/uc_payment.module'
'uc_payment_pack', 'sites/all/modules/ubercart/payment/uc_payment_pack/uc_payment_pack.module'
'uc_paypal', 'sites/all/modules/ubercart/payment/uc_paypal/uc_paypal.module'
'uc_product', 'sites/all/modules/ubercart/uc_product/uc_product.module'
'uc_product_kit', 'sites/all/modules/ubercart/uc_product_kit/uc_product_kit.module'
'uc_quote', 'sites/all/modules/ubercart/shipping/uc_quote/uc_quote.module'
'uc_reports', 'sites/all/modules/ubercart/uc_reports/uc_reports.module'
'uc_roles', 'sites/all/modules/ubercart/uc_roles/uc_roles.module'
'uc_shipping', 'sites/all/modules/ubercart/shipping/uc_shipping/uc_shipping.module'
'uc_stock', 'sites/all/modules/ubercart/uc_stock/uc_stock.module'
'uc_store', 'sites/all/modules/ubercart/uc_store/uc_store.module'
'uc_taxes', 'sites/all/modules/ubercart/uc_taxes/uc_taxes.module'
'uc_tax_report', 'sites/all/modules/ubercart/uc_tax_report/uc_tax_report.module'
'uc_ups', 'sites/all/modules/ubercart/shipping/uc_ups/uc_ups.module'
'uc_usps', 'sites/all/modules/ubercart/shipping/uc_usps/uc_usps.module'
'uc_weightquote', 'sites/all/modules/ubercart/shipping/uc_weightquote/uc_weightquote.module'


texts: Emailing a bunch of users selected from a user reference field

texts:
I have a node that lets me select multiple users in a user reference field. I also have a rules setup to email the author when someone makes a comment on that node.

Now, how do I also email the users I selected in the user reference field when someone makes a comment? Would rules work in this scenario or something else?


texts:
So i am wondering what would be the best way to use angular.js inside of an existing drupal 7.

I'd like to use it only on some specific nodes to display data.

should i be writing a custom module or is there something ready to use already?


texts:
Should all Drupal 8 files be located publicly, or should something like sites be the public document root?

[Michael@devserver drupal-8.1.1]$ ls -l
total 228
-rw-rw-r--.  1 Michael Michael    262 May  4 04:20 autoload.php
-rw-rw-r--.  1 Michael Michael   1437 May  4 04:20 composer.json
-rw-rw-r--.  1 Michael Michael 146226 May  4 04:20 composer.lock
drwxrwxr-x. 12 Michael Michael   4096 May  4 04:20 core
-rw-rw-r--.  1 Michael Michael   1272 May  4 04:20 example.gitignore
-rw-rw-r--.  1 Michael Michael    549 May  4 04:20 index.php
-rw-rw-r--.  1 Michael Michael  18092 Sep 23  2014 LICENSE.txt
drwxrwxr-x.  2 Michael Michael   4096 May  4 04:20 modules
drwxrwxr-x.  2 Michael Michael   4096 May  4 04:20 profiles
-rw-rw-r--.  1 Michael Michael   5889 May  4 04:20 README.txt
-rw-rw-r--.  1 Michael Michael   1596 May  4 04:20 robots.txt
drwxrwxr-x.  3 Michael Michael   4096 May  4 04:20 sites
drwxrwxr-x.  2 Michael Michael   4096 May  4 04:20 themes
-rw-rw-r--.  1 Michael Michael    554 May  4 04:20 update.php
drwxrwxr-x. 26 Michael Michael   4096 May  4 04:43 vendor
-rw-rw-r--.  1 Michael Michael   4006 May  4 04:20 web.config


texts: Changed my theme name without disabling it. Can't re-enable, please help

texts:
Like an proper idiot I changed my theme name using .info file without disabling it first in the admin area. Now, I cannot re-enable as it does not show in the Appearance part of the administration area.

I have already tried resetting to the default garland theme and clearing all the caches to no avail. Any idea on how I could fix this?

I am using Drupal 7 and Omega as the base theme.


texts:
Drupal 7
Modules:   Profile2 Registration Path, Multi-Step Registration, Profile2, Logintoboggan.

I have a Drupal 7 site that has three roles.  User, Advertiser, Auctioneer, each with their own Profile2 fields.  Currently when a user clicks register ALL the profile2 types show up on the page.  The functionality I'm after is, depending on which role they select after filling out username, password and role, the appropriate profile2 type is shown to the user to finish before finishing the user account creation OR something similar.  Is this possible?

Thanks for any guidance.


texts: Font-Awesome issue: how to remove menu-link text from a menu item with font-awesome icon?

texts:
I installed the module Font awesome icons (with it's library) & the module Menu attributes; I've configured them, and now have a working font-icon in my main menu.

The problem is that instead of the desired icon, there is a combination of icon&Text (img1), and I need only an icon to appear... If there was an option to delete the text I would do that, But I haven't seen such an option - The menu-link text seems to be mandatory (img2).

I though of the css command text-indent: 200px to remove the text but the font itself is also text... Any ideas how to safely remove the text without removing the icon? Thx,


texts:
I am interested in making a 'physical' folder structure to match a hierarchy I create through content types.

My hierarchy currently exists in the format

-Container
--folder
---presentation

and I want to create a folder structure when each level is created that mimics this, so that would be

[container_name]
[container_name]/[folder_name]
[container_name]/[folder_name]/[presentation_name]

I've been trying to use the drupal_mkdir() function within a module of my own creation which uses hook_node_insert, but I am a little too 'green' to know exactly what to do.


texts:
I have created several image styles in Drupal 7 (thumbnail, medium, large and xlarge). I also have created a script that imports data from a CSV-file, and copy images to the system.

The script seems to work fine and all images are attached to nodes correctly. Using Views I have created a block that shows nodes of a certain node type, and thumbnails attached to said node. Links to the images is OK in HTML.

Now the problem starts. Some images (thumbnails and large) get created, but some doesn't.

I can not find a reason why the images that doesn't get created should not be created. At first I thought maybe the image size was to big, but this isn't the case. Some images that gets created are bigger than ones that doesn't, and all images are bellow the systems 32 MB limit (from 3 to about 15 MB).

I have no idea where to start looking. All images copied during the import seems fine when opening on my system (OS X).

Can anyone point me to where I can get started at finding what the problem might be?

Thanks!


texts: How to effectively remove module created fields?

texts:
During the installation procedure of a module one may create some fields and corresponding instances and attach them to a content type. What is the best practice to clear up what we have created after module uninstallation?

It seems that removing fields created by a module is not yet implemented in D7 (see field_modules_uninstalled docs.). What would be the best approach then to remove module fields?

field_attach_delete_bundle

OR

field_delete_field

NOTE:
the comment module removes the field upon uninstallation (see here).


texts: self hosted video player/soution with fallback

texts:
I use drupal 6 and I am looking for a way to play my own videos (only one per product page).
I use views to display content.
Player should have ability to fallback to browser player for users with javascript disabled.
Similar solution is implemented on zappos page for example here http://www.zappos.com/reef-fanning-brown-lux?zfcTest=fcl%3A0

If I click on video with javacsript disabled, I get a new window with video playing.

Can anybody recommend a solution? Thank you


texts: Commerce, different price based on quantity

texts:
Is that even possible?

I read that Drupal 7 has some discount modules for that, but Drupal 8 doesn't have anything. Is that true? And maybe someone can point me in the right direction how to achieve this goal...

I have found this post: Drupal Commerce - product attribute price based on quantity which suggests using https://www.drupal.org/project/commerce_price_table module but nothing for Drupal 8.


texts: image field - how to overwrite existing image?

texts:
How to set up the image field in a content type so that it always overwrites images with the same name instead of creating new images with name suffix _0, _1 etc. Currently, while editing a node and uploading image with the same name as existing one, it won't overwrite.

If it is impossible, then how to achieve it programmatically (hook, hack?) without help of any additional modules, just using the core image field.


texts: Is there any method (function) in drupal which gets called after nodes being created.

texts:
I am creating a custom module for Drupal 7. I wanted to post the node that gets created of type "Article" to facebook wall so that user doesn't have to manually create a wall post.

For that I need to get a method (function) in drupal which gets called as soon as the nodes gets created, where I can put my Facebook API codes.


texts: How do I add the flag bundle as a field in Views for all users?

texts:
I have a view of flaggings.  My site has three types of flags:

Fruits
Vegetables
Mushrooms

In Views, under Filter Criteria, I can add Flag: ID and then select the Flagging type in order to filter by flag type.
However, when I add Flag: ID under Fields, I cannot see the bundle name (Fruits, etc.) unless the account has the Administer flags permission.
How do I show the flag bundle type in a views field to all users, regardless of their permissions?
I tried to use hook_views_pre_view() but I couldn't find any place to override access to the field in Views.
function MYMODULE_views_pre_view(ViewExecutable $view, $display_id, array &$args) {
  if(($view->id() === 'VIEW_MACHINE_NAME') && ($display_id === 'page_1')) {
    $fields = $view->display_handler->getOption('fields');
    $views_field_flag_id = $fields['flag_id'];


texts:
I've exported features in a multisite setup in site A, which I now want to import into site B. Though, I keep getting errors like:

The "entity_embed" plugin does not exist
The "bef" plugin does not exist

I've checked if the modules are enabled in advance, but still, I keep getting this error.


texts: Issue in taxonomy term with hyphen(-) in url drupal7

texts:
I have a taxonomy called free-choices.But the contents are not listed when hyphen(-) in the taxonomy name.The pages with taxonomy name without hyphen is listing contents.How to solve this issue?I checked this validation criteria .But this is not working.How to solve this issue?

How to solve this issue in the same views?


texts: How to catch exception if the destination mail id does not exist while sending mail through webform?

texts:
I'm sending mails on submission of a webform. The destination mail address is fetched from a custom email field in the form. On submitting, when the user enters a mail address, a custom mail would be sent to that email.

I want to catch the exception if the mail id doesn't exist or if email is not sent.


texts: Any imageslider for my homepage. am using drupal 5.21 on my website

texts: Any imageslider for my homepage? am using drupal 5.21 on my website.


texts:
I have a block I would like to add it to my renderable array (given to a page callback), with prefix and suffix - what's the cleanest way to do this?

I understand I can do it this way:

$markup = '';
if ($block = block_load('views','results_anonymous-block')) {
    $block_content = _block_render_blocks(array($block));
    $build = _block_get_renderable_array($block_content);
    $markup = drupal_render($build);
}

$content['page'] = array(

    '#markup' => $markup,
);

return $content;

But wondered if there was a better way (e.g. without rendering the block or using the private function).


texts: Is there a Drupal rating module that lets you rate from 1 - 10?

texts:
I'm looking for a Drupal module that will let me rate something on a scale of 1 - 10.

It doesn't look like the Fivestar or Rate module would allow that.

Any suggestions?


texts: Adding an entity reference field to entity

texts:
I'm looking for a way to add an EntityReference field to an Entity, but haven't found an answer to this.  Is it possible?  Can someone point me in the right direction?

Thank you


texts: Duplicate nodes returned from a module's SQL query

texts:
I'm in a spot of bother customizing the calendar block module for my needs. I've written a custom module that queries my database for published nodes that possess a specific taxonomy term. This works as desired; 3 node objects are returned as an array. However, this array is returned a total of 35 times. When I execute the query in my SQL manager the 3 rows are returned without repetition. Is there anything blatantly amiss in my code I haven't been able to spot?

/*
*
* Implementation of hook_calendar_block
*
*/

function calendar_block_mod_calendar_block(&$calendar, &$date, $op) {
  switch($op) {

   case 'alter':
                $sql = "SELECT DISTINCT node.nid AS nid
                                FROM {node}
                                INNER JOIN term_node term_node ON node.vid = term_node.vid
                                WHERE (node.status <> 0) AND (term_node.tid = 5)";

                $results = db_query($sql);

        while ($node = db_fetch_object($results))
        {
          $events[] = node_load(array('nid' => $node->nid));
        }

        foreach ($events as $var){
                $thisPath = $var->path;
                                $nodeTitle = $var->title;
                $thisDate = substr($var->field_event_date[0]['value'],0,10);
                                $realDay = substr($thisDate, 8,2);
                $realDate = substr($thisDate, 5, 2) . "-" . ( $realDay < 10 ? substr($realDay, 1,1) : $realDay ) ."-". substr($thisDate, 0, 4);

                                //$dayInfo[] = array ('date' => $realDate, 'title' => $nodeTitle,  'path' => $thisPath );

                                if ($date->date == $realDate) {

                                    $date->content = ''. l($date->day, $thisPath) .'';
                                    $date->content .= '
'. l($nodeTitle, $thisPath) .'
';

                                }
                            }
          break;

        case 'load':

        // Change the weekday's format and set the first day of the week to sunday.
        $calendar->weekdays =  array(
            'su' => 'S',
            'mo' => 'M',
            'tu' => 'T',
            'we' => 'W',
            'th' => 'T',
            'fr' => 'F',
            'sa' => 'S',
        );

        break;
  }

}

Edited to include all the code from my module - If anything I hope this can give others a similar starting point. if the code looks like a mess it's because it's my first module.

The code works: nodes with the desired taxonomy term are pulled from the database and each date on the calendar becomes a link to its corresponding node. However on closer inspection the 3 rows are returned 35 times, so doing anything beyond this (e.g. a choice of nodes if there are multiple ones on a single date) becomes a challenge / impossible.


texts: Access module configuration value in a block

texts:
I am trying to create a custom module which creates a block, which the user should be able to place on his website.

At it's simplest, the block should contain a set of values, which were selected when the module was configured in the configuration. For example, my module configuration form has some checkboxes, and the selected values should appear on the block.

My question is, how can I get the values from the config form in the block.
Thanks.


texts: How to filter the options from a select list field according to a previous select list?

texts:
I'm trying to build a content type that has two selectlist fields. My problem is that the first field should filter the second field options

For example:

First field options (This field must filter the next field options):

-Red (Selected)

-Blue

-Green

Second field options would be:

-Apple

-Strawberry

-Cherry


texts: How to convert URL aliases back to node ID

texts:
I wonder how to convert a URL path back to it's own node (node/nid). I wish to get the original node ID from a given path. e.g.

path = "news/my-news"

..and trace it back to get it's own original URL, e.g. 65. Please advise. Thanks.


texts: How to iterate over all field collection items in an eMail body using Rules?

texts:
I'm trying to write a rule (using Rules) that will send an email to users of a role. Within the body of the email, I'd like to display the contents of a nested field collection.

I've tried using what Rules gives me for data selectors, but I can't seem to put it together. Specifically, I have two field collections: field-boat-lineup and field-equip-rowers.field-equip-rowersis actually nested withinfield-boat-lineup. The contents offield-boat-lineupare consistent. That is, their fields are fixed values except forfield-equip-rowers.field-equip-rowers` is variable and can consist of up to 8 user names.

Any pointers in the direction of how to display the contents of the field collections in the body of an email? Do I need to write some PHP code to make this happen? If so, what's the critical piece I'm missing?

On a side note, I find the field collection syntax used when working with the Rules data selector somewhat confusing. Specifically, the use of what appears to be an index. For example,

[node:field-boat-lineup:0:field-equip-boat-name:title]

I see the usage of a '0','1', '2', and '3' in the above token. I'm never quite sure what to select: 0, 1, 2, or, 3. Can anyone shed some light on the purpose of the numbers?

Update:

While I understand the example shown in the existing answer, I can't seem to conceptualize how I would be able to write a Rules "loop" to display the field collections in an email. The email body of the Rules module does not seem to have the ability to "loop" over content.


texts: How do you add rules to specify zero rate VAT when a VAT number is supplied?

texts:
I'm using the Commerce VAT, Commerce EU VAT and VAT Number modules and would like to add a rule so that if someone is within the EU (but not in the UK) and enters a valid VAT number, the VAT rate is set to zero rate.

Our current setup is working so that purchases from within the United Kingdom are being charged VAT, purchases from outside the EU are not, but I've also added the VAT Number module so that people who are in the EU but not in the UK are charged zero rate tax.

I've overwritten the validation function within the VAT Number to bypass the SOAP server for the purposes of testing, but when I get through with a, say, FRXX ** VAT Number, the full 20% is still being added. I'm guess I need to create a rule to work with the VAT Number, but I can't see how or where, as I'm still relatively new to Rules.

How do I create a rule so that the VAT rate on an order changes to zero rated when the customer supplies a valid VAT number, is within the EU and not in the UK?

Any help here would be appreciated.


texts: Get argument from current URL in twig to generate a link with that argument

texts:
I'm trying to get an argument from search page URL so that I can pass that argument to a link.
For example I have this URL for a search results page:
http://domain.com/site-search?search_api_fulltext=foo
And on that page I want to have a link that goes to:
http://domain.com/other-search?search_api_fulltext=foo

I've tried {{ url('<current>') }} but that only returns the domain and path, but not the arguments. I've been trying stuff like {{ app.request.requestUri }} but that returns nothing.

FWIW, I'm trying to include these links in a custom block that appears on the search results page.


texts: how to create expire flagged node after custom time

texts: I need code that make expire flagged node after custom time, after custome time reached node become unflag automatically, have tried flag_expire module but it no work at all. any help?


texts: Run lazy-builders of sub-keys in the render array

texts:
Our page and region templates need to access fields from the custom blocks inside that region.

Unfortunately, {{ region.block_id.field_x }} doesn't work, because region.block_id only contains a #lazy_builder, and therefore the actual variables inside that render array aren't available until we're in the block template itself (at which point it's not possible to inject variables back into the parent template).

Basically, it looks like what we need is a theme_preprocess(&$variables) that iterates over all child elements and recursively evaluates their lazy builders / pre-render hooks, so that all nested elements are available to parent templates. Is there an easy way to do this, or are we stuck with re-implementing parts of the render API here?


texts: How do I Bulk Edit Fields or Taxonomy of Nodes?

texts:
I'm working on a site that needs bulk tagging on nodes. The D8 core View Bulk Operations Port is "simple" (https://www.drupal.org/node/1823572) and it doesn't have "modify entity values" which I used for this user-case in D7. There isn't a D8 tagged version of contrib VBO I can find.

My specific use-case is I need to bulk tag groups of blog posts with single terms. I have bulk imported around 2000 nodes from wordpress and need to apply new tags to them. Once the backlog id tagged I don't really need bulk editing any more. (But I'm sure many folks have similar use cases, like bulk editing fields or tags that aren't one-off tasks)

Actions is part of Core so it might be possible to write custom actions for my use case (Tag node with taxonomy term X, Y or Z). This documentation seems the most promising. https://www.drupal.org/node/2020549

Can any confirm this is best way to bulk-edit nodes or is there a different approach that I should consider?


texts: How can I change the view block ID from block-views-portfolio-view-block to portfolio?


texts: I have a custom content named course and each time the admin wants add a course, it is displayed in a form with all courses, my issue is it is displayed by date and I want to change by alphabet, how can I do that? please help!!


texts:
I am wondering if there is any solution to store webforms in code. So that you can easily duplicate them on other sites and bundle them with your own modules.
I am looking into something similair as the views API.

If it is not available how many people are interested in such functionality? I might develop a module which could handle storing of webforms in Code. And do you have any concerns in creating such a module?

Thanks,
Jaap


texts: How do I allow my custom entity to be rendered using an entity_reference field?

texts:
Using Drupal 8, I created a custom entity, configured a few view modes for it, and then added an entity_reference field from another entity to my custom entity.

In the display configuration for my entity_reference field, I've selected "Rendered entity" and chosen a valid view mode for my entity, but I'm not getting any content when I view the host entity.

I also created an entity_reference field on my host entity that points to the default "Basic Page" node type (as a positive control) and that field shows up when I view the host entity.


texts: Using Feeds, how to import D7 files and images into a D8 media field

texts:
Looking for a method for importing D7 files and images with multiple values into a D8 media field. Any recommendations out there?
The official Feeds issue doesn't have much activity and seems to have strayed off-topic.
Feeds Migrate module is not stable and not recommended for use in production.
I have also tried a module called Media Fields but ran into problem with multiple value fields.
Upgrading to Drupal 8 using core's Migrate Drupal module is not suitable because I only want to import data belonging to a single content type.
I don't do much code so would prefer to avoid the Migrate route.
Can anyone provide a site builder method for getting this done?


texts: How to display multiple blocks using a custom calendar module?

texts:
I have created a calendar module in Drupal 7. In addition to the default calendar on the website, my client can create a new calendar for events specific to a particular page.

Say that they want to add "Youth" and "College and Career" calendars; the db table looks like this:

table: churchcal_calendars

------id------|------name-----|------set_default------

------1-------------Main---------------1--------

------2-------------Youth--------------0---------

------3-------College and Career---------0-----------

In my churchcal.module file, I have set hook_block_info and hook_block_view:

function churchcal_block_info() {
    $blocks = array();
    $blocks['monthly_calendar'] = array(
        'info' => t('Display the monthly calendar.'),
        'cache' => DRUPAL_NO_CACHE,
    );

    //get calendars
    include('db.php');
    $result = mysql_query("SELECT * FROM churchcal_calendars WHERE set_default != '1'");
        while($row = mysql_fetch_array($result)) {
            $cal_name = $row['name'];
            $sys_cal_name = strtolower(str_replace(' ', '_', $cal_name));
            $blocks['churchcal_' . $sys_cal_name] = array(
                'info' => t('Display calendar for ' . $cal_name . '.'),
                'cache' => DRUPAL_NO_CACHE,
            );
        }

    return $blocks;
}

function churchcal_block_view($block_name = '') {
    if ($block_name == 'monthly_calendar') {
        $content = monthlyCalendar();
        $block = array (
            'subject' => t(''),
            'content' => $content,
        );
    }

        //get calendars
        include('db.php');
        $result = mysql_query("SELECT * FROM churchcal_calendars WHERE set_default != '1'");
            while($row = mysql_fetch_array($result)) {
                $cal_name = $row['name'];
                $sys_cal_name = strtolower(str_replace(' ', '_', $cal_name));
                $cal_id = $row['id'];

                if($block_name == 'churchcal_' . $sys_cal_name) {
                    $content .= churchCal($cal_id);
                    $block = array(
                        'subject' => t('Upcoming Events'),
                        'content' => $content,
                    );
            }

        return $block;
    }
}

The "monthly_calendar" is the main calendar, and there is no problem with that block.

Beneath the monthly calendar is the code for the additional calendars. I can see each calendar in admin/structure/block page (for the example "Display calendar for Youth", "Display calendar for College and Career"). That part works great. However, I can only see one calendar, and that is whichever is first in the db with default != 1. In this example, the Youth calendar would display, but not the College and Career. So, it tells me that hook_block_info is correct and there is a problem with hook_block_view.

How can I display a calendar for each calendar in the db?


texts: How to prevent organic group administrator to add users without acceptance from user

texts: When a non-member subscribes to a Drupal organic group, the subscribsion state goes normally to "waiting" and "accepted" after group admin accepts. How to keep the same flow when group admin adds users to his own group, so that the user could accept or reject the subscribtion. Now when the group admin adds users to his group, they are automatically added without asking permission from the user. I have tried to change the group permissions etc. but can't figure out how to make this flow work also for this direction.


texts: How to pass argument into markup (renderable array)?

texts:
I'm doing a Drupal 7 module course. We're building a function in an include file that takes and argument from the URL. It then prints the value to the page. Seems simple enough, but then he does this in the example:

function good_morning_extra($wildcard) {
$content = array(
'#type' => 'markup',
'#markup' => '
' . t('The wildcard contains the value "%wildcard".', array('%wildcard' => $wildcard)) . '
',
);

return $content;
}

It's this part that has me confused, and the instructor glossed over it: 'The wildcard contains the value "%wildcard".', array('%wildcard' => $wildcard) Why not just 'The wildcard contains the value "' . $wildcard .'"
'?

It prints out the same, but I'm wondering if there's something to learn here.
I'm still learning the whole "renderable array" syntax and exactly what that means. I have a feeling understanding this may be key to me understand how Drupal passes data around.


texts:
I've transferred all of the files for a Drupal build to my localhost, imported the database into my local WAMP server, however when I try to access the drupal build on my localhost, it keeps giving me an error, saying it cannot connect (connection reset). Other sites on localhost work fine.

What would cause this?

The connection details are the following ones:

array('database' => 'default_drupal',
  'username' => 'default_drupal',
  'password' => '1r3s3tM3',
  'host' => 'localhost',
  'port' => '',
  'driver' => 'mysql',
  'prefix' => '',
);

I created an account using the account default_drupal on the default_drupal database, so it should work.


texts: cloning a live drupal website (db) to a local / working mamp version

texts:
I have a drupal multi-site project, that I've inherited. I am stuck on the process of trying to clone or import the database from a live server to the local enviroment. Does anyone have any suggestions as to how I might be able to do this?

It would have to be done via the command line, as the I don't have access to phpmyadmin from the live server. I know this can be done, with a series of commands and scripts -- I'm just not sure how...


texts:
I need to disable AJAX proccessing for a multiple value field in forms.

Can somebody tell me how to disable it?


texts:
How the generateFromLink method works ? And how to use it in the render array.  What is the difference between this method and the other methods used to generate link ?
$url = new Url('test_route_1');

$link = new Link('Test', $url);

$generated_link = \Drupal::service('link_generator')->generateFromLink($link);


texts: How to use different mail interfaces (Mail System)?

texts:
I have a newsletter (simplenews) being used from time to time and it uses SMTP server to send mail.
All other emails from my site should be sent using default interface. How do I do this?

I thought Mail System module could help me with this, but seems I'm doing that wrong thus I can only switch between interfaces, but not assign SMTP to simplenews only and left other using default one. How can I do that?


texts: How to remove the default  tags generated by modifying manage display?

texts:
We are using a mix of Display Suite using the manage display and Paragraph Module on the content types to help control some of the output of the nodes.

One problem we are trying to resolve is how to remove the extra div tags that are generated for the fields.

The options we have tried are:

use custom module to call hook_preprocess_entity and hook_preprocess_field hooks so that we can add the div classes as needed

PRO

We can rewrite the output to include any classes or values we want
Because we are using a module is that the module code can be cached

CON

We cannot completely control what is outputted as shown below.

Write a paragraphs-items-pr_body_title.tpl.php file so that we can rewrite the output

PRO

We can control the exact output and remove the div tags outlined below

CON

I am learning that template files are not cacheable

Example (issue):

 /* field value */

 /* field value */

Desired Scenario:

     /* title value */

     /* body value */

What is the recommended way to resolve the issue?