texts: How do I change taxonomy page callback for a specific vocabulary only?

texts:
Following Clive's answer to this question, I would like to change taxonomy page callback and redirect users to another page just for a specific vocabulary.

function MYMODULE_taxonomy_page_callback($term) {
  if (/* Check if the vocabulary is the one we need to implement hook to */) {
    drupal_goto('somewhere');
  }
}

How can I achieve this?


texts: I installed heartbeat in my drupal site and my administrative tools stopped working until i deleted it and then refreshed the site. What can i do? I had to install heartbeat to continue with my project. Please i need your help.


texts: Remove tags from dependent term ref field when dependee is deactivated

texts:
I have a check box acting as the dependee. When it is checked, it opens up a free-tagging term-reference field. So when A is checked, B appears and users can add tags:

A (checkbox): []
  B (tags): [________]

In the settings I have the following selected:

  "Reset the dependent to its default values when the form is submitted
  if the dependency is not triggered."

The default value for the term-ref field is blank. When the checkbox (dependee) is unchecked and the content saved, it should revert to the default value. However, all added terms remain.

Is there a way to remove all taxonomy terms in this scenario? I have multiple dependee/dependent fields in the content type, so it would have to act independently of other fields.


texts:
I have a PHP class that I have developed to mediate the interactions with a client's SSO web service. The class needs to be used by both a Symfony site and a Drupal 7 site. On the Drupal side, I've dropped a copy of the class inside the SSO module I'm developing, and I'm attempting to use xautoload to load it, but I was getting a class not found error when attempting to instantiate an object from it.

Now I'm just dumping the output of get_declared_classes() to the message area with dpm(), and I don't see that it has loaded the class.

Here's the structure of my module

client_sso/
|
--client_sso.info
--client_sso.module
--includes
  |
  --ClientSSO.php

My client_sso.info looks like this

name = Client SSO
description = Integrate Drupal with Client SSO service
package = AARP
core = 7.x
dependencies[] = xautoload (>= 7.x-5.0)
files[] = includes/*.php

I disabled and re-enabled the module to rebuild the module registry and cleared all caches, but it appears to be cheerfully ignoring the file with the class.

I have verified that I can directly load the class with

module_load_include('php', 'client_sso', 'includes/ClientSSO');

What should I try next?


texts: How to override registration form message

texts:
I should override registration form message "Registration successful. You are now logged in." with String Overrides module it does not work, because new text is long and every line with other style, it is in Drupal 7
I try to do it in template.php , but no my code is working.
Can anyone help me?


texts: How to sign emails to setup DKIM and DMARC

texts:
After setting up my Drupal 8 site in the server, I noticed that none of the emails go to the inbox in Gmail and it all gets stored in Spam. Upon further investigation I found that this is because the emails are being sent via the PHP Mailer and its not being signed and authenticated.

I'm not that familiar with Drupal programming, therefore any suggestions and instructions on how I can get this configured via code/modules etc would be greatly appreciated.


texts: How to get the list of fields which are referenced to particular vocabulary

texts:
As the title say I want to get the list of fields which are referenced to particular vocabulary.

For example field1 and field2 are taxonomy reference fields and the vocabulary associated to them is vocab1, now if I pass vocab1 I should get field1 and field2 as the results.


texts:
I am getting some unusual text which is getting added to my queries in views. I am referring to the part setting view_name.

SELECT users.name AS users_name, users.uid AS uid, 'cardinality_user_test:page' AS view_name
FROM
{users} users
LEFT JOIN {node} node_users ON (SELECT nodeINNER.nid AS nidINNER, ':default' AS view_name
FROM
{node} node INNER LEFT JOIN {users} users_nodeINNER ON nodeINNER.uid = users_nodeINNER.uid
WHERE (( (users_nodeINNER.uid = users.uid ) ))
ORDER BY nodeINNER.nid DESC
LIMIT 1 OFFSET 0) = node_users.nid
LIMIT 10 OFFSET 0

This additional SQL is creating an error:

  SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 2 column(s)

What is causing that text to be added in Drupal 7?


texts: How to use the stomp module to send and receive a queue?

texts:
Hello everyone,

I downloaded the stomp module for drupal and I just can't find any tutorial on how to use it.

I'd like to send and receive queues to and from activemq. I've an MQConsumer.php class and an MQProducer.Php class which use the fusesource stomp library and I'd like to integrate it to drupal.

I mean I've installed the module and there's like no feedback from the system. Like no UI.

Can anyone tell me how it works? I'd like to test and extend it's functionality. Thanks


texts: How can I set site.com/node/1 into site.com (clean)?

texts:
I am trying to get my site as site.com and when I type the URL, I get site.com/node/1.

How can I get this done? If you can specify step by step, highly appreciated.

AB


texts: Manual crop is not working when authenticated user adds a new content

texts:
I am using the Manual Crop module in my site. Admin and authenticated user can add a content. If admin adds a new content, manual crop enable after picture uploading. But when authenticated user adds a new content manual crop module is disable.

It enable only after save content. After saving content error message comes like this: "Chose cropping styles".

What can I do in this moment in order to do enable cropping after uploading.


texts:
Shortly: How can I open a drupal_goto() result in a new tab?

More details:

I've got a list of news, made with Views, that can be imported from a RSS feed (big custom module, very complicated, etc, etc) or directly written by the site's editor.

When I click on a news, I access the node full view mode page and, if it is an imported news, I'm redirected to the source site with drupal_goto(source).

I want to redirect to the external source site in another tab. And I can't figure it out. I'm not even sure if that's possible with only PHP.

Thanks in advance for any help.


texts: rule to remove "Public files directory Not fully protected" in nginx?

texts:
I use D7 with nginx and php5-fpm on Linux and get this security warning:

  Public files directory Not fully protected

I see here that one needs to use this snippet in Apache's htaccess to resolve the issue:

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
  # Override the handler again if we're run later in the evaluation list.
  SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</files>

Just wondering what should be the nginx equivalent rule?

Update: I already have this in my nginx configs:

root   /path/to/drupal;
}

location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
                return 404;
        }
        try_files $uri =404;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
}


texts: How do I check if a node is an organic group in an access callback of a custom module?

texts:
In Drupal 7 with Drupalgap, I have created a custom module in order to make a block. I have defined hook_block_info() and hook_block_view() as it is necessary.
What I want is making this block visible only in organic group nodes. So I need an access callback inside my groups_menu_module_block.js
Below you can see the function but it doesn't seem to work.

    function groups_menu_module_block_access_callback(options) {
        return og_is_group('node', Drupal.node.nid);
    }


texts:
What I try to achieve is create a simple Form where I will be able to add new content (like "Question" objects for instance) and access the information through Services 3.x. My problem is that I am new to Drupal and some guidance will be very helpful. I have tried to create a new custom content type, but as I need grouping of the fields, I used the "field collection" module. The problem there was that when using the node service I couldn't get the content of this field collection. So I am actually stuck now. The following questions appear in my head now:

Do I need to write my own module to be able to extend the NODE object or I can achieve it by creating custom content type?
Can I customize a service to return only desired properties (like only the id and the title of a node without returning all other properties like createddate, modifieddate, etc.) or should I create my own module to achieve this?
If I need to create a custom module, can you point me to an example? (I have read the Drupal article for creating a resource for Services 3.x, but there they using a new custom object and not the NODE object)
How can I have both a form to enter content and a service resource for the basic CRUD operations in one module? Using hooks?

Basically my point is to skip writing code for CRUD operations if it is possible and just use the ones from the NODE, but expose to the mobile app only some of the NODE properties and have a form where I can enter new content.

I am using Drupal 7.

I want to apologize for the messy post, but it really represents the thoughts in my head...


texts: Show the first 4 items in a different format

texts: I have a current view set up that displays a feed of stories and is sorted in descending order. I now need to have the first 4 stories display as a different style then the remaining ones. I have pagination set to 10. I only want the first 4 to show differently on page 1, and then the current style will show on the remaining pages. Is there a way to do this?


texts:
In D7, using profile2 module, you would load the entity_metadata_wrapper from user object then access profile fields as such: $userWrapper->profile_XXX->field_XXX

Given that Profile2 is replaced by Profile module in Drupal 8, what is the Drupal 8's equivalent of accessing profile module's fields from a user object?


texts: How to display different sets of images per page in sidebar?

texts:
I'm trying to show different sets of four images in sidebar depending on which page a visitor is viewing. Aside some trouble I'm wondering whether a proper workflow should be as follows:

Create "Four Images" content type set up as a single multiupload image field.
Create "These Four Images", "Those Four Images", etc. content.
Create as many views as content units in step two set up as a grid block.
Add every block to sidebar in Block Design and restrict each block to be displayed using "Visibility->Pages".

So I'm getting a Sidebar in Block Design rapidly filled with four images views. Is there any other cleaner way of doing this?


texts: How do I build a user table with aggregated article data?

texts:
I'm new to Drupal, and I want to make an overview over aggregated user data related to the articles they have written.

I basically want to build a table like this:

------------------------------------------------------
| user | articles published | articles with comments |
------------------------------------------------------
| bob  |                 12 |                      3 |
------------------------------------------------------
| sue  |                 34 |                      0 |
------------------------------------------------------
| kim  |                  0 |                      0 |
------------------------------------------------------

What is the best way to make a table like this? Is this something I need to make my own module for?

Would it be possible to aggregate this with an existing module?


texts: (How) can I implement a points system to track club member attendance/participation?

texts:
I run a Drupal 7 site for one of my clubs at school. My eventual goal is to create a system where club officers can manage all sorts of information about our members through this site (such as contact information, which I've already got working). I want to have a system where perhaps a content type like "Club Event" (doesn't have to be an actual event like that found in the Date module) or "Club Meeting" is created and there is some field where club officers can essentially get a checklist of members and check off who attended that event. This content type would then also have a field where a certain point value is assigned to that node and whoever is checked off on the list will get a certain number of points added to their account.

Finally there should be some sort of view where officers can view a list of all members and the number of points they've earned/events they attended.

Does this sound like something realistic to do within the Drupal framework? If so, any suggestions as to what modules might be necessary? Would this be something the User Points module can be used for?

I've never written any modules for Drupal before, but I'm not opposed to getting my hands a bit dirty if necessary.


texts: Date and links formatting in node template

texts:
Drupal 8.x

I have 2 quick questions. I have the following node template node--briefing--teaser.html.twig

  {{ date }}
  {{ label }}

Now the questions are:

How can I format the date to the following d/m/Y
How can I get the URI of the read more field (links)

With a normal link field you can simply do content.my_link.0['#url'] to get this but that doesn't seem to be the case with the node links field.

Thanks in advance!


texts: Migrate Private Files: FILE_EXISTS_REUSE still duplicate files

texts:
I'm trying to migrate private files (file migration), the problem is even I set file_replace to 'FILE_EXISTS_REUSE' the files are still duplicated (it adds _1 or _2, and so on.). Here is my mapping:

    $this->addFieldMapping('file_replace')
         ->defaultValue('FILE_EXISTS_REUSE');
    $this->addFieldMapping('preserve_files')
       ->defaultValue(FALSE);

Please help!


texts: Adding Quick Tabs Programmatically to a node is not working

texts:
I'm writing below code in my node--type.tpl.php, but only empty page is loading when i load the node page.Can you please help in knowing my mistake.
What i need to add to display quicktab and its corresponding viewmode content?
my code is:

<?php
 $nid=$node->nid;

$tabs['Home'] = array(
  'title' => t('Home'),
  'type' => 'node',
  'nid' => $nid,
  'viewmode_home' => TRUE,
  'hide_title' => FALSE,
);
$tabs['About'] = array(
  'title' => t('About'),
  'type' => 'node',
  'nid' => $nid,
  'viewmode_about' => TRUE,
  'hide_title' => FALSE,
);

$quicktabs['qtid'] = 111; //given a random number
$quicktabs['tabs'] = $tabs;
$quicktabs['style'] = 'Mac';
$quicktabs['ajax'] = FALSE;
print theme('quicktabs', $quicktabs);
?>


texts: How to redirect users to log in page when they try to access the order page, but not when they try to check out

texts:
I'm using Checkout Login module that adds an inline login form to the account information checkout pane. No anonymous users have to activate their accounts to complete checkout or payment, which is all I want. However, after the PayPal redirects users back to my site, and users try to access the order (order history) page, the following message appears:

  You are not authorized to access this page.

Is there a way I can re-direct users to login page when they try to access the order page, rather than the above message appearing?

In short, I want my users to be redirected to login page when they try to access order (order history) page, but not when they try to checkout.


texts: Display image fields of a node as slideshow

texts:
I have created a content type with some text and image fields. I want to display its images as a slideshow below text fields in view node page of this content type. How can I do it ? Is view slideshow module suitable for this purpose ? or I have to use other module ?

I am working in Drupal 6.


texts: What would be the alternative to fix "Access forbidden 404" on my test site while using basic_authentication module for rest resource?

texts:
Background:
I had http authentication enabled by htaccess on my test site. I had created REST resource using Drupal 8 core REST web services modules and views. When i used authentication as basic_auth than on Test site  got access forbidden 404 for each page request. Uninstall basic_authentication make it work but i want basic_authentication should work for my test site. What would be the better alternative for this?

Thanks


texts:
Everytime I use drupal hooks I always take the custom module route and call the hooks from there. I'm basically talking about all the hooks in drupal -- hook_form_alter(), hook_page_alter(), hook_menu, hook_user(), hook_nodeapi(), hook_init, etc. etc. etc. etc.

On the other hand, I have never actually delve into writing hooks inside my template.php so I was wondering:
- If this is possible?
- Is it going to work exactly the same as it does when called in a module?
- Are all drupal functions available as well through template.php?
- Are there any notable differences in code implementation?
- In which scenario I would choose custom module over theme.php?

Please note any D6 and D7 difference.

Please advice. Thank you.


texts: Using custom test helpers in your test cases

texts:
I'm trying to write test cases for my custom module and in order to speed things along for current and future testing I defined a garbage class that can spit out random data. However the testing module cannot seem to locate my Garbage class. After some debugging I realize that Drupal looks in the registry table to find the class and while my class is defined in the default registry table, simpletest creates it's own custom registry table to run tests which doesn't contain my class or it's location. Is there any way around this or some way to force simpletest to make an exact duplicate of the registry table?

Notes:

The garbage class is located in a separate file (Garbage.php)
Yes I do have 'files[] = Garbage.php' in my .info file.
While I could just move the garbage functions into test case itself, I may need to reuse it for other tests later on so having it in a separate class is ideal.

Garbage class

    class Garbage {
        public static function getGarbageString(int $i = 1) {
            $return = array();
            for ($j = 0; $j < $i; $j++) {
                $return[$j] = self::_getRandomString();
            }

            return $i == 1 ? $return[0] : $return;
        }

        private static function _getRandomChar() {
            return chr(mt_rand(33,126));
        }

        private static function _getRandomString() {
            $length = mt_rand(1, 255);
            $return = '';
            for ($i = 0; $i < $length; $i++) {
                $return .= self::_getRandomChar();
            }

            return $return;
        }
    }

Located in .module file

    function getRecord($recordName) {
        return $records[$recordName];
    }

Located in RecordTestCases which extends DrupalWebTestCase

    public function testGetRecord() {
        $badData = Garbage::getGarbageString();
        $this->assertNull(getRecord($badData), 'Testing get record with bad data');
    }


texts:
I've got CKEditor 4.5.0 working on a Drupal 7.42 install. I'm now trying to find a way to wrap more than one HTML element inside a DIV (I want an image and caption to be wrapped in a single DIV).

On the CKEditor Profile I got 'Div container' selected under Buttons and Plugins. As I understand it this should give me a 'Div container' button in the Wysiwyg, which then opens a dialogue. But it ain't there.

All the buttons I've selected are in the toolbar. It's just that selecting 'Div container' doesn't appear to be doing anything.

I've tried manually installing the Div Container Manager but this also doesn't seem to have any effect. (And it shouldn't, because the plugin comes with the 'standard' CKEditor package).

Please tell me I'm missing something very obvious.


texts: isset(($_GET['variable'] ) not TRUE anymore after AJAX submit?

texts:
I have a variable e.g. for a search query which i save in the URL:

.../page?variable=value

I get this variable and save it as a global variable so i can use it in all functions of my file:

if (isset($_GET['variable'])) {
  $GLOBALS['variable'] = $_GET['variable'];
}

I use isset($_GET['variable'] since not at every page call, this variable is set.

When the page gets rebuild with an ajax_submit function, e.g. because an AJAX button was pressed, the variable $GLOBALS['variable'] is not set anymore.

It seems like that isset($_GET['variable'] does not return TRUE anymore.

What does cause this issue?


texts:
I'm trying to find a way to get a view to display either field_a or field_b.
For example I have to different image fields that are being rendered differently on the full  node display, both of which are optional. Now I'd like to be able to show one of those pictures in my list view, either picture 1, or, if that's not present, picture 2, but never both.

Is there any smarter way to achieve this than to put the logic into a views fields template?


texts:
I am using Aministration Views module to have a custom page for content list. I have added some new columns to the view and now I want to export all that in a Features so I can deploy it on my staging server. The problem is that I just can't export it in a feature, when I create the feature, it is just "empty", there is only a depedancy to admin_views but I can't see changes I have made.

Anyone has a solution for this?


texts: How to create translations programmatically?

texts:
I have a batch in which i'm importing nodes from REST webservices.
My application has two languages, FR and EN (default is FR).
So, I'm creating the node in FR, then, I loop through all other languages (just EN for now) and try to do as following :

$languages = \Drupal::languageManager()->getLanguages();
unset($languages['fr']);

foreach ($languages AS $langcode => $language) {
  if ($node->hasTranslation($langcode)) {
    $node_translation = $node->getTranslation($langcode);
  } else {
    $node_translation = $node->addTranslation($langcode, $node->toArray());
  }

  $node_translation->status = 1;
  $node_translation->title = 'title en';
  $node_translation->subtitle = 'subtitle en';
  $node_translation->save();
}

And it crashes with a 500 error, reporting :

 - Drupal\Core\Entity\EntityStorageException : Invalid translation language (und) specified. dans Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (ligne 805 de /.../web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
 - InvalidArgumentException : Invalid translation language (und) specified. dans Drupal\Core\Entity\ContentEntityBase->getTranslation() (ligne 783 de /.../web/core/lib/Drupal/Core/Entity/ContentEntityBase.php).

I'm pulling my hair out on this issue for days and can not understand why the error message tells me $langcode equals 'und' whereas a var_dump of it just before this line returns me 'en'.

Edit :
I tried to hardcode and remove the foreach. So just after the $node->save() :

$node_translation = $node->addTranslation('en', $node->toArray());
$node_translation->set('title', 'title en');
$node_translation->set('field_sub_title', 'subtitle en');
$node_translation->save();

This time, the error is the following :

InvalidArgumentException : Invalid translation language (en) specified.
dans Drupal\Core\Entity\ContentEntityBase->addTranslation() (ligne 863
de /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php).


texts: Disable Ubercart download limits accumulation

texts: By default the Ubercart module, accumulate the download limit of a file if this one is purchased twice. How can i disable this ?. I just want to notify the user that he already have privilege to download the file and prevent him from downloading it again.


texts: How to send a notification to admin on profile picture change?

texts:
I want the new uploaded pictures to be sent (notification) to me (admin) for review and approval just to be sure they are in line with the terms and conditions of the webpage. Naked or semi-naked pictures are strictly forbidden.

How can I achieve this?


texts: Email Change Confirmation module -- Avoid confirmation email from user_login hook

texts:
I'm using the "Email Change Confirmation" (email_confirm) module with Drupal 7. It works well. However, I also have a user_login hook that sets certain users' email addresses, thus:

    user_save($user, ['mail' => '<new address>']);

In this instance, I want the change to take effect immediately, without the need for confirmation (via email or otherwise). The module already provides a configuration option to override sending a confirmation email when the address is changed via the interface by users with specified roles. I want it to behave like that when I change it via the login hook. Is there a way to override sending an email in this case?


texts: Get token of image field in paragraph field

texts:
We're implementing the Open Graph metatags so that social media shares can know which image to use as the "share" image on our pages. I'm having a problem figuring out the token for a image field URL in a paragraph field.

We have content types with a media field. The node listed under metatags "available tokens" [node:field_media_card:entity:field_media_image]. That by itself didn't work, but I was able to figure out (I don't quite remember how) that the [node:field_media_card:entity:field_media_image:entity:url] token gave the actual URL for the media image. From that point, I was able able to get [node:field_media_card:entity:field_media_image:width] and [node:field_media_card:entity:field_media_image:height], which facebook also wants.

So that works for those content types with media fields.

However, for other content types, we have a paragraphs field with an image field in it. It's a custom paragraph with a custom field in it. Our paragraph is called "Jumbotron Hero" and the field in question is called "Background Image". I am having trouble creating a token to get the URL of its image.

The Available Token lists [node:field_jumbotron_hero:entity:field_background_image]. However I tried both [node:field_jumbotron_hero:entity:field_background_image:url] and
[node:field_jumbotron_hero:entity:field_background_image:entity:url], but neither set the og:image value. Along with the URL, I also want the height and width.

How can I figure out the token to get the url, height, and width of this field?


texts:
When I want to add a link between two content types I got the following error:

  Notice: Undefined index: args in _node_reference_view_settings_validate() (line 161 of /var/www/vhosts/nielsjansen.be/httpdocs/drupal/sites/all/modules/references/node_reference/node_reference.module).

Settings were saved but with this error. Is this a problem?


texts:
In the Webform module version 8.x-5.0-rc27 there isn't the tab to add a webform to a certain content type.

Is this intentional? If not, is there a workaround for this issue?


texts: Define HTML element classes with pattern fields

texts:
I want to use drupal fields to define class names in ui_patterns. i.e. define a field in a pattern twig.html file and use its {{ twig variable }} as a class name. The following doesn't work. Is there a correct way of doing this? even possible?

{%
set classes = [
'class_name_1',
'class_name_2',
{{ ui_yml_field_name }},
]
%}
<div{{ attributes.addClass(classes) }}>


texts: How can I set frequency of each content type with the XML sitemap module?

texts:
I use the XML sitemap module (7.x-2.0-beta3) to generate the XML sitemap for my site. The problem is that I cannot set the change frequency of the content types.

In "admin/config/search/xmlsitemap/settings" I have a "Change frequency" combobox, but this is only for the front page.
I have some other content types and taxonomy tags. How can I change the frequency for them?


texts: Solving "MySQL server has gone away", mysql error 2006

texts:
I have a site at hostgator, using their "Business account". It's cheap, and comes with a private SSL cert. HOWEVER, their MySQL settings are such that any db connection goes stale fairly quickly, and then the hostgator staff try to convince you to use a VPS or dedicated server at multiple times the expense.

I'm creating and deploying WebAPIs, which can have a 'conversation' which exceeds 60 seconds. When this occurs, the db connection handle is stale, causing any db operations after my timeout to fail.

I'm in the process of implementing the following solution, but am curious if anyone else has solved this issue (where they can not modify their my.ini or my.cnf to give MySQL more resources) in a similar or completely different manner.

last part of a hook_update:

$ret = db_query( "UPDATE {my_table} set field1 = '%s', field2 = %d ... WHERE vid - %d", $node->field1, $node->field2, ... $node->vid );
if (!$ret) {
       // get private storage directory for this node:
       $cexStorage    = _cex_front_getCexStore();
       $nodeFilesPath = DRUPALROOT.'/'.$cexStorage.'/'.$node->storeDir;
       $fname         = $nodeFilesPath.'/recover.node';
       $readyToWrite  = serialize( $node );
       file_put_contents( $fname, $readyToWrite );
       if (file_exists( $fname )) {
         _dbgReport( 'seems to have worked!' );
       }
    }

Then this is called in my hook_form, right after I determine that node->nid is valid:

function _cex_front_recover_node( &$node ) {
  if (!isset($node->storeDir)) {
     _dbgReport( '**************************** _cex_front_recover_node: no storeDir!!!' );
     return;
  }

  // get private storage directory for this node:
  $cexStorage    = _cex_front_getCexStore();
  $nodeFilesPath = DRUPALROOT.'/'.$cexStorage.'/'.$node->storeDir;
  $fname         = $nodeFilesPath.'/recover.node';
  if (file_exists( $fname )) {
    $recovered = file_get_contents( $fname );
    if ($recovered) {
      // no longer needed:
      unlink( $fname );
      $recoveredNode = unserialize( $recovered );
      // restore the key values I need to proceed with this node:
      $node->stage = $recoveredNode->stage;
      $node->rnid  = $recoveredNode->rnid;
      $node->iris  = $recoveredNode->iris;
      cex_front_update( $node );
    }
    else {
      _dbgReport( '********* failed to read "'.$fname.'"' );
    }
  }
}

I'll be pairing the logic down to only store the key fields I need, but this works! Sure beats upgrading my server at 3x the expense. Anyone else doing something like this?


texts:
I have a drupal 8 form as follows:

   $form['extra_fields']['email'] = [
        '#type' => 'checkbox',
        '#options' => ['email' => 'email'],
        '#title' => $this->t('Email')
    ];

   $form['email']['required'] = array(
        '#type' => 'radios',
        '#default_value' => 0,
        '#options' => array(0 => $this->t('Required'), 1 => $this->t('Not Required')),
    );

which shows up as:

I would like to have the radios a bit indented. Is it possible to achieve this? Also, how to make the radio buttons inline?

Thanks.


texts: Drupal 7 creating a form field to upload multiple images

texts:
I'm creating a from in a custom Drupal 7 module with a field for multiple images, which isn't working as expected. As an experiment, I added a custom field to the user acct settings of type image with multiple values. That form displays thumbnails of the uploaded images and has a new "add a new file" section. This is what I'd like to have on my custom form. I haven't been able to find good examples of how to do this; this is what I've tried in the form definition:
  $form['mfile'] = array(
    '#type' => 'managed_file',
    '#title' => t('Managed images test'),
    '#upload_location' => 'public://dev_test',
    '#multiple' => true,
    '#attributes' => array('multiple' => 'multiple'),
  );

Am I missing something? Are there any good examples of how to do this?


texts: How do I print a menu with links generated by my custom module?

texts:
If I use

theme('links', array('links' => menu_navigation_links('main-menu'),
'attributes' => array('class'=> array('links', 'main-menu')) ));

It will print the links in my Main Menu. I need to print the links that are created by my custom module, but I do not know what the system menu name is.

For instance:

 //hook_menu
 function custom_menu() {

     //admin page
     $items['admin/custom'] = array(
     'title' => t('Custom Admin Page'),
     'description' => t('Manage Custom Module'),
     'page callback' => 'custom_admin_page',
     'access arguments' => array('access toolbar'),
     'type' => MENU_NORMAL_ITEM,
     );

     //add event
     $items['admin/custom/add'] = array(
     'title' => t('Add Custom'),
     'decription' => t('Add custom'),
     'page callback' => 'custom_add',
     'access arguments' => array('add custom'),
     'type' => MENU_NORMAL_ITEM,
     'file' => 'custom_add.inc',
     'file path' => drupal_get_path('module', 'custom') . '/includes',
     );

The page 'admin/custom' automatically goes into my administration menu, and the page 'admin/custom/add' is seen under the admin/custom link when viewing all of the links in the administration menu, but I want to print that menu (admin/custom) on the 'admin/custom' page so that I can see the link 'admin/custom/add'.


texts: Webform Serial - Serial Numbers updating after editing submission

texts:
I am using webform serial to generate tracking numbers for webform submission.

If I edit a submission the serial number auto increments to the next available number. How can I stop this from happening and have the number locked - even when I edit a submission?


texts:
Are there any responsive lightbox options for drupal? There are plenty of lightboxes that support fixed widths?

Are there currently any that are designed for mobile in mind?


texts: Is there a way to display basic site statistics in a block?

texts:
I am trying to find a way to display basic site statistics in a block. I have enabled the core "Site Statistics" module but I cannot find a block that would provide me this functionality. I do not want to display anything fancy; just some pageviews and unique pageviews and perhaps, optionally, the 5 most visited pages in the website.

Am I missing something here or do I need a separate module (that I can't find) to add this functionality to my website?

Thanks in advance.


texts: How can I make the "field_media_document_display field be filled with a 1?

texts:
Although I have the Files displayed by default set as true and when I manually add one it defaults to 1 , when I use the step one process it put s a null there . Since it has a null the next time a user tries to change the name it doesn't work.
I am using the Migrate File Entities to Media module, this is my code in step 1. where can I add something to make it fill in the field_media_document_display_field as a 1 ?
field_media_document/title: title
field_media_document/target_id:
    plugin: media_file_copy
    move: FALSE
    reuse: TRUE
    path: 'public://grants/'


texts: Insert date programatically in custom module

texts:
I am programatically saving values from an array $customer into a content type. The below code works fine and populates the content type customer_profile except for the field date of birth. This field is of type date and date type is set as date only (not date and time). The value in $customer['dob'] is '19/12/1938'. How do I insert this value?

$node_data['type'] = 'customer_profile';
$node_data['title'] = $customer['First Name'].' '.$customer['Last Name'];
$node_data['field_customer_gender']['value'] = $customer['Gender'];
$node_data['field_date_of_birth']['value'] = $customer['dob'];
$node = Node::create($node_data);
$node->setPublished(TRUE);
$node->save();


texts: In Drupal 7, How to prefix theme related tables in setting.php file

texts: In Drupal commerce kickstart, I enabled "Commerce Kickstart Theme 7.x-2.4" theme for "Main site" and modified design as per the requirement. We are doing "Mobile site", and we took another theme "Omega 7.x-3.1" for different look and feel. Now, I need to connect the Main site database in settings.php file and tables related to only theme based which enabled in "Mobile Site". Can anybody give me the suggestions.


texts: How to put view results in an entity reference field?

texts:
So the scenario is like this:
I have to create a "node" which has an entity reference field which can hold multiple values. I am looking for a way to be able to select view results to be stored in the entity reference field and I do not know how to do that in Drupal 8.
For Drupal 7 there was this module which does what I need https://www.drupal.org/project/entityreference_view_widget
I have tried doing it the custom way by creating views and placing them on the same page as the node create and then getting the resulting values with ajax to store in the field but I do not believe that is the best way to go about it as it does not seem reliable.
Any advice is appreciated.


texts: Where should I search uncompressed .css?

texts: I try to update styles on a Drupal site. But when I go to sites/default/files/css/ I find only set of gzipped .css files. Where should I search uncompressed files to edit them? Developer Tools shows path to gzipped files, naturally.


texts: Additional textfield for taxonomy term reference field

texts:
In the site, which I develop, I need to have workers, who provide specific services. Each worker for specific services has their own prices. Workers are drupal users, Services are drupal taxonomy terms of vocabulary services. For users I have created term reference field (called field_services) with the multiselect check boxes widget.

In the user edit form, when services are selected, I need to show additional textfield (price) for each service, how can I achieve that? Is it possible to do that with field collection, because I didn't succeed. Or should I use hook_form_alter and create a column in table field_data_field_services of my drupal database? Thanks for the help.


texts: Drupal commerce re-indexing causes exception

texts:
I'm trying to re-index all my products on my Drupal commerce website. When I do so, I get the following error message:

  An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /en/batch?id=130&op=do StatusText: Service unavailable (with message) ResponseText:

When I go to watchdog it shows me this error:

  EntityMetadataWrapperException: Unable to get the data property status as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue() (line 438 in /sites/all/modules/entity/includes/entity.wrapper.inc).

I tried finding out if there were any specific products or entities with their status not being set. When I run the following query in my database, it shows me that there are no products without status. (They all show up with 1 as their values.)

SELECT * FROM  `commerce_product` LIMIT 0 , 500

When I put the batch on doing 1 product at a time, it does 18 of the 193 products and then stops and returns the error message.

What I'd like to know is:

How do I check which product is the culprit?
How do I find my indexed items, and how can I find out where it goes wrong? (I'm not using Apache Solr.)

I'm also not quite sure about what is meant by 'the parent data structure is not set'.
If anyone could provide any insights, I'd very much appreciate it.


texts:
Sorry if this is a repeated question, tried many suggested options but no result.

There is business model of 1 to N relationship "parent and children".

I am working on a project where i have a content type building as parent and apartment as child. within a building there could be  N number of apartment and every apartment has it is own contents. something similar to attached screenshots

Parent :

Children :

-Building #1
 --Apartment #1
 --Apartment #1
 --Apartment #1
 --Apartment #1

I guess there are few modules which could help "Reference module, Entityreference, Views and  Taxonomy"


texts: Moved Site - Can't find original CSS for look other than in the ADVAGG

texts:
I've inherited a drupal 7(I'm a beginner) site that had ADVagg installed. I added a stanza in my nginx config to take care of those files. What I'm running into is that there is a button on the original site that has a style which only exists in an aggregate file.  I can't find it in any other file in the enitre site. The docroot was zipped and sent to me. I'm just a little miffed as to why the site I've unpacked doesn't have the same styles as the one online currently.
I've disabled the ADVAGG as well with no change.
###
    ### advagg_css and advagg_js support
    ###
    location ~* files/advagg_(?:css|js)/ {
      gzip_static on;
      access_log  off;
      expires     max;
      add_header  ETag "";
      add_header  Cache-Control "max-age=31449600, no-transform, public";
      try_files   $uri @rewrite;
    }


texts: I cannot get fields to render in a view fields template

texts:
I created a view "Blog Listing Cards" [machine name: blog-listing-cards]
I created a views view fields template [views-view-fields--blog-listing-cards.html.twig]
The template is properly 'picked up' and the static content displayed.

However, any time I try to print a field in the template, whether a Drupal default or custom field, it doesn't render in the browser.

The syntax seems correct when compared to documentation, other templates, and others with the same issue.

Examples of code not rendering

{{ fields.created.content }}

{{ fields.title.content }}

What am I missing?! Sorry, I'm a Drupal 7 guy re-learning in Drupal 8.    Thanks in advance  :-)


texts:
I'm attempting to add jQuery Mobile.js to handle the vclick event.

What would be the easiest way to add this functionality for an administrator that is new to jQuery?


texts:
I'm having trouble importing a very large dataset with feeds. It's about 8mb of text in XML format. It imports impossibly slow (I started it about a month ago and it's still not finished).

However, if I run the exact same importer with the same file I upload from my computer, it runs in about two minutes.

The thing is, I need to check the stock of my products from my supplier through this file every hour. Most of the data is irrelevant other than stock info.

Are there any good alternatives to do what I'm trying to do? (Drupal Commerce)
I've been thinking that if I have another module retrieve the file from my supplier every hour, then I could just point feeds to the file on my own server. However, I'm having trouble finding a module that does that file retrieve.

Any ideas?


texts: An Atomic Question about Views Modules and Templates

texts:
I am a Views newbie. I added a template file to my sub-theme folder with a more specific name (from Theme Information), the file name becomes highlighted, but the file is not used (I'm sure of this cuz I wrote some new lines to the template (
Like, Doah!
, etc.).

Some extra details:

I am using fusion core with a fusion sub-theme (begot from fusion_starter). The fusion sub-theme is activated. I've not changed much.
The custom view is fully created, has a menu entry, and displays an end user content page with the correct data.
I currently have only two "views-view-*" template files between the directories containing the two fusion themes.

fusion_core/views-view--page.tpl.php (edits to this page ARE visible on the end user "content" page).
fusion_my_subtheme/views-view--my-view--default.tpl.php (the trouble file)

Click Theme: Information to find "views-view--my-view--default.tpl.php" is listed as the most specific file name available under Display output.
Theme Information highlights this template file name bold. And, when I renamed this file, the Theme Information display returned an error message that the file is missing--therefore I conclude the Drupal/Views app is finding this file.

Why, if this file name is highlighted, is this more specific template file located in my sub-theme directory not being used by Drupal?
Is it possible there is an order to cache clearing, or template refresh? I feel as though I'm trying to catch my tail... :/

If the file name is highlighted, changes are made to that custom file named, then Views Module and Drupal should render the page with changes made to this template--that's "How it works", yes?

Xtian


texts: Understanding Drupal's session management and user authentication

texts:
I have a requirement where, I have to replace the default user authentication with the authentication of a central server i.e. SSO server.
By debugging Drupal I came to know that all the session management happens in includes/session.inc file. I want to do authentication as shown in the image:

SCENARIO: Login
The details of the steps would be:

Replace the login form to submit the username and password to SSO server (not on Drupal, but on .NET).
Authenticate the user on SSO server using database of that site; and send a response back to some custom PHP page of my website (or a form by a module?).
Using the response, identify the user in the users table, and create a session for that user without checking for the password (as it would mean double authentication).  By default, Drupal sets a cookie with name of $insecure_session_name variable, and with value $sid. I want Drupal not to set the cookie here, instead send the values of variables to SSO server.
The SSO server will take the values, create a cookie, and drop it in main domain domain.com (to remind both my website and sso server are on sub domain of main domain, which too in not in Drupal). Then, the drupal site can log in by using that cookie.

I know it is a tough ask, I am just looking for pointers as to how should I start? as they say "you should not hack the core". So, my questions are:

Where should I look for to understand how Drupal authentication and session management works in depth?
Is there a way where I could call the functions in includes/session.inc using hooks (as the comments with functions says "for internal use only/not to be modified")?

NOTE: I'll be using the same method to register the user, so that the record remains in central database of the SSO server. And during that will put in some junk password for the same user in Drupal site's database (as the password will not be checked while login).


texts: How to reference taxonomy used by other content type?

texts:
I have two content types: Content A and Content B

Fields in Content A: Title, Location, Body

Fields in Content B: Title, Type, Location, Body

Location is a vocabulary (Au, Uk, Us, Ca, etc)

Type is an entity reference of Content A inside Content B node.

Content A has a node with information in order:
News X, Ca, This is the body of News X

Content B has a node with information in order:
John Doe, Content A, ????, This is about John Doe

In this question mark, I want to include Location but only that which is selected in that node of Content A.

Location can be multiple, that is, if Content A node has "location": Ca, Uk
then Content B node referenced to Content A will only enlist Ca, Uk out of all other terms in that vocabulary.

I have looked into google, found nothing. Please help.


texts: Button that executes php function, or custom VBO action

texts: I have a function that pushes a node to a sugarCRM database. There have been some problems with the sugarCRM database recently and some of the nodes that were supposed to be pushed were not. I need to be able to build a button that can execute the function manually and push the selected node to the database. Is there a way that I can accomplish this via VBO?


texts: How do I show login form to anonymous user when accessing particular form

texts: I have created an entry form. Only authenticated user can access it. I have created a menu link for it and if any anonymous user clicks on menu link I want to show a login form and after successful login user is redirected to that entry form. I don't want to hide the menu link from anonymous user.(I have about 5 to 6 forms with same condition)


texts: how to make delete button in ctools modal form edit node act as default?

texts:
I've made a ctools modal form for add,edit and delete a node successfully.

But i need to make the delete happens as the default form act (the user could delete the node after he clicks the button edit )

I thought of sending an ajax request and simply do the confirm by another popup but my problem is how to embed a js code to the rendered form by ctools

Please help or advice with a better scenario

Thanks in advance


texts: How can I show video and images in slideshow with lightbox style?

texts:
I need to combine pictures and videos to come out in one Slideshow and when they click on an image or video is displayed in a lightbox. (I have only a 1 video)

Currently, video I have them separately and displayed on a lightbox as follows:

And if possible, show a small text in Slideshow with the image/video. As a caption that says if a video or image.

Using Drupal 7.


texts:
I'm trying to render nodes with a custom view mode, having another tab for each node in the same place than "Edit", "View", etc. So I have declared my custom view mode with hook_entity_info_alter, my new "tab" with hook_menu, with a page_callback pointing to a custom function that should return the node according to my custom view node.
It works great, but the node title is rendered too. How can I remove the node title ?
Here is the code. Thanks!

   /**
   * Implements hook_entity_info_alter().
   */
   function test_custom_view_mode_entity_info_alter(&$entity_info) {
     $entity_info['node']['view modes']['another_teaser'] = array(
       'label' => t('Another teaser'),
       'custom settings' => TRUE,
     );
   }

   /**
   * Implements hook_menu().
   */
   function test_custom_view_mode_menu()
   {      $items['node/%node/another-teaser'] = array(
           'title' => 'Another Teaser',
           'page callback' => '_test_custom_view_mode_display_content',
           'page arguments' => array(1),
           'access arguments' => array('access content'),
           'type' => MENU_LOCAL_TASK,
       );

          return $items;
   }
   /**
   * Custom page callback hook_menu().
   */

   function _test_custom_view_mode_display_content($node) {
     $node_viewed = node_view(node_load($node->nid), 'another_teaser');

     return array(
              'content' => array(
                'node' => $node_viewed,
              ),
            );
   }


texts: Allow authenticated users to fill out fields in nodes that only they can see

texts:
Is it possible in Drupal 7 to allow users to fill out their OWN values for particular fields in a content type?

For example, we want our authenticated users to be able to save nodes to a dashboard. For each node they save there are 5-7 fields we want to make available for the user to enter data into...but ONLY that user should be able to see the notes.

On their dashboard, using Views, they will then see a list of their saved nodes in tabular format with columns that include the data they filled out for each of those fields, as well as the other information that comes from the nodes that the authenticated user can't edit (ie. the title, etc.).

Is this possible?


texts: Theming views-exposed-form search block same like normal Drupal search block

texts: On this page, top-right you see a custom views-exposed-form search block. How do i theme this, so it has the same classes and HTML structure as the one below (default Drupal search block)?


texts: How to remove block from the page based on cookie value?

texts:
We have a block (myblock) that is only displayed on 4/5 content types. When a cookie, mycookie, is set and has a value of allow, I want to load the block on the page, but if the value is not set to allow, then I want to remove it from the page. The cookie is set through a third party Javascript library.

How to remove block based on cookie value?

Setup:

Under block layout, we load the block on 4/5 content types.
Using twig template (myblock--name.html.twig), we add some css to the myblock


texts:
im using Drupal 7 and views 3.

in a global-php-field i tried to show the image from field_artengalerie_term_bild. But

print $row->field_artengalerie_term_bild; shows the nid only. then i tried this:

print $data->field_field_artengalerie_term_bild[0]['rendered'];

but it doesnt output the image.

With print_r($data); i get this:

 [vocabulary_machine_name] => artengalerie [field_artengalerie_term_bild] => Array ( ) ) ) ) [field_field_artengalerie_term_bild] => Array ( [0] => Array ( [rendered] => Array ( [#theme] => image_formatter [#item] => Array ( [fid] => 648 [uid] => 1 [filename] => standardbild.jpg [uri] => public://default_images/standardbild_7.jpg [filemime] => image/jpeg [filesize] => 19607 [status] => 1 [timestamp] => 1369566211 [type] => image [field_file_image_alt_text] => Array ( [und] => Array ( [0] => Array ( [value] => standardbild_7.jpg [format] => [safe_value] => standardbild_7.jpg ) ) ) [field_file_image_title_text] => Array ( ) [image_dimensions] => Array ( [width] => 400 [height] => 266 ) [is_default] => 1 [alt] => [title] => ) [#image_style] => thumbnail [#path] => Array ( [path] => taxonomy/term/118 [options] => Array ( [entity_type] => taxonomy_term [entity] => stdClass Object ( [tid] => 118 [vid] => 10 [name] => hjgjhghg [description] => [format] => [weight] => 0 [vocabulary_machine_name] => artengalerie [field_artengalerie_term_bild] => Array ( [und] => Array ( [0] => Array ( [fid] => 648 [uid] => 1 [filename] => standardbild.jpg [uri] => public://default_images/standardbild_7.jpg [filemime] => image/jpeg [filesize] => 19607 [status] => 1 [timestamp] => 1369566211 [type] => image [field_file_image_alt_text] => Array ( [und] => Array ( [0] => Array ( [value] => standardbild_7.jpg [format] => [safe_value] => standardbild_7.jpg ) ) ) [field_file_image_title_text] => Array ( ) [image_dimensions] => Array ( [width] => 400 [height] => 266 ) [is_default] => 1 [alt] => [title] => ) ) ) ) ) ) [#access] => 1 ) [raw] => Array ( [fid] => 648 [uid] => 1 [filename] => standardbild.jpg [uri] => public://default_images/standardbild_7.jpg [filemime] => image/jpeg [filesize] => 19607 [status] => 1 [timestamp] => 1369566211 [type] => image [field_file_image_alt_text] => Array ( [und] => Array ( [0] => Array ( [value] => standardbild_7.jpg [format] => [safe_value] => standardbild_7.jpg ) ) ) [field_file_image_title_text] => Array ( ) [image_dimensions] => Array ( [width] => 400 [height] => 266 ) [is_default] => 1 [alt] => [title] => ) ) ) )

how i have to write my code print $data->field_field_artengalerie_term_bild[0]['rendered'];to get the image.

regards


texts:
From some days I worked on one of issue related to drupal commerce services,

While two customers add in the same time a product whose the stock was only 1 in that case two order successfully completed. How this could happen?

Can anyone suggest there be a check in the code of the basket to avoid one of these 2 customers to add the same product?


texts:
I am trying to show a 3 level tab on the user profile page, but I cannot find a way of doing it.  I've managed to get a second level working, on my custom module on drupal 7.

<?php
/**
 *patners page with all the tabs
 */

$items['user/%user/patners'] = array(
    'title' => t('My deals'),
    'description' => t('this is to show patners ther items'),
    'page callback' => 'patners_page',
    'page arguments' => array(1),
    'access arguments' => TRUE,
    'type' =>MENU_LOCAL_TASK,
    'weight'=>-18,
);
$items['user/%user/patners/coupon'] = array(
    'title' =>'??????',
    'page callback' => 'patners_page',
    'page arguments' => array(1),
    'access callback' => TRUE,
    'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['user/%user/patners/statistics'] = array(
    'title' => '?????????',
    'page callback' => 'partners_statistics',
    'page arguments' => array(1),
    'access callback' => TRUE,
    'type' => MENU_LOCAL_TASK,
);
$items['user/%user/patners/coupon/all'] = array(
    'title' =>'??? ??????',
    'page callback' => 'patners_page',
    'page arguments' => array(1),
    'access callback' => TRUE,
    'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items['user/%user/patners/coupon/used'] = array(
    'title' =>'????????????',
    'page callback' => 'patners_coupon_used',
    'page arguments' => array(1),
    'access callback' => TRUE,
    'type' => MENU_LOCAL_TASK,
);
$items['user/%user/patners/coupon/pending'] = array(
    'title' =>'??????',
    'page callback' => 'patners_pending_coupons',
    'page arguments' => array(1),
    'access callback' => TRUE,
    'type' => MENU_LOCAL_TASK,
);
return $items;
?>


texts: How to use Rules to assign user badges to users with sufficient User points?

texts:
I want users on my sites to have badges assigned to them. I have user points,user badges, and rules module. User points is working fine. I have created a badge. Now I want that whenever a user's total points is greater than, say 50, he or she is assigned a badge. So, I went about to create a rule. However, I was not able to find any event, condition, or action for this. Please advice

Note: I tried to assign badges directly to users by going to their profiles and assigning them badges...however when i try to do so i get the following error:"My_Badge" is not a valid badge. Try using the autocomplete function (requires javascript). What is this?


texts: Using Views to filter the content based on the current month

texts:
I am building a site, using Views, that needs to filter the content for each month. I have created a date field on the custom content type, and I made a publish start and end date fields.

I need the view to change the content at the start of the new month. Can anyone please explain how to make a view only display content based on the current month?


texts: Logging into Drupal from a non-Drupal site

texts:
I would like to create an interface on a non-Drupal site that will allow me to login to my Drupal site?

How can I accomplish this, either with custom code or with an existing Drupal module?


texts: Custom made blocks not getting displayed in Blocks page

texts:
I am new to Drupal. I tried to write custom module(Sample).. After completion of Module, Enabled at Module. But it is not showing at Block Page.

Please check the below code and correct me..

first.info

;$Id$

name = First
description = A first module.
package = Drupal 7 Development
core = 7.x
files[] = first.module

;dependencies[] = autoload
;php = 5.2

first.module

function first_block($op = 'list', $delta = 0, $edit = array()){
    switch ($op) {
       case 'list':
        $block = array();
        //List out all blocks you want to create here
        $block[0]["info"] = t('Display info');
        return $block;
       case 'view':
        switch ($delta) {
          case 0:
            $block['subject'] = "ADMIN Header of the block";
            global $user;
            if(in_array('Site admin', array_values($user->roles) || $user->uid == 1)) {
              $block['content'] = "input form";
              $block['subject'] = "Header of the block";
            }
            return $block;
        }
    }
}


texts:
I am trying to use the rate widget in Drupal 7, and everything looks like it should work correctly, however it isn't displaying.

I'm on one of the node types it should appear under, it does not show up.

I used to have Fivestar installed, could that be an issue?

Here's a screenshot of the nodetypes I've selected

Any help would be appreciated, I can't find anything I've done wrong or that would prevent it from showing up.


texts: Getting different terms from different rows for the same node with Feeds

texts:
I have a kind of weird CSV file to import. The structure is like that:

ID| TITLE| TERMS
1 | Title1 | term1
1 | Title1 | term2
2 | Title2 | term3
2 | Title2 | term1
3 | Title2 | term5

I would like to get all the terms from different lines to the same node. In the end, the node with "Title 1" will have taxonomy terms of "term1" and "term2".

If I directly run the importer, I know that only last value will be taken to the term field.

In short, I would like to get multiple terms from different rows to the same node.

Anyone have an idea?


texts: I have been getting a lot of failed attacks targeting my server in the last few months. I have been using the Drupal IP block to block IPs that where sniffing for vulnerabilities. I would like to know if this is only for drupal or is it adding it to the OS as well. Also once I block an IP address what do the attackers see? Do they get a 404? Do they get a banned message? or nothing at all? If this is not also adding to the server OS IP block is there a module that will?


texts:
function term_parent($tid) {
  $row = db_result(db_query("select * from {term_data} where tid = ?",array($tid)));
  if ($row['pid'] > 0) {
    $term = term_parent($row['pid']);
    $row['classid'] = $term['tid'] . '^' . $row['classid'];
    $row['classname'] = $term['name'] . '^' . $row['name'];
  }

  return $row;
}

I don't know why it is using tid = ?. When should I use ?.
What's the meaning of $row['pid'] and of the following line?

$row['classid'] = $term['tid'].'^'.$row['classid'];


texts: Commerce- How can I modify order details with hook_commerce_paypal_wps_order_form_data_alter()?

texts:
I want to modify the information Commerce sends to PayPal so that the order description on PayPal describes the product, not the order (users on my site can only order one of two products, so I think that is more useful).

This is what I want to change:

These strings are in the Commerce Website Payments Standard submodule. I am using the hook_commerce_paypal_wps_order_form_data_alter() function as suggested in the answer to this question.

However, in the API, there is no example for this function (I also looked at the Commerce Examples module but didn't find anything), and I'm a bit lost about how to handle it.

The string I want to override is defined in commerce_paypal_wps_order_form() in this section:

    // Define a single item in the cart representing the whole order
    'amount_1' => commerce_paypal_price_amount(commerce_currency_convert($amount, $order_currency_code, $currency_code), $currency_code),
    'item_name_1' => t('Order @order_number at @store', array('@order_number' => $order->order_number, '@store' => variable_get('site_name', url('<front>', array('absolute' => TRUE))))),
    'on0_1' => t('Product count'),
    'os0_1' => commerce_line_items_quantity($wrapper->commerce_line_items, commerce_product_line_item_types()),
  );

I want to change item_name_1 to t('My string') and remove on0_1 and os0_1.

I tried this:

function MYMODULE_commerce_paypal_wps_order_form_data_alter(&$data, $order) {
  $data['item_name_1'] = t('My string');
  unset($data['on0_1']);
  unset($data['os0_1']);
}

But nothing is changed, even after clearing the caches.  I'm having a really hard time debugging this because it is called immediately before the redirect to PayPal, so even if I use dpm() I'm not able to see it.


texts: Excessive updates to cache_container table

texts:
I am maintaining a large drupal instance (10 nodes). Recently I am facing an issue.

The website was up and running. But the database was overloaded, MySQL binary logs kept growing abnormally, majority was an UPDATE statement to cache_container table. It kept growing upto point which crashed the MySQL cluster. I was able to quickly identify and make the site up. The binary logs was still growing. I cleared the cache and it worked. No more UPDATE statement to cache_container.

I have to file with the regulator, what is the root cause. Till now, I am not able to find out the cause for the constant UPDATE statements to cache_container that caused the DB crash.

I am using Redis.


texts: Changing URL alias of webform breaks template

texts:
I created a webform with a URL alias of contact-us. The edit URL is http://local.mysite.com/node/1/webform. I have two custom templates, page--node--1.tpl.php and webform-form.tpl.php. Everything works correctly.

Now I've been asked to change the URL alias of the page to feedback. As soon as I do this, the form stops displaying. I've error-logged things out, and when the alias is changed, it's not getting to the webform-form.tpl.php.

I'm confused - I understood that webform-form.tpl.php (without a specific form name) would be applied to any and all webforms. Is this incorrect? Or is there something else I'm missing that would cause a URL change to break this way?

Edited to add that there are no changes to template.php.


texts: Adding two contextual filters (Content : nid)

texts:
I want to display two type of contents : News and Events.
So I added them in the filters criteria. This works great.
Now I want them to be further filtered on the basis of the category the News and Events lie in. For example, I only want to display News and Events having category "xyz".
So what I did is, I added a reverse relationship for News and a contextual filter of Content : nid having the relationship that I made. This works OK and shows the desired news.
BUT
when I try to add another relationship and contextual filter, all the data disappears.

Any help in this regard would be highly appreciated!
Thanks!

Here are the sceenshots :


texts: Themes' screenshots not visible after 8.6.1 update

texts:
Once I have updated the multisite (using composer), all the screenshots images just stopped showing.

If I try to access the image directly (using browser) the message is like that:

Forbidden
You don't have permission to access /themes/contrib/bootstrap/screenshot.png on this server.

But the sites seem to work ok. It's just an admin UI problem.


texts:
Is it possible to create own login form? I need to insert it into my basic page. It is campaign for my client and he wants to be able login from specific basic page. I have tried to use block from classic login, but without success. But it still has many things around (like remember me etc..), and I need only basic username/password

thanks for any help


texts: Create "suggest an edit" functionality for anonymous users on nodes

texts:
I'd like to provide a way for anonymous users to submit nodes, but also provide suggested edits to existing nodes. The core node revision system cannot support this.

How would one implement a revisioning system that allow anonymous users to save updates which moderators approve. I'm assuming Workbench might get me halfway there.

Edit: like you find on Foursquare and Yelp, for community suggestions on editing venues.


texts: How to Use Ajax in form alter in Drupal 7?

texts:
I have created a content type named "main menu". I have few select lists which depend on one another. I wanted to display a different list when different checkboxes are selected. I figured out that I need to use Ajax to edit the form in order to achieve that but can anyone tell me how to use Ajax with hook_form_alter?

The form id of the form I am supposed to edit is "main_menu_node_form". When I try to access this form using hook_form_alter(), and add the #ajax property of the form fields, it seems that I am not able to do that since the fields are already rendered before the handle is passed to hook_form_alter(). Can anyone please help me solve this?

Note : I have created the content type using hook_install().

function main_menu_content_type_form_main_menu_node_form_alter(&$form, &$form_state, $form_id) {
  dpm($form);
  dpm($form_state);

  $form['field_mlnk'] = array(
    '#ajax' => array(
      'callback' => 'main_menu_content_type_form_main_menu_node_form_alter_callback',
      'wrapper' => 'link-div',
      'method' => 'replace',
      'effect' => 'fade',
    ),
  );
}


texts:
I couldnt find an answer to this question in Drupal 8.

I've created a simple custom module:

mymodule.info.yml

name: 'mymodule_name'
description: 'basic module for custom implementations'
package: 'custom'
type: module
version: '8.x-1.0'
core: '8.x'

mymodule.module

function mymodule_views_post_execute(\Drupal\views\ViewExecutable $view) {
    $view->setTitle('Foo');

}
function mymodule_views_pre_render(\Drupal\views\ViewExecutable $view) {
    $view->setTitle('Foo');
}

I tried this hook implementations separately, not at smae time. Both changes the view title, but my custom theme doesnt work.

I also tried in my custom theme the following code:

function mytheme_preprocess_views_view(&$variables) {
    $view = $variables['view'];
    $view->build_info["title"] = "Foo";
}

It prints "Foo" inside view content, it doesnt override view title.

Any idea?


texts: Which function(s) actually create the physical resized image files?

texts:
By default, Drupal 7 ships with 3 images styles: thumbnail, medium, and large.

For example, I upload a image file ('abc.jpg') with the image field (I assume the field name is called 'image'); while I am creating an "Article" node, the image file will be uploaded and stored in "sites/default/files/field/image/abc.jpg," and a record of this uploaded file is saved into database in the "file_managed" table.
By that time, the medium and large styles versions of "abc.jpg" is not yet created.

The teaser of the "Article" node displays the image field with the medium style.

Then, I navigate to the teaser viewmode of that node for the first time. The medium version of "abc.jpg" is generated, and sits in "sites/default/files/styles/medium/public/field/image/abc.jpg."

The default view is set to display the image using the "large" style.

I view the node using its default view, and the large version of "abc.jpg" is created in "sites/default/files/styles/large/public/field/image/abc.jpg."

Basically, the image upload is quite smart; when an image has been upload, Drupal won't create all the different styles version of that image. Drupal only creates the style of an image when you first browse to the view using that specific image style.

Which functions/hooks are creating the file for the styled images?


texts:
I use a CMI workflow with Git.

I made configuration changes on Dev
pulled them into Production
now when I go to admin/config/development/configuration and try to
import All I get this error:

  The configuration cannot be imported because it failed validation for
  the following reasons: Entities exist of type Taxonomy term en
  Vocabulary Catalog. These entities need to be deleted before
  importing.

What do I have to do now?


texts: How to make two vocabularies works as section and category for article?

texts:
So basically i want terms from first vocabulary to work as sections that users can add (movies, for example), and terms from second vocabulary to be fixed amount of categories (like actors, info, screenshots etc), that users can only choose from.

I already made two fields with both vocabularies, but they works separate (site.com/section and site.com/category). Obviously, i want path to look like site.com/section/category. Tried Pathauto, but it works in a different way and can't do such things.

Any suggestions?


texts: Block level configuration not available in reaction part of context

texts: I am new to context. I just want to disable a block for a particular URL. But i don't get block level configuration in reaction part of context. Anything else i have to do for it ?


texts:
The default behavior for user registration is that if a user tries to register with an email that already exists, it lets them know and asks if they have forgotten their password.

We have a custom link to our product download in the email the user receives, and what we'd like to do if a user tries to re-register with the same email is to just resend the email, without notifying them that they already have an account.

I can't seem to find a way to do this. Any ideas? I'm not super-experienced with Drupal anymore.

CODE

function create_vector_user_form_user_register_form_alter(&$form, &$form_state) {
    error_log("form alter"); // this logs
    $form_state['values']['pass']['pass1'] = 'password';
    $form_state['values']['pass']['pass2'] = 'password';
    $form_state['values']['op'] = t('Create new account');
    $form['#submit'] []= "create_vector_user_user_register_submit";
}

function create_vector_user_user_register_submit($form, &$form_state) {
    error_log("submit handler"); // this does not log
  $form_state['build_info']['args'] = array(&$object);
  drupal_form_submit('create_vector_user_form', $form_state);
  drupal_set_message("The form is being submitted, do some extra stuff now...");
}


texts:
In Drupal 8 I want to create content type for custom homepage slideshow so user can add image or link to video provider, but not both per node. For now I have content type with both fields, and in block plugin i give advantage on video field, so if video field is not empty he is displayed in slider, but if video field is empty image is displayed instead of video.

Any idea how to add checkbox so when user pick between video and image option in form will be displayed only one field to populate?


texts: How to use $query->add_where_expression in hook_views_query_alter

texts:
I'm trying to use hook_views_query_alter() to select some nodes based on a calculation using two fields in that node.  I can't find much documentation or many examples that help me understand how this works.

I could use Views PHP, but this module is very buggy in Drupal 7.

I think I need to use $query->add_where_expression() but I can't work out how to use it.

My view is called "latlong", and as a test to see if I have the right approach, I've tried to select nodes based on the value of field_latitude. Copying other functions i've seen through googling, this is my best guess, but it's not working. I know one of my nodes has the value 53.9519 so if my syntax is right I should get a row back, but I don't:

function my_module_views_query_alter(&$view, &$query) {
  switch($view->name) {
    case 'latlong':
      $query->add_where_expression(0,'field_data_field_latitude.field_latitude_value = 53.9519');
      break;
  }
}

If I print_r($query->where[0]) I get:

Array (
  [conditions] =>
    Array (
      [0] =>
        Array (
         [field] => field_data_field_latitude.field_latitude_value = 53.9519
         [value] => Array ( )
         [operator] => formula ) )
         [args] => Array ( )
         [type] => AND )

What am I doing wrong?


texts: How to render a paragraph field in Twig in correct language?

texts:
I've got nodes with hero images. The hero images are a paragraph field with unlimited cardinality, each with an image and a translatable text. For design reasons I need to print the hero images in page.html.twig (using Twig Tweak for simplicity)

{{ drupal_field('field_banner_slide', 'node', node.id) }}

The hero slider has some options like timer, size,... which are other fields on the same host node, and pulled in during preprocess

function MYTHEME_base_preprocess_field(array &$variables, $hook) {
  $parentEntity = $element['#object'];

  if ($parentEntity && $variables['field_name'] == 'field_banner_slide') {
    // attach JS library
    // add HTML data attributes on this field based on other field values of same host node
    // ...and so on...
  }
}

All worked fine until my site went to the translator. My slider always returned the default lang. Next I tried setting the language in page.html.twig

{{ drupal_field('field_banner_slide', 'node', node.id, 'default', language.getId()) }}

This works for every other field - except Paragraphs. I've also tried the alternative

{{ node.field_banner_slide|view('default', language.getId()) }}

but still the same language problem.

I've already checked the source code from Twig Tweak, it seems to correctly set the language

  public function drupalField($field_name, $entity_type, $id = NULL, $view_mode = 'default', $langcode = NULL, $check_access = TRUE) {
    /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
    $entity = $id
      ? \Drupal::entityTypeManager()->getStorage($entity_type)->load($id)
      : \Drupal::routeMatch()->getParameter($entity_type);
    if ($entity && (!$check_access || $entity->access('view'))) {
      $entity = \Drupal::service('entity.repository')
        ->getTranslationFromContext($entity, $langcode);
      if (isset($entity->{$field_name})) {
        return $entity->{$field_name}->view($view_mode);
      }
    }
  }

I've been really digging here, but I can't find any single error. How do I get my correctly translated paragraphs?

PS: I don't want to use {{ drupal_entity('paragraph', my_field_banner_slide_target_ids, 'default', my_langcode) }}, because I also need the preprocessing from the host field.


texts:
I am trying to integrate our Drupal 7 Commerce install with Digital River's where-to-buy widget.

All I need to do is add a little JS to the product page, with a script variable set to the product sku.  On page load, this inline JS runs and adds a button that when clicked will pop-up a lightbox with where-to-buy information.  This script has a variable that requires a SKU to be entered.  If I add the snippet to my node-template it works fine.

HOWEVER, I have several products on each product display, and I have 2 product attributes that can be selected.  This, of course, refreshes the node/entity field values in my page, like the title, a product image and so forth.  This will not refresh the sku parameter of my javascript snippet though, so my WTB button does not update.  IE, if I did something like this:

<script type="text/javascript">
          pswtb.loader.show({
            widgetConfigurationId: "3a4acc53-216e-48da-8e92-bfaeb58168a7",
            sku: "US_<?php print trim($content['product:sku']['#markup']) ?>"
          });
        </script>

I discovered that it would initially load but the product:sku wouldn't change as I selected a new attribute.

So, I also discovered that my values would update if they were displayed via the render() function.  So, if I just did this:

<?php print render($content['product:sku']) ?>

I would get an element that updates 'properly' when a product attribute is selected.  It does, however come with a lot of div's wrapping it, so I can't use it as a parameter in my script,and I didn't want to override the 'sku' field template because I need that sku elsewhere on the page, and even overriding the template, I would still get a wrapper around it.

Ok, so my next attempt was to create a 'virtual' field, using the virtual_field module.  This just lets you have a dummy field that doesn't get stored anywhere but still lets you create custom templates and specify display formatters.  I created a dummy field that just contains the product sku.

Using this, I created a custom field template (field--field-product-wtb.tpl.php) for this virtual field like so:

this will update: <?php print render($item); ?>
but this gets stripped out:
<script type="text/javascript">
   pswtb.loader.show({
     widgetConfigurationId: "3a4acc53-216e-48da-8e92-bfaeb58168a7",
     sku: "US_<?php print render($item); ?>"
   });
</script>

And then in my node template, I just do this:

<?php print render($content['product:field_product_wtb']) ?>

It works on initial load, and when a product attribute is selected, the sku does change (the 'this will update' part) but the entire script tag gets stripped out and my button disappears.  I guess because it gets filtered via some xss protection, but I haven't tracked it down.  As near as I can tell, this is because when content on a page is updated via ajax, the HTML returned from a tpl file is sanitized and things like script tags are filtered out.

Now I'm at a loss as to how to get this to work.


texts: How to create node and reference it in Drupal 7?

texts:
Possible Duplicate:
  Options for “create and reference”

How can I put a link "Add another item" on a node edit page that would create a new node and reference it at the same parent node ?

Also, I need to put Edit link beside the new created & referenced node.

I found modules like the Popups API and Popups: Add and Reference, but, sadly they are not ported to D7

Thanks for any hints!


texts: I'm trying to make certain blocks editable for users with a certain role. I'm looking for a module which would provide an in-place editor for blocks. There's a module for this called Block Edit but there isnt a drupal 7 release. Is there any other module similar to this? Thank you.


texts: Drupal 7 Views, paths, node associations via taxonomy

texts:
After many hours I still cannot wrap my head around what is needed to make my situation work. Here it is:

I current am using clean URLS like so /artists/name-of-artist routes content type Artist. I have content types: Arists, Album Releases, Tour Dates, and Media. I would like to tie everything together using vocabulary Artist Tags (yes, even Artist content type would get tagged). So, say for example I have "Test Artist" in Artist content. I tag it with "Test Artist" Artist Tag. I also create an Album Release tagged "Test Artist". My question now is when visiting /artist/test-artist how do I have a view that shows not only the dat from that artist node but also from the Album Release node tagged "Test Artist".

I have already tried Node Reference. This is not an ideal solution for me as I want the flexibility of library categorization via taxonomy. I just can't understand how I can pull in another node's content based on  /artist/test-artist Artist Tag field.

I forgot to mention that I am using the latest version of Drupal 7, and Views 3.


texts: Non-directional/symmetric relation between nodes of the same content type

texts:
In a Drupal 7 website I would like to create an "is similar to" relation between nodes of the same content type. The nodes are vessels (ships) and a vessel can be similar to several others.

Think of the similarity as a Volkswagen Golf I is similar to the VW Golf II, Golf III and so on. The relation is symmatric, because the VW Golf IV is similar to the Golf VII and vice versa.

In the current custom made website, which will be migrated to Drupal 7, there are over 6500 relations between vessels.

I've tried several modules, but I can not create what I intend:

the Relation module can not create relations between endpoints of the same entity type (e.g. nodes of the same content type);
the module Entity reference only creates directional relations. This would mean creating two references per relation, ending up with over 13000 references;
the References module also only creates directional relations, again ending up with over 13000 references.

So the question is: how do I create non-directional/symmetric relations between nodes of the same content type?


texts: Creating search form that will query SQL database and display results on a custom block

texts:
I am new to Drupal and have learnt about custom blocks.

Basically, I am trying to create a search page where on the left column will have all the filter/search criteria.

On the right column the results will be displayed in a specified format in a custom block. Not sure where to start on this work.

I have my back end ready with all the parameters going in correctly and results are displayed out of a stored procedure.

Not sure about how to wire up the front end filter criteria fields with backend SQL parameters.

I am using Drupal 8 - bootstrap theme custom blocks to design the page and SQL server (using SSMS tool) backend to achieve this. Any guide on how to start this? Thanks!


texts: How to change "Image style" of an Image field in a given view mode programmatically (as on "Manage display" tab after clicking the gear)?

texts:
I would like to change the "Image style" of some Image fields in some given view modes, which are attached to particular content types; I would like to do this programmatically.

This is what I would like to change:

How should I do this?


texts: Two step user approval after registration

texts:
I'm new to Drupal, and need help on user registration.

A user registers on the site by filling in fields which include: name , DOB, users email(user1), password and official contact email address(ocea).
Once the form is submitted, an email goes to official contact email address(ocea). The user is approved once the administrator will give his consent.

How I can I achieve this? A module? Rules?


texts: Restrict User Roles in viewing a Node Content Type without installing a module

texts:
Currently I want to keep my site slim without having to install big modules to do a small function. I know I can use the content_access module to restrict a user role to view a specific content type, but I was wondering how can this be done without any additional modules installed.

I have a content type of "widget" and I don't want it view-able by anonymous users. It should only be viewed by staff. How can you restrict/hide this content type from anonymous users without installing a module for it?


texts: How to adjust price in Drupal Commerce based on quantity and attributes?

texts:
I wonder how I can adjust the price in Drupal Commerce depending on quantity and attributes.

I found Commerce Price Table and Commerce Pricelist for quantity, and Commerce Pricing Attributes for attributes. Not sure which one is more matchable for that.

Any suggestions?


texts: How to create my own custom simple action in D8?

texts:
I'm creating a view that is used to review migrated content that was flagged for review during the migration process. I want to provide a bulk action on this view that allows the user to select a bunch and mark them as "resolved".

I created a custom action to do this following some guidance from https://www.drupal.org/node/2330631:

config/install/pu_news_migrate.action.resolve_news_migration_flag.yml

langcode: en
status: true
dependencies:
  module:
    - node
id: resolve_news_migration_flag
label: 'Resolve news migration flag'
type: node
plugin: resolve_news_migration_flag
configuration: {  }

And created the action plugin implementation:

`src/Plugin/Action/ResolveNewsMigrationFlag.php

<?php

namespace Drupal\pu_news_migrate\Plugin\Action;

use Drupal\Core\Action\ActionBase;
use Drupal\Core\Session\AccountInterface;

/**
 * Removes the "needs review" flag on a migrated news article.
 *
 * @Action(
 *   id = "resolve_news_migration_flag",
 *   label = @Translation("Resolve news migration flag"),
 *   type = "node"
 * )
 */
class ResolveNewsMigrationFlag extends ActionBase {

  /**
   * {@inheritdoc}
   */
  public function execute($node = NULL) {
    if ($node) {
      /** @var \Drupal\node\NodeInterface $node */
      if (!$node->hasField('field_news_migration_review')) {
        throw new \RuntimeException("News migration field not found on node.");
      }
      $node->set('field_news_migration_review', FALSE);
      $node->save();
    }
  }

  /**
   * {@inheritdoc}
   */
  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
    /** @var \Drupal\node\NodeInterface $object */
    $result = $object->field_news_migration_review->access('edit', $account, TRUE)
      ->andIf($object->access('update', $account, TRUE));

    return $return_as_object ? $result : $result->isAllowed();
  }

}

I also added a schema file: config/schema/pu_news_migrate.schema.yml:

action.configuration.resolve_news_migration_flag:
  type: resolve_news_migration_flag
  label: 'Remove the "needs review" flag from a migrated article.'

I uninstalled the module and re-installed it so that the action definition is loaded into Drupal's config.

However, when I view the list of actions I can select in views, it doesn't appear there. I enabled the "Actions" module which displays a list of all actions, and it does not appear there either.

What did I do wrong here?


texts: Get NID of newly created node from entity_metadata_wrapper

texts:
I need to pull the nid immediately after it is created using entity_metadata_wrapper as a creation method.

Here is a brief example:

$values = array(
  'type' => 'content_type',
  'uid' => $user->uid,
  'status' => 1,
  'comment' => 1,
  'promote' => 0,
);

$entity = entity_create('node', $values);
$wrapper = entity_metadata_wrapper('node', $entity);
$wrapper->title->set('title');
$wrapper->save(true);
entity_save('node', $entity);

// From this, where can I get a NID value for the node that was just created?


texts: Move views pager to top of node instead of bottom

texts: Is there a simple way to move views' pager to a different place than the default bottom?


texts: How to create a rule for changing a user field to a random string?

texts:
Using the Rules module, I would like to have a replacement the is a random string.

I have added a new user field (= some_var, which is a 'Text field' data type), which I would like to change to some random string after the User account is created.

Any ideas or hints to get this to work?


texts: What is the proper way of using existing fields?

texts:
I'm a Drupal beginner. I'm a bit confused about adding fields to content types.

Case 1: Suppose if I have three content-types Book, Article & White Paper. I created Authors vocabulary which contains list of all Authors.

Now, Should I create "Written by" field (term-reference to Authors) for each content-type or create the field for one content-type and use it in other content types?
What are advantages/disadvantages of either methods?
What happens if I delete a reused-field from one content-type? Does it get deleted in all others?

Case 2: I've follwing content-types: (with specified field requirements)

+--------------+----------------------+
| Content Type | Field Required       |
+--------------+----------------------+
| Book         | Year of publication  |
+--------------+----------------------+
| Presentation | Date of Presentation |
+--------------+----------------------+
| Article      | Date of Publication  |
+--------------+----------------------+
| Event        | Held On              |
+--------------+----------------------+

What should I do? Should I create a single field for one content-type & use it for all other content-types or create field for each content-type?

Help me understand clearly when & how to appropriately re-use existing fields.


texts:
I want to hide the field "form key" in all of the webform components.
I tried doing it with "*hook_form_alter*" and with "[#access] = false" but I can't succeed in this.
I also tried to use "*hook_webform_component_load*".

But in all of those, i can't understand exactly what I need to do to hide the form key field in all of the components in all of the webforms. I can't even hide one component's "form key" field. I don't understand which is the field that i need to modify.

p.s - im using form_builder too.

I'm doing something wrong.

any help will be appreciated.
thanks, alexandra.


texts: How to call AJAX on check-box of form API?

texts:
I need to get radio buttons in a form, whenever a checkbox gets enabled/clicked.
Say, I have 5 items listed in a checkbox, named orange, apple, .....When I enable orange checkbox, a set of radio button comes that will ask color of the corresponding fruit. Any working example regarding this will be highlyy appreciated.

EDIT:

$form['toggle_me'] = array(
  '#type' => 'checkboxes',
  '#title' => t('Tick this box to type'),
   '#options' => array(0 => t('Orange'), 1 => t('Apple')),
);
$form['settings'] = array(
  '#type' => 'radios',
  '#states' => array(
    // Only show this field when the 'toggle_me' checkbox is enabled.
    'visible' => array(
      ':input[name="toggle_me"][#options][0]' => array(0 => t('red'), 1 => t('yellow')),
    ),
  ),
);


texts: How can we go to particular #div on a page using drupal_goto()?

texts:
There is one scenario where I want to go to particular div on page using drupal_goto().

Below is my code:

$path = '#textarea_comment'.$alert_id;

$options = array('bid' => $bookingid.$path );

drupal_goto("/fsaclientservice/viewreservation", $options);

In the above code the # is get replaced with %23 in URL and due to this I am not able to redirect to particular div on a page.

I have tried :

encodeurl()
rawencodeurl()

But still the URL is coming as %23 etc. Please help.


texts: Unable to fetch image after using Content Import and IMCE module

texts:
I am trying to import content for custom content type fields using csv, in content I have images fields as well and using the Content Import Module for CSV import and IMCE module for image upload. After import CSV all content showing but images not showing. The path for images also storing in file_managed table
I have set the permission of the folder still its now showing the images

Also place the image in the /sites/default/files/artist/hero
Please help with this problem?


texts: How to load certain old submission value into webform?

texts:
I collect data in a web form.
As one of the first fields, it has a dropdown with which it selects a certain ID.
Later on, there shall be grouped elements like this:
value_old | value_new | diff

value_new is just the new value, that the user shall provide.
diff is the computed difference value_new - value_old and I think that I can implement that as a "Computed Twig" element.
value_old is a bit more complex.
This should be the value_new from the newest submission already in the database for the same form, where the ID from the dropdown in the beginning was the same.
I think, the solution should go in a direction of a token definition for the value_old or so, but I'm not sure on whether this is a) the right direction and b) how this could be done.


texts: Form Submit Handler not firing on Page Reload with GET parameters

texts:
I have a simple form

function example_form($form, &$form_state) {
  $form['#attributes']['method'] = 'get';
  $form['button'] = array(
    '#type' => 'submit',
    '#value' => 'Submit',
  );
  $form['search'] = array(
    '#type' => 'textfield',
    '#required' => FALSE,
  );

  return $form;
}

and a submit handler

function example_form_submit($form, &$form_state) {
  $form_state['rebuild'] = TRUE;
  drupal_set_message(t('Form Submitted'));
}

When I click the button, the form submits properly and the URL gets all the form parameters.

but when I reload the page with all those URL parameters, the example_form_submit() is not firing, how do I make my form submit/fire the submit hook when the URL is reloaded with GET parameters?


texts: Entity Reference multi value fields, filter on parent

texts:
I have two content types: Family and Members. Family content type has an entity reference field of type Member and can have unlimited values(multiple values).
My question is: How to create a view that enables me to filter Members based on Family.
Thanks


texts: Can I clone a view but keep it independent of it's content?

texts:
I'm looking to duplicate(clone) of a view, so that I may reuse it on other pages and have it will not pull through the same content.

I'm using Views 7.x-3.8 on Drupal 7.34 this will be updated later when the site goes live.


texts:
I am trying to import product kit from CSV file but I am not getting how to import it as I need to link with products in product kit.

I am using Ubercart, Feeds and Ubercart product mapper to import.

Any suggestions?


texts:
Is it possible to register hooks dynamically? I.e. not by hardcoding the hook handler into your code.

For instance, I'm writing a module and would like to add an option to some content type creation pages. I know this can be done using the hook_form_FORM_ID_alter hook, but since I don't know what node types will exist in the drupal installation I obviously can't hardcode the hooks.

Or will I have to use hook_form_alter or hook_form_BASE_FORM_ID_alter and check whether the option should be shown for that form? I'd really, REALLY would want to avoid that, since it's a really icky solution.

Or am I approaching this the wrong way?


texts: What's the best way to create a booking form?

texts:
I need to create a booking form for an event.
This form will contain normal text field plus one drop down list with the number of tickets.
There will be a prefilled field with the price of the single ticket that user can modify.
After the field with the price of the single ticket there will be an other field with the total price of the tickets and when they select the number of the tickets automatically the total price will be updated and stored in the database after the form is submitted.
After the submit I need to send an email, I can use mime-mail but let me know if I need to change method due the live field of the prices.

There is not online payment expected.

Let me know if everything is clear.