texts: After creating a node in activity module I am getting an error "undefined index"

texts:
After installing the Activity module, there is a default view activity/all.

After creating an activity template I am able to see the view result as I required.
But why am I getting this error?

Notice: Undefined index: table in _node_query_node_access_alter() (line 3364 of C:\modules\node\node.module).
Notice: Undefined index: table in _node_query_node_access_alter() (line 3364 of C:\modules\node\node.module).
Notice: Undefined index: table in _node_query_node_access_alter() (line 3364 of C:\modules\node\node.module).
Notice: Undefined index: table in _node_query_node_access_alter() (line 3364 of C:\modules\node\node.module).
Notice: Undefined index: table in _node_query_node_access_alter() (line 3364 of C:\modules\node\node.module).
Notice: Undefined index: table in _node_query_node_access_alter() (line 3364 of C:\modules\node\node.module).


texts:
I am using js injector to add script to my drupal website. But the script is also loading on the admin pages and node edit pages.

I have selected the option

Add tracking to specific pages  Every page except the listed pages

and defined admin/* which removes the script from admin pages but what path should I define to exclude the script from the node edit pages


texts: Move entity properties into existing tabs like Node?

texts: When creating a custom content entity, how can I get the properties to automatically arrange themselves on the form like adding/editing a node does out of the box? I'd like the experience to be consistent if possible. See attached photo.


texts: Random product variations "not available"

texts:
Of ~800 Commerce product variations, ~30 are not available for purchase on their respective display pages. These offending variations are completely set up like their brothers & sisters, Title, pricing, sku, and status. I see nothing wrong with them, through the /admin/ gui. But when visiting the display pages, for these offending products, Add to Cart is displayed as Product not available.

I can't find any information online concerning a similar problem. I'm also novice enough, to not know the best way to go about solving this issue.

Drupal and Commerce are the latest versions. If there's any other information I can offer, please let me know.


texts: Access denied when I try to rebuild permissions as admin

texts: I recently upgraded Drupal/OpenOutreach. Now, logged in as administrator (all possible permissions checked) I get a warning on every page to rebuild permissions on the site. But whenever I click to rebuild I get an Access Denied page. Note - I am not an advanced Drupal user so please make suggestions very user friendly. Thanks


texts: Categorized view for an entity reference content

texts:
I am trying to implement a Magazine in Drupal 9. I am confused about whether to use taxonomy term or content type since the data I want to handle is used for both categorizations and storing of content.
I have the following content structure.
A Magazine will have a number of articles, which are categorized under Topics.

Magazine 1

Topic 1

Article 1
Article 2

Topic 2

Article 3

Magazine 2

Topic 2

Article 4
Article 5

Topic 1

Article 6

At present, I am trying the following:

Magazine - content type
Article - content type
Topic - Taxonomy term

Should I use taxonomy term or content type for Magazine? The Magazine content type is used for storing content (for example, cover image, description, and date) and also can be thought of as categorizing the articles and topics.
Please note: A topic can be used in multiple magazines.
I have already gone through the following:

Difference between nodes and terms
Creating content hierarchy

I hope someone can guide me through the correct path.


texts: How do I display Search API Facets and Openlayers Proximity search in one view?

texts:
I am trying to add search facets to a specific views page that uses the openlayer proximity filter. So far I can only show facets in a view if I create a new view showing the search index I created in the search api.

If I chose to show 'node' or anything else other than a search api index, no facets will show up.

Now I am using openlayers proximity filter. This option again is only available if I chose show 'node' when creating a new view.

How do I get to display both my facets as well as the proximity filter in a view?


texts:
I want to overwrite the block generated template drupal commerce "commerce cart" using the bootstrap theme.
What I need is the name with which overwrite block.tpl.php theme for that specific block bootstrap


texts:
I'm loading 5 media gallery nodes into a single page via node_load_multiple().  Unfortunately the load time is very slow, several seconds.  I read up on Drupal's caching mechanism, and Jeff Eaton's tutorial and got the idea that I could cache each gallery node via the #cache array on the node's renderable array.  I think I've set everything up correctly, but I'm not seeing any increase in performance.  Any idea what I've done wrong or neglected to include?  Here's what I've done on a page.tpl.php for the page that contains the galleries:

$nodes = node_load_multiple($nids = array(1653,1654,1656,1657,1658), NULL, FALSE);
$i = 0;
$cid = "gallery_cache";
foreach ($nodes as $gallery) {
  $renderable = node_view($gallery);
  $cid .= $i;
  $renderable['#cache']['cid'] = $cid;
  $renderable['#cache']['bin'] = 'cache_page';
  $renderable['#cache']['expire'] = '1392001200';
  print drupal_render($renderable);
  $i++;
}


texts:
We have a production system xxx.org and a test system at test.xxx.org. We copy production to test.  Some of the URL's on the test system keep pointing to production where we want them to point to test.xxx.org.

The production URL looks like they are hard coded in the menu.

We want to easily move production to test so we can test the next version.


texts:
Let's say we have a content with these fields:

Title
Category
Price
Mobile
Skype
City
E-mail

A checkbox for "Remember my settings" that will remember these fields:

Mobile
Skype
City
E-mail

When user is registered in profile edit will have an option to change (I guess this will be able to achieve with Profile2):

Mobile
Skype
City
E-mail

After changing these details, the next new content form will have a checkbox for "Use my settings" to use the settings from the profile form details. Is it possible to do this with a module or hook in Drupal 7?

I'm not asking for someone to explain me the details (even it's very welcomed), but I'm asking if it's possible, what module or hook should I use? I hope this doesn't sounds too broad.


texts: View output a custom designed teaser then full post separate design

texts:
I have a design that requires and custom design for the teaser view. I need to output the custom teaser view then have the full post follow another template.

The teaser has a float left thumbnail image and a few lines of text to the right. The actual post will have many images and text.

Is this possible?


texts: What are the appropriate configurations for the Subdomain module on Window 7 running XAMPP?

texts:
I have installed the Subdomain module (v 6.1.7), and I'm configuring a subdomain for testing on localhost.

I have been tearing my hair out for days now, trying to get this module to work on my PC - and I'm still stuck on the settings/configuration stage. I have scoured the web for help in vain, and now I'm appealing for help here.

My vital stats: Win7, XAMPP, Drupal 6, Subdomain 6.17. (I gave up on 6.2 because it turned my links into www.localhost/....)

My site is localhost/ideastar.

Here are the changes I have made:

settings.php

$cookie_domain = '';

Leaving this commented out gives me an error ("The $cookie_domain variable in settings.php is not set".)

Uncommenting and putting in "localhost", ".localhost",  "ideastar", ".ideastar" gives me an "Access denied" error.

It seems to accept "localhost/ideastar" or a blank ' ',  although I don't know if this is the right thing to do.

host

127.0.1.1   localhost  ideastar

(and I can successfully ping ideastar)

http.conf

NameVirtualHost *:80
<VirtualHost *:80>
ServerName ideaster
ServerAlias *.ideastar
DocumentRoot C:/xampp/htdocs
</VirtualHost>

Can someone please help me get past the following errors?

Subdomain Prerequisites

  To enable subdomains on your website, you must first configure the following 5 items. If something isn't working, refer to the suggested solutions and make sure you have completed each step outlined in readme.txt.

  DNS server show/hide details: Not working yet
  test-1.localhost: Failed to resolve
  test-2.localhost: Failed to resolve
  test-3.localhost: Failed to resolve

  It appears your DNS server is not setup to handle wildcard subdomains (*.localhost) for localhost. Edit the DNS zone file or settings for your server to fix.

  PHP caches DNS lookups, so you'll want to restart your web server after making changes to your DNS server to see the results of your changes on this page.

  Web server: Unable to test
  Unable to test Apache settings until DNS wildcard subdomains are working
  Drupal's inbound URL rewriting - show/hide details: Not working yet
  HTTP request to http://subdomain-test.localhost/ideally/subdomain/test resulted in an internal Drupal path of . It should have been ~subdomain-test/subdomain/test
  The custom_url_rewrite_inbound() function in settings.php is rewriting the internal path incorrectly. Did you patch settings.php? See readme.txt for instructions.

  Drupal's outbound URL rewriting - show/hide details: Working
  Drupal API: url('~subdomain-test/subdomain/test') returned 'http://subdomain-test.localhost/ideally/subdomain/test'
  $cookie_domain in settings.php - show/hide details: Set
  The $cookie_domain variable in settings.php is set to ''


texts: How to make Adaptivetheme dropdown menu show on start page?

texts:
I'm using Drupal 8 with an Adaptivetheme subtheme. The horizontal navigation menu resides in the leader board region. Some menu entries have submenus, but they do not show on the start page. One has to click on the respective menu (e.g. "Football"), which loads the single page "Football", and it is only here that submenus will be shown.

Is there a way to make submenus work on the start page with Adaptivetheme?


texts: Calling a PHP script from Drupal retrieves different result than calling it outside Drupal

texts:
I'm trying to create a module that creates a Shortlink using Google Apps Shortlink Api (undocumented since its still in labs).

Here's the script (also at http://drupalbin.com/18667):

function drapps_shortlinks_createlink($url, $verbose = FALSE, $bypass_validattion = FALSE) {
  //loads ShortLink Class
  include_once('ShortLink.php');

  // URL validation with 2 clauses:
  // 1 - FILTER_VALIDATE_URL -> tests if the url is well constructed
  // 2 - @fopen -> tests if the URL actually exist
  if (!filter_var($url, FILTER_VALIDATE_URL) OR !@fopen($url,"r")) {
    // URL not valid or inexistant, so bail
    if ($verbose) {
      $msg = 'Invalid URL';
      return $msg;
    }
    else {
      return;
    }
  }

  // Get configuration values
  $domain = 'mydomain.com';
  $key = 'someHMACKEY';
  $user = 'username@mydomain.com';

  // Check if user admin has configured DRAPPS and DRAPPS ShortLinks
  if (!$domain OR !$key OR !$user) {
    //Something is missing so bail
    if ($verbose) {
      $msg = 'DRAPPS Shortlinks is not configured. Please go to admin/settings/drapps';
      return $msg;
    }
    else {
      return;
    }
  }

  //PHP Google Apps ShortLinks Implementation
  $slink = new ShortLink($domain, $key, $user);
  $r = clone $slink->pub($url);
  $status = $r->status;

  if ($status == 'ok') {
    return $r;
  }
  elseif ($verbose) {
    return $status;
  }
  else {
    return;
  }
}

This script uses a custom created class called SHortLink.php.

EDIT: This function is called in Drupal's node-news.tpl.php like this:

...

<?php print drapps_shortlinks_createlink($url, TRUE, FALSE); ?>

...

test.php

<?php

$path = "path/to/drupal"; //changed for security reasons

include_once($path . 'sites/all/modules/drapps_shortlinks/drapps_shortlinks.inc');

$url = 'http://www.google.com/';

print drapps_shortlinks_createlink($url, TRUE, FALSE);

?>

When I go to http://www.mydomain.com/test/test.php, the script works fine and I get an 'ok' response from google; a short link is created and it works fine. When I navigate to a news node, the script runs OK, but Google responds with a 403 (forbidden) error.

EDIT_1: THIS SCRIPT WORKS. So i think I can safely assume that the reson behind this has something to do with drupal rather than the script itself.

EDIT_2: I think the real question behind this is: What reasons could make a script behave differently when called from drupal? Any input will be appreciated: brainstorming, ideas, tips, troubleshooting methods, anything you think that might help, I will really appreciate it.


texts: File upload field conflict with fields with ajax callback

texts:
I'm having a problem with my form with fields having ajax callback.

I have a dropdown field with ajax callback and a file field that accepts csv file. Whenever I try to upload a file on that file field, it is resetting the value of my dropdown field.

Can someone help me in fixing this problem?

Thank you.

function mymodule_form_node_campaign_form_alter(&$form, FormStateInterface $form_state, $form_id){

if (isset($form['field_camp_location'])) {
        $form['field_camp_location']['widget']['#ajax'] = array(
        'callback' => 'location_change_callback1',
        'event' => 'change',
        );
    }
$form['field_camp_location']['widget']['#options'] = populate_location1_options($form, $form_state);

    if(isset($form_state->getValue('field_camp_location')[0])){
        $lid1 = $form_state->getValue('field_camp_location')[0];
        \Drupal::logger('LID1 VALUE')->notice('Content: '. print_r($lid1, TRUE));
    }else{
        $lid1 = array();
    }
}

function location_change_callback1($form, $form_state){

    $response = new AjaxResponse();
    $response->addCommand(new ReplaceCommand("#edit-field-camp-location-wrapper", ($form['field_camp_location']))); //test
    $response->addCommand(new ReplaceCommand("#edit-field-camp-cid-wrapper", ($form['field_camp_cid'])));
    $response->addCommand(new ReplaceCommand("#edit-field-camp-location2-wrapper", ($form['field_camp_location2'])));
    $response->addCommand(new ReplaceCommand("#edit-field-camp-cid2-wrapper", ($form['field_camp_cid2'])));
    $response->addCommand(new ReplaceCommand("#edit-field-camp-location3-wrapper", ($form['field_camp_location3'])));
    $response->addCommand(new ReplaceCommand("#edit-field-camp-cid3-wrapper", ($form['field_camp_cid3'])));
    $response->addCommand(new ReplaceCommand("#edit-field-camp-location4-wrapper", ($form['field_camp_location4'])));
    $response->addCommand(new ReplaceCommand("#edit-field-camp-cid4-wrapper", ($form['field_camp_cid4'])));
    $response->addCommand(new ReplaceCommand("#edit-field-camp-location5-wrapper", ($form['field_camp_location5'])));
    $response->addCommand(new ReplaceCommand("#edit-field-camp-cid5-wrapper", ($form['field_camp_cid5'])));
    return $response;

}

So this is my code.

I 'am populating content based on the selected location.

What is happening is, whenever i upload a file on my file file $lid1 value becomes NULL but the dropdown value has not change.


texts:
When you install Drupal 7, you notice that RDF is enabled by default. Now... I have a website called 7 Tutorials and I am wondering if RDF is useful, considering the content shared on the website.

I read a bit about it and learned that the "Resource Description Framework" is the standard for encoding metadata and other knowledge on the Semantic Web.

I admit I did not research much about it and I am not sure I fully understand its use cases but, it sounds to me RDF would be useful only to websites which share data in a structured way. Is this correct? Would I have anything to gain by enabling RDF on my website? (e.g. help with SEO).


texts: Teaser is missing CKEditor when uncollapsed

texts: I have text with summary fields on my entity and for some reason the ckeditor is present only on the body, not on the teaser if I uncollpse it. What could be the issue?


texts:
We are building our website in Drupal 7. However, I wonder whether we need to configure and setup the PHPMailer module.

We are designing an ecommerce website that will send an email upon registration, online purchase, forum activity, etc.
We are confused about whether we need to configure PHPMailer in Drupal 7 or we can make use of Google SMTP services. We are totally clueless about this as we have been struggling to setup the PHPMailer.


texts: How to get distinct nodes for a view and its attachments?

texts:
I have a view of type "block" showing 1 node and another display attached to that block showing 3 nodes, in both displays nodes are sorted randomly, the problem is that I can't find the way to add a "distinct" for both views, so sometimes both displays show the same node because of the random sorting

Is there any way to solve it?

EDIT: I've posted an image with the real view, has you can see in this case first and the third nodes are duplicated, sometimes it happends because i need them to show randomly


texts: Can panelizer automatically switch layouts based on a condition?

texts:
For a new project I'm starting, Panels+Panelizer seems a very good fit, but I'm still figuring out how to do some advanced things with it.

I like the fact that you can define the default layout and content panes for a certain node type, and allow the editor to override the default panes per node.

In some cases I want the layout and content panes to be dependent on certain conditions. For instance, if the date field on a node is not empty, I want a calendar pane in the right column; otherwise I want a 'related news' pane.

I have read about visibility rules, but the options seem rather limited (eg. there is no "not empty" condition for fields) and it does not allow you to change the layout completely. Which other methods exist make the default layout and content panes depend on certain conditions (other than the node type)?


texts: Show 'submitted by' date in a language different from English

texts:
I want to change the "submitted by" field. I want to show the date in another language. When I use views to display dates, the date shown is in the correct language.

When I add this to node.tpl.php, the date is in English.

echo date("j F Y", $node->created);

What is the correct way in Drupal to show the date like "17 december 1978" when the language set in Drupal is Dutch?


texts: I am currently working on a team of four people trying to develop a simple news website. We are having a hard time figuring out the best way to collaboration. I've found other threads that suggested using Features module; however, that is outside of our scope at the moment. Can you suggest a simpler way to collaborate?


texts: How to pass the nid from hook_node_view to the submit function?

texts:
I need one button at the end of one content type view form. This button should redirect the user to another page.

I have something like the following code:

function mymodule_node_view($node, $view_mode, $langcode) {

    if ($node->type == 'my_type') {
            $form = drupal_get_form('redirect_button_form');
            $node->content['redirect_button'] = $form;
            //$node->nid is the data I need in the submit function
    }
 }

function redirect_button_form($form, &$form_submit) {
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Redirect button text'),
    );
    return $form;
}

function redirect_button_form_submit($form, &$form_state) {
    $path = 'mypath';
    $options = ****I need the nid here;
    drupal_goto($path,$options );
}

How can I pass the nid from the hook_node_view to the submit function?


texts: how to discover where mini-panels are surfaced in Drupal 7

texts:
We have an old, infrequently updated site which has a custom module which we wrote that either needs to be updated or removed.

This module provides two blocks, and if those blocks aren't being used, we can remove the module. Otherwise, we have to update it to use new functionality, which we would like to avoid if it's not necessary.

I looked under the admin/structure/block menu and discovered they are not placed in any regions.

Since I'm a back-end developer, and not really familiar with the theming and templating, I asked one of our front-end devs if the blocks might be used in any other places on the site. She looked through the pages and panelizer stuff, and discovered that the block is being used in a Mini Panel.

So now, the question is, is the mini-panel surfaced to end-users? Nobody presently at the organization is familiar with mini-panels and how they are used. Is there a way, either through the UI or perhaps looking through the tables, to find out of a particular mini-panel is being used?


texts:
Is there a limit to the amount of content that can be placed in a ctools modal window?  I looked at the ctools modal code, here on stackexchange, and did a Google search - no joy.

I'm upgrading a site for a client, and they want a modal window to display profile data for faculty members, but we're still supposed to pull that profile data from another one of their sites, as is.  We're doing the same thing, successfully, for another area of the upgraded site, but the data (obtained using file_get_contents()) is much smaller in size in that case.  Where I'm having problems, a typical page I'm supposed to fetch runs to about 62K.

I can successfully display a truncated version of a given page - though even then, I find I have the most success if I actually stop/re-start my browser (even flushing the cache doesn't seem to help as much) if I'm pushing the upper limit of what can be displayed, which is around 30k.

Anyone know where I'm running into a limit, and if it's configurable?

TIA,
Lee


texts: Related nodes displaying same related data

texts:
drupal 7, using views and eva.

So i have restaurant nodes and menu nodes, and all menus nodes relate to a restaurant node, now i have a duplicate restaurant node which is just showing an alternative location for the same franchise, how can i reference the menu nodes related to the first restaurant node into the 2nd duplicate one? (which has a seperate nid)

So end result i am looking for, is if node-rest1 is called, it displays the node-rest1 output, followed by the related nodes (currently using eva), and if i open node-rest2 it shows node-rest2 output followed by the related menu nodes from node-rest1.

is this possible and if so how?


texts: Custom page callback gave 404 but the page content is correct

texts:
I have a page callback that shows users' related content and displays a custom login form if user is not logged in.

The site worked in another server, but today I migrated it to this laptop, and the page gave 404, while the content is as normal. I have check Apache's configuration, it is OK and other internal paths worked well.

function camp_orders(){
    global $user;
    if($user->uid > 0){
        // some code here
        return theme("camp_user_orders", array('camps' => $camp_types));
    }else{
        return drupal_get_form('camp_mobile_login');
    }
}

update

The clean url system works well. The page is rendered correctly, but the response code is 404, and the form cannot be submitted.
However the response code is correct (200) when I use query parameters like ?q=path.


texts: How to perform a redirect to custom page after node save or delete?

texts:
What I'm trying to do doesn't work, I still get redirected to /node/{id}:

function hook_form_alter(&$form, $form_state, $form_id) {
  $form['actions']['submit']['#submit'][] = 'callback_set_redirect';
}
function callback_set_redirect($form, FormStateInterface $form_state) {
  $form_state->setRedirect('custom.landing.page');
}


texts: How to close a lightbox2 modal form after hitting a button in the

texts:
I would like to have all delete pages in a modal form in Drupal 7. For this I choosed Lightbox2. if this can be achieved in another module this is also ok. In a view I add

rel="lightframe"

to the link for a node can be deleted. This is working perfect. The window is now opened in a modal form.

There are two buttons on this form. Confirm or Cancel

I rewrote the cancel button with hook form_alter:

 $form['actions']['cancel'] = array(
      '#type' => 'submit',
      '#value' => t('Cancel'),
      '#attributes' => array('onclick' => 'parent.Lightbox.end();'),
      );

This works good.

For the Submit button I do not get it working correctly
The code:

 $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Verwijderen'),
      '#attributes' => array('onclick' => 'parent.Lightbox.end();'),
      );

This will close the window but:
1) not executing the orginal action of deleting the node
This can be done with

 '#attributes' => array('onsubmit' => 'return TRUE', ),

but then the window is not closed.
2) not refreshing the original page.

How to achieve this?


texts: What is the design pattern for plugins (and their managers) called?

texts:
I am trying to figure out how to design (and subsequently implement) as plugin-like solution in Symfony.
I found this article https://drupalize.me/tutorial/what-are-plugins?p=2766 that says:

Plugins are a general reusable solution to a recurring problem within a given context... we call this a design pattern. This one just happens to be specific to Drupal.

Looking for a definition and/or links to similar design patterns.


texts: Registration and Login form having different styles

texts: I'm trying to style the login and registration form in different styles in my drupal 7 website. By default they share the same styles. Is there any way to change that?


texts:
I have a website built in Drupal 8.
In one of the basic page, I have to add a search box which searches only the contents in that specific page.
Please suggest the best practice to implement this.
Thanks.


texts: Limit node reference to 1 per user & per referenced node, Drupal 7

texts:
I am trying to limit the creation of a node reference to 1 per user and per referenced node.
More specifically: I have a content type named Debate and another one called Vote. Vote has a node reference field (from URL widget) called *debate_ref* to the Debate type. What i'm trying to achieve is for each user and for each debate to have only one vote
i.e. when a user tries to create a 2nd vote node on the same debate node then he will recieve a message saying "You have already voted!".

"Unique field" module does the job but after the user attempts to save his 2nd vote node. What i would like to achieve is to deny access to the user who attempts to re-visit the "node/add/vote/nid" form if he has already voted for the specific debate.

Any help?


texts: Cannot seem to find solid literature on using mysql-ssl connections with either Drupal 6 or Drupal 7. Piece of cake with wordpress. Is this a possibility, if not why?


texts:
I have a content type called Events. I would like to override the tpl file of exposed form in events listing.

I tried events_preprocess_views_exposed_form to add a template suggestion, I tried to add MYTHEME_preprocess_views_exposed_form to do the same thing, I tried simply to add views-exposed-form.tpl.php in my templates directory from MYTHEME directory but with no success.


texts: Extract all images out from each node in content type

texts:
Every time a new node is published within a single content type, I wish to extract (not remove) all the images out from that node's body and save the URL(s) of the images in the database. I will then use the URLs to make a slideshow of the images on a separate node.

I have three questions:

Which hook runs right before a node is published?
What's the best way of saving those URLs in the database?
Which Drupal function do I use to retrieve those URLs from the database?


texts: Problem in creating instances (creating two sample modules)

texts:
I just started learning how to develop modules in drupal 7 using entities.
I am creating two modules Artwork and Windfarm

in artwork i am adding 2 custom fields (artist_name and Location)
in Windfarm i am adding 4 custom fields

Following is for windfarm

 foreach ($instances as $instance) {
    $instance['entity_type'] = 'node';
    $instance['bundle'] = 'bndlwindfarm';
    field_create_instance($instance);
  }
}

this is fro artwork

foreach ($instances as $instance) {
    $instance['entity_type'] = 'node';
    $instance['bundle'] = 'artwork';
    field_create_instance($instance);
  }

both these code are part of function which implements hook_install()

problem is :

if i install artwork i am able to see 2 fields and after that if install windfarm i am not able to see my 4 custom fields

in reverse way

if i install windfarm first i am able to see 4 fields and if i install artwork after this i am not able to see 2 fields of artworks..

i am not getting why it is happening??
both of them has same entity_type i.e node and different bundle names??

Expected behavior : if i install both modules in each module i should see custom feilds
let me know where i am going wrong


texts: Is there a better way than twig files overwrite?

texts:
In my project, I have a " field--node--title.html.twig " file, I used this file to overwrite the title label to be able to give it a certain class.

I know you can be more specific using " field--node--title-x.html.twig ", Where x can be a block or a page!

I was wondering if there exists a better way of doing this. Maybe I could do IF conditions inside " field--node--title.html.twig " file to check for a certain block or a certain page.

This would be much easier and it would also decrease the number of files in the field folder in templates.


texts: How do I create a system message for a user's first failed login attempt?

texts: When using the core login block on the homepage, it appears that the failed login system message, "Sorry, unrecognized username or password. Have you forgotten your password?" is only presented to users on their second failed login attempt. The first time they fail, only the missing/incorrect username and/or password fields are highlighted. Is there any way of changing this default behaviour, so the system message is displayed on the first attempt, as well?


texts: How to display the average of the votes of a rating field from a form made with webform (D8)?

texts:
I've made a rating form using the webform module.
I'm looking for a way to display the average result of the votes on the node.
Any suggestions?


texts: Use node edit form layout for other entity types

texts:
The node edit form got a nice overhaul for Drupal 8's default admin theme, whereby a lot of the metadata fields like Revisions, Meta Tags, URL Aliases, Publish status, Promote status, etc are moved into a sidebar.

I'm using the Group module, and have enabled metatag integration and revisions via patch from #2829966.

Currently however the meta tags and revisions appear in a vertical tabs block at the bottom of the edit form, making the page extra long.

How can I get those items into a sidebar like the Node edit form does?


texts:
Is there a way to make a phone field that would only accept numbers (no spaces) and will format them as the user types?

Note: I read somewhere that text fields can be configured that way but I could not find how. I also tried integer field but this feels wrong


texts: Location Contextual Filter: Distance/Proximity works for all nodes but one

texts:
Drupal 7 site with Location and Location CCK modules.

Client has custom content type with Location field provided by Location CCK module.

Each Location node has a Views block display of Nearby Locations with sort criteria “Location: Distance / Proximity (asc)” and this works for all nodes except a new one recently created.

In Views UI, if I preview with contextual filters, I see the closest four locations sorted by proximity.

But viewing the actual node, I see four other locations that are quite some distance farther away.

What could be causing this, and how should I troubleshoot it? (I have cleared the cache!)


texts: How do I make a block that pulls the current node content?

texts:
Ok, so I know blocks in Drupal 8 have these things called "contexts" which allow Core to clear cache on a fine-grained basis. I can't find any decent explanation  of how they work, or how to get page variables from them or whatever.

My goal is to have a block type that renders fields or a display mode of the current node into the block content. I have seen elsewhere how one would get the current node, but I don't entirely understand how it's supposed to feed back into cache contexts. I know #cache on render arrays exist, but there's also a bunch of methods from ContextAwarePluginInterface that I'm not sure what they do. Is there some documentation I'm missing?


texts:
I have a drupal site at http://example.com and a development version of the same site at http://another.example.com/subdir. When I'm working on the development version, content that references /sites/default/files/ - such as images - doesn't work because it needs to include the '/subdir' part of the path. Setting $base_url doesn't work because that uses the BASE element's href attribute which doesn't affect urls beginning / if the href includes a subdirectory.

What's the best way of including the subdir in the image references? Do I need to resort to a server rewrite?


texts: Template suggestions based on path alias

texts:
I'm trying to work out how I can add my own template suggestions based on the set URL alias. I've found lots of information out there regarding Drupal 7, but very little for 8.

I know I can use hook_theme_suggestions_page_alter(array &$suggestions, array $variables).

Basically, I'm looking to convert this to Drupal 8.

$alias = drupal_get_path_alias($_GET['q']);
if ($alias != $_GET['q']) {
  $template_filename = 'page';
  // Break it down for each piece of the alias path.
  foreach (explode('/', $alias) as $path_part) {
    // Added the str_replace because path parts with - were not being picked up properly by the theme_hook_suggestions().
    $template_filename = $template_filename . '__' . str_replace("-", "_", $path_part);
    $variables['theme_hook_suggestions'][] = $template_filename;
  }
}


texts:
I have a content type that has an entity reference field. It's a content type for news articles with a field for tagging the article with taxonomy terms.

I'm attempting to access these terms in a block plugin, however I'm having difficulty. Getting other fields like text fields, and dates work just fine. For example

    $node = \Drupal::routeMatch()->getParameter('node');
    $node->get('body')->value

Successfully returns the contents of the node's body
 but when I use:

    $node = \Drupal::routeMatch()->getParameter('node');
    $tags = $node->get('field_tags')->value;

$tags comes up empty.

 die(print_r($tags));

Does not display anything.
I know it's in there somewhere though because when I use

die(print_r($node));

I do see the tag id's in there.

Is there a way to display the value of an entity reference field for taxonomy terms, in a block plugin?


texts: How do I get the highest `field_id` value that exists in content of a specific type?

texts:
I have a content type which, among other things, have a field which contains a unique ID number (this number is used to connect the individual content to related information stored on paper).

When creating new entries I'd like to automatically generate this ID by finding the highest ID already present in the system, and calculating the next ID from that.

I have written a small module (using hook_menu()) which presents the user an interface for adding new content. How can I, from within this module, get the  field_id values of my already existing content? (So that I can calculate which ID a new entry should have?)

Is there any PHP command which can be made to return an array containing all the field_ids from my content type?

Worth to know here is that the system is kinda small (500–1000 entries of my content type, at most). There will also only be a single person entering data at a time. Also, I'm using Drupal 7.


texts: Will managed files be deleted if no corresponding entry exists in file_usage?

texts:
I am using the services module to implement a REST API.  One resource allows POSTs with uploaded files.  During a services pre-process function I save the file to the temp directory.  During a services post-process function, I move the file to a private directory, call file_usage_add, and save the host entity.  When a validation error occurs between saving the temp file and moving the temp file to a permanent location, I am not explicitly deleting the temp file.  I thought drupal cron would take care of this for me, since no entry for this file exists in file_usage.  However, it doesn't appear that cron is taking care of this for me.  Any thoughts as to why this is?

When reviewing file_managed, I see the temporary file that I'd like deleted.  When reviewing file_usage, I don't see any corresponding record.

Update -- One additional piece of info: in most cases, the file is actually missing.  I believe this is due to OS reboot clearing out the /tmp directory.  Regardless, would system_cron still remove the file_managed entry for a file if the actual file were no longer found?

This problem arose since I started uploading files from a native mobile app. The filename is the same every upload.  There are some cases where the temp filename doesn't exist in the /tmp directory, but a record in file_managed still exists with a URI of that filename.  So I'm getting an integrity error when the file_managed table is being saved.  I plan on updating the app to create a random filename.  In the meantime, I'd like to clean up the database and surrounding "glue" logic that manages these files.  If system_cron will do it all for me then great.  But from what I can tell, system_cron is not removing old, completely unused (and unreferenced) records in file_managed.


texts: Drupal 7 admin can't upload images, but all other users can

texts:
I'm experiencing a very strange error and I can't figure out what's causing it. I have a drupal 7 website and all users and roles can upload images without any issues, except user 1, the administrator. When I try to upload an image as user 1 to ANY content type or delete an already existing image it freezes or returns this:

"An unrecoverable error occurred. The uploaded file likely exceeded the", the strange part is admin has all the permissions and I disabled the admin menu and other modules that are unique to being user 1. Any ideas? It's driving me crazy.


texts: How can you find out in which module your code runs?

texts:
I often face the issue that I need to have module metadatas (such as relative path)  and in the standard Drupal way I seem to be enforced to hardcode the module name like this:

\Drupal::moduleHandler()->getModule('my_module')->...

Is there an official way or a workaround to able to tell anywhere in your code (so not just .module) which module you are in (if it is module at all)?


texts: with BEF collapse expand items under their parent

texts:
How to collapse and expand items under their parent using better exposed filter and Nested Checkboxes ..
What i mean ...that all the child items to be collapsed and they expand when the user click on (+ e.g) for the parent or check the parent box.
I am making a car dealer website and i need that to make an advanced search.
Any help will be appreciated.


texts:
I am developing a Management Information System in Drupal, holding thousands of suppliers in different certification schemes.
 Due to the nature of these certification schemes, and because of working with third parties, I need to import comprehensive surveys in CSV from other systems. I normally do that via feeds which works fine.

The issue now is how to deal with the big variety of D7 fields. In the present situation I need to key in all these fields, and map them to the import fields in the feeds. Lots of work with about 10 surveys carrying approx. 100 questions each.

Survey questions (= fields) and related Field types are however available in CSV.
 Would there be a way of importing Fields and Fields types from such CSV into new or existing content types, similar to https://www.drupal.org/project/webform_auto_field ?

Posted this question before under Entityform, only realizing later that the question would be more relevant under core.


texts: Create chart for user count of user role using chart module(c3 lib) in Drupal 8?

texts:
I want to use chart module(c3 lib) of drupal 8 to show a chart of user count for different roles using views.
E.g.

Role Name  Total user
a             5
b             10
c             13

I achieved above table using aggregation in views. I followed this guideline to create a chart but when I create chart attachment and add it to parent, the value of child replace the value in the parent chart.It should merge.
Any help would be appreciable.


texts:
I am trying to use the Job Scheduler Module's API to automatically run a script every 6 hours but I'm having problems getting it working.

This is the code:

function jobbank_cron_job_scheduler_info() {
  $schedulers = array();
  $schedulers['custom'] = array(
    'worker callback' => 'custom_job',
    'jobs' => array(
       array('crontab' => '6 * * * *', 'periodic' => TRUE),
    )
  );
  return $schedulers;
}

function get_job_bank() {
  //Save the (long) job bank URL
  $jobBankURL = "https://www.jobbank.gc.ca/xmllite/en/?q=city_id:33821";
  $jobURL = "https://www.jobbank.gc.ca/xmllite/en/";
  $jobs = [];
  $jobInfo = null;

  //Get the XML data into an object
  $jobsInfo = simplexml_load_file($jobBankURL);

  //Send a message and exit if it fails getting the XML
  if($jobsInfo === false) {
    mail ('webmastercolin@gmail.com',
          'Job Central SM Job Bank CRONjob issue',
          'Getting the $jobsInfo XML data failed (line 9) at '.date('H:i:s \o\n F j, Y'));
    exit();
  }

  //Iterate through the objects
  foreach($jobsInfo->Documents->Document as $job) {
    //Get the job data from Job Bank
    $jobInfo = simplexml_load_file($jobURL.$job->jobs_id.".xml");

    //Grab just the information for the job and put it in the array
    $jobs[] = $jobInfo->Documents->Document;
  }

  //Encode the array as JSON
  $json = json_encode($jobs);

  //Send a message and exit if it fails encoding the JSON
  if($json === false) {
    mail ('webmastercolin@gmail.com',
          'Job Central SM Job Bank CRONjob issue',
          'JSON encoding the array failed (line 23) at '.date('H:i:s \o\n F j, Y'));
    exit();
  }

  //Save new data to json file, overwriting existing
  $writeResult = file_put_contents($base_path . 'sites/default/files/jobbank/job-bank-data.json',$json,LOCK_EX);

  //Send a message and exit if overwriting the file failed
  if($writeResult === false) {
    mail ('webmastercolin@gmail.com',
          'Job Central SM Job Bank CRONjob issue',
          'Writing to the JSON file failed (line 31) at '.date('H:i:s \o\n F j, Y'));
    exit();
  }

  //Send a message on success, we are done
  mail ('webmastercolin@gmail.com',
        'Job Central SM Job Bank CRONjob Success!',
        'JSON creation succeeded at '.date('H:i:s \o\n F j, Y'));
  exit();
}

I appreciate the help.


texts: How to change the redirect URL of a form that's already been set in a module?

texts:
I'm using the node gallery module in Drupal 6, and I'm having some trouble modifying it to suit my needs. When the manage images form is submitted, the function node_gallery_manage_images_submit is called. At the bottom of the function is this code:

$form_state['redirect'] = 'node/'. $gid;

I need to change the URL of that to 'my_url' instead of node/123. Using the form_alter I can set $form['#action'] = 'my_url'; and when the form is submitted it goes to that page. But the module does a lot of image processing before then, so I have to use the redirect after that's all done. I also tried $form_state['#redirect'] = 'my_url'; but that did nothing. Replacing $form_state with $form does nothing either. Can anyone please help me out? I'm pretty new to Drupal forms and this is the first time I've really had to work with them. I know there has to be some way to do it, I just can't figure out how.


texts:
My website's client (eole.avh.asso.fr) has been hacked following the recent hack of drupal core.

We have updated the drupal core on our website, but when we try to reach the url "eole.avh.asso.fr/admin/index", we're redirected to a spam website with an iframe, the url remaining the same.

So far, we deleted all the unwanted files and checked all the files (modules, system, themes, etc.) and the database to see if a redirection is hidden, but without success.

Has anyone meet this problem recently ?


texts:
I keep getting this error :
Unable to load class \Drush\VersionControl\Backup
 every time i attempt to update my Drupal install from 8.4.0 to 8.4.2.

I am running  the composer provided drush Drush Version   :  8.1.15

Now here is what i have tried:

drush up drupal --debug
Unable to load class \Drush\VersionControl\Backup
drush up drupal --debug  --version-control=svn
No valid version control or backup engine found
drush up drupal --debug  --version-control=git
No valid version control or backup engine found
drush up drupal --debug  --no-backup
No valid version control or backup engine found

if anyone could answer any of these question for me, i would really appreciate it:
How do i turn off version control?
How do i set the valid version control that this thing is complaining about?
How do i set the backup engine?

Note: some solutions out there mentioned that we have to remove the composer provided version and install drush to a different location. To be honest I do not want to use that solution.

Thanks.


texts: Is this a good way to make fields accessible for an empty entity object?

texts:
I have a function, my_entity_create(), which returns an empty object for my entity with properties: isnew, name, etc...

I want my fields attached to this empty object so I can set their values.  I accomplished this by calling the function below and adding the results to my object in my_entity_create().  Now I can set $my_entity_obj->field_my_field['und'][0]['value'] = 'some value'.  I save it with entity_save() and it works.

My question:  is there a better way to do this?  I'm trying to learn to do things 'the drupal way'... or just the best way if there is not a drupal best practice for a certain task.

function _get_fields_for_bundle($bundle)
{
    $result = db_select('field_config_instance', 'f')
        ->fields('f', array('field_name'))
        ->condition('entity_type', 'my_entity_type')
        ->condition('bundle', $bundle)
        ->execute()
        ->fetchAllAssoc('field_name');

        return array_keys($result);
}


texts: Add button in a view to update entity reference on the user record

texts:
I have a View, which is a table of nodes. I want one of these columns to be a button, and on clicking that button a field, which is an entity reference, on the user profile gets updated with a reference to the node of the row.

In other words, let's say I have a content type of fruit. The table has rows of fruit names, the user clicks the button on the banana row and an entity reference field on that users profile gets updated with a reference to the banana record. So now we know that user likes bananas.

What would be the best way to go about this?

(By the way I have looked at Bulk Views Operations, but it doesn't seem suitable without additional programming, and having something ajax based where the user can make the update without leaving the table would be the nicest solution).


texts:
I'm using Drupal 8.5. I have a content type with the in-core media module. I'm making a view for content syndication, and I need one of the columns to be the FDQN URI to the media resource-- i.e, not the rendered entity itself (which comes through as an img tag), but https://example.com/sites/default/files/media_image.jpg.

I've added the media field to my view, but I didn't find any Formatter, View Mode, or Rewrite Pattern that gives me the absolute URL to the resource. I can get the path to the media (e.g. https://example.com/media/1899), the entity_id (e.g. 1899), but no path to the file.

How can I render the path to the media image in my view?


texts: not found in Multi language site with only session detection

texts:
I have a multilingual site with 3 enabled languages.
Default language is English
I've only setup my language options to use the "Session" detection method.
I dont to use URL language options.
when i create node in English node and set pathauto for url with token [node:author]/[node:content-type]/[node:nid]

is work in default language only when i switch language to another this token is not work.
for example when i create node in another language this path not work.

http://example.com/reza/news/324  this does not work (this node is created in arabic site)
http://example.com/ar/reza/news/324 this works but i don't want to user this url i want use this example http://example.com/reza/news/324?lan=ar


texts: Webform/YAML Form component email mapping

texts:
In Drupal 7, Webform module have the ability to map different emails against webform component's options so that the webform notification could be sent to different emails depending on a user selection.

In Drupal 8, Webform was ported and its email submission settings pretty basic so I decided to use YAML Form. However, YAML Form email handler have the ability to either have a custom emails separated by comma or a value from the component.

Is there a way to have component email mapping functionality?


texts:
I'm trying to set value of select list programmatically with hook form alter

I have select list with options:

$options = array(125 => 'USA');

and setting value like this

$form['field_news_rubrique']['und']['#options'] = $options

But this don't work.

if i change options like this

$options = array(0 => 'USA');

it's working

if i have multiple value in options like this :

$options = array(124=> 'EN', 125 => 'USA');

it's working too


texts: I am working on a Drupal project where I require a "Create new account" form on a content page. Can anybody help me out with this? Is there any module or any alternative to get "Create new account" as a block?


texts:
I am looking for a way to change the hyperlink for Node title on a view. So far have tried rewriting the Node title field and also tried a global text field but links still show as blue.

Tried this but did not work:

{{ Node Title }}

What is the best way to change link color in views?


texts:
I'm trying to create a custom block that display the current date (Only Day of the month, 2 digits with leading zeros and A full textual representation of the day of the week) using the tocken module.

Now my problem is how to change the date when the next, prev icon is cicked?
For example: Today is saturday the 05th. When i click next, i get sunday the 6th. And when i click prev, i get friday the 04th.
Maybe this can be possible using javascript or php.


texts:
How to get custom fields assigned to taxonomy in Drupal 8.
What I have done so far is:

$contact_countries = \Drupal::service('entity_type.manager')->getStorage("taxonomy_term")->loadTree('contact_country');

$contact_countries now holds taxonomies, I can get name of taxonomy and ID, but I also created custom field in taxonomy, how can I get it?

With this code

foreach($contact_countries as $contact_countrie) {
        $terms[] = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load($contact_countrie->tid);
        $variables['contact_countries'] = $terms;
    }

I'm getting object(Drupal\taxonomy\Entity\Term) with protected values. I can see my custom fields values there but can't access it.


texts: Why doesn't drush respond to commands after install

texts:
Setup

I just followed the directions on the drush website for installing drush.

I performed the command php -r "readfile('http://files.drush.org/drush.phar');" > drush

Then attempted the next command php drush core-status which resulted in lots of text basically saying "Permission Denied".

So I went ahead and performed the next direction which makes the scripts executable. chmod +x drush

The Problem

I then attempted php drush core-status again.

Now the console just sits there when I type the command. It displays nothing and never released back to prompt. I had to ctrl+c to free up the console.

The Question

What am I doing wrong here? Are their dependencies on drush that are not listed in the install document? Is their some way to see errors that are not printed to the console?

I was using php 5.4 originally but updated to 5.5 and that did not solve the problem. CentOS 6.7.


texts: I currently have a general template and a front page template. I made a custom node for a content type I made and it works just fine but then realized that I need an entirely new page template as well. I already made a page--[content_name].tpl.php file and cleared the cache but it wasn't read. Is there something I need to change elsewhere or is what I'm doing completely off? Thank you.


texts: 'Add another' fieldset on a multi-step webform

texts:
I have a multi-step webform using ajax (I'm using webform steps and webform ajax modules).
The webform contains several pages (i.e education, career and experience).
In education page i have the following fields: degree and major which are placed inside a fieldset.

I tried using the webform add more module but it wasn't working (not displaying) although i followed up several recommendations and i know how it works. You need to specify the number of fieldsets, it doesn't create them dynamically.

Is there any other way for me to use the 'add another degree and major' feature?

I am using Drupal 7 and the Webform module 7.x-4.19.


texts: What is error: "Base table or view not found: 1146"

texts:
Base table or view not found: 1146 Table '(database).(entity)__(field_name)' doesn't exist

I have problems running my site since i deleted field (field_name) from entity (entity), to be clear entity was created from ContentEntityType.

What kind of field is it, if it has it's own table and those two underscores in table name?

How can i create field of this kind to solve this error?

It is quite urgent and my bad is i don't have any database backups.


texts: Need help adding an action to registration and user form submit

texts:
I'm a Drupal frontend developer with limited experience with coding PHP and scripts. I believe the task is fairly simple for a drupal backend developer (hopefully).

Here is the basics of what we are trying to achieve:
We need to execute a function upon submitting form feilds of user-register-form and the user_profile_form. Both of the functions basically take the field data and send it to our CRM tool. We have tested both of these functions using an HTML based form and can confirm that both work properly. The challenge for me is how to trigger these functions upon existing Drupal forms.

Here is the example of the script that needs to be triggered for the user-registration-form:

$(document).ready(function () {
            $("#user-register-form #edit-submit").click(function () {
                alert("Hello world");
                //var ulMembers = $('#ulMembers');
                var member = new Object();
                member.name = $("#edit-field-first-name-und-0-value").val();
                member.country = $("#edit-field-country-und").val();
                member.emailId = $("#edit-mail").val();
                member.description = $("#edit-field-description-und-0-value").val();
                member.membershiplevel = $('#edit-field-membership-price-und').val();
                $.ajax({
                    url:
'http://gsplatformapi-test.ap-southeast-1.elasticbeanstalk.com/api/Values',
                    //url: 'http://localhost:54915/api/Values',
                    type: 'POST',
                    dataType: 'json',
                    data: member,
                    success: function (data) {
                        alert(data);
                        $('#successmessage').text('record inserted');
                    },
                    error: function (error) {
                        console.log('Error in Operation');
                    }
                });
            })
        })

Here is the function that needs to be triggered user_profile_form. It is basically the same type of function as the one above, just with more fields:

      $(document).ready(function () {
            $("#user-profile-form #edit-submit").click(function () {
                //var ulMembers = $('#ulMembers');
                var member = new Object();
                //member.name = $("#edit-field-first-name-und-0-value").val();
                member.country = $("#edit-field-country-und").val();
                member.emailid = $("#edit-mail").val();
                member.website = $("#edit-field-website-und-0-url").val();
                member.description = $("#edit-field-description-und-0-value").val();
                member.membershiplevel = $('#edit-field-membership-price-und').val();
               $.ajax({
                    url:
'http://gsplatformapi-test.ap-southeast-1.elasticbeanstalk.com/api/Values/' +
$('#txtName').val(),
                    type: 'PUT',
                    dataType: 'json',
                    //Accept: '*/*',
                    //Origin: 'http://localhost:64636/',
                    data: member,
                    success: function (data) {
                        //
                        alert(data);
                        $('#successmessage').text('record updated');
                    },

                    error: function (error) {
                        console.log('Error in Operation');
                    }
                });
            }
            )
        }
        )

If anyone can help point me in the right direction I would greatly appreciate it. Thanks very much!


texts: How to make an external database available to Views?

texts:
There's a lot of discussion here and in other places about using external databases in Drupal. What I've figured out from that is:

  The best way to work with data in a database table is to use the Views module. I've installed that and started using it and found it's great for working with a table that I've added to the site's database.
  The easy way to get Views to work with a table that was not created by Drupal is with the Data module. This module treats any table in the site database that is not in use by Drupal as an "orphan table" and allows it to be "adopted" at the click of a button.
  The module "Table Wizard" apparently provides a way to do that with tables that are not in the site's database. But that module is not available for Drupal 7.
  The "settings.php" file, in the section on "Database settings," has detailed documentation on how to define additional databases that the site can work with. But when a database is defined in that way, its tables do not show up in the list of orphan tables in the Data module.

The change that I've made to the database definition in the “settings.php” file of one of my sites is:

$databases = array (
          'default' => array ('default' => array (
                    'database' => 'db_local',
                    'username' => 'db_local',
                    'password' => '_________',
                    'host' => 'localhost',
                    'port' => '',
                    'driver' => 'mysql',
                    'prefix' => '',
          ), ),
          'extra'   => array ('default' => array (
                    'database' => 'db__extra',
                    'username' => 'db_admin',
                    'password' => '_________,
                    'host' => 'localhost',
                    'port' => '',
                    'driver' => 'mysql',
                    'prefix' => '',
          ), ), );

I have a table that I want to use in more than one site in my multi-site installation. This means I need to have the table in a database that is accessible to each site. According to the reading I've done, my options for doing that are:

Best, if it's possible: Find out that there's a way to get the Data module to recognize tables in the additional database defined in "settings.php", so it can adopt them.
Use table prefixes to allow all the sites to use one database.
The module “Forena Reports” seemed to do exactly what I need, but when I installed it, I couldn’t get it to work. I submitted issue 2475645 and can’t do much more there unless there’s a fix for that problem.
Write my own module to give Views access to the additional database defined in "settings.php".
Install Drupal 6 with Table Wizard and use that to get Views to see my external table, and then somehow take the result of that and put it into Drupal 7. (This has been suggested in some posts.)
Follow the procedure in https://drupal.stackexchange.com/a/3321/45991 , which starts with installing a patch and seems to also require creating my own module.
I’ve also looked at the modules Feeds, Feeds SQL, Views XML Backend, and Migrate, but none of them say they can connect an external db to Views. Am I missing something? Is one of them the right solution?

Option 2 is not practical because it would result in a huge database with hundreds of tables that would be very difficult to manage. I’ve been making great progress in getting started on Drupal, but I don’t feel up to the task of 4, 5, or 6. Is there any possibility of something like option 1 working? Or is there any other way to get Views to work with a table outside the site database without being able to write my own module?

Two additional details: The first table I need to work with is pretty large, over 6,000 rows and about 20 columns. There is no intention to give visitors to the site access to the database except for information drawn from it for page content.

Thanks for your help.


texts: WYSIWYG tinymce editor unwanted tags showing in drupal 7

texts:
I have css define set and themes/garland  in the input for the directory but when I go to test all tags are showing.

Do I need to deselect an option in buttons to stop this or is it something else?


texts: How can I get a different version of a webform to show dynamically based on a selection value?

texts: I have a contact form currently set up with select options for the nature of the customer's inquiry. The conditionals and email handlers are set up for each selection value. Just now the user has to manually select a subject from the drop down before it displays the corresponding fields. Is it possible to take the user to the form using a parameter in the URL based on the selection option value so all the relevant fields are shown? I have tried using variants and references to show the fields and display them in webform nodes but I wondered what was the best way to go about this as I cannot get the fields to hide using variants. I'm still new to variants so still working all of that out. I have looked through the previously asked questions but I can't find anything for Drupal 8.


texts: How to disable default extension validation in Drupal's #managed_file Form API element?

texts:
I wrote validation function that tests file's mimetype. I commented out my old validators to avoid validation by extension:

'DownloadFile' => array(
  '#type' => 'managed_file',
  '#title' => t("Download"),
  '#title_display' => 'invisible',
  //'#description' => t('Allowed extensions: pdf zip exe.'),
  '#upload_validators' => array(
    //'file_validate_extensions' => array('pdf zip exe'),
    'file_validate_size' => array(variable_get('mymodule_image_size', 2 * 1024 * 1024)),
  ),
  '#upload_location' => 'public://mymodule/download',
  '#default_value' => $item->DownloadFile,
  '#required' => TRUE,
  '#theme' => 'preview_upload',
),

Now when I'm trying to upload exe, I get:

  The specified file putty.exe could not be uploaded. Only files with the following extensions are allowed: jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp.

Now, I will have files without extensions there. And with extensions I cannot predict. And all I want sometimes is to test for a proper MIME type match, not even an exact mimetypes sometimes. So, how can I get rid of extension validation and turn it into "everything goes"?

I managed to find issue that seemed to be about this problem, but it tells to unset($element['#upload_validators']['file_validate_extensions']); - does not make sense to me as I'm creating brand new array and this isn't set at all.

I tried to use #process property to add a function that will unset default validators later, like shown there in issue,  but dpr($element) shows there is nothing to unset:

[#upload_validators] => Array
    (
        [file_validate_size] => Array
            (
                [0] => 2097152
            )

    )


texts: What's the difference between global.css and default.css files in Omega theme?

texts:
I´m still testing the Omega theme, and trying to get its templates and css files to work out for me. I´ve already read at the documentation and issues´ replies at Drupal forums.

They say:

  Think of global as the 'mobile first' template and this this is where
  most of your css will go.

Ok, so for mobile I use only global.css and for other resolutions I use all the other templates.

  The default template is for desktop resolutions where the css is
  different for that of mobile. The remaining templates are really just
  for exceptions and other values to address scaling up to wider
  resolutions.

This is what confuses me, because the other css files are narrow, normal and wide. So I think narrow should be for 7" screens, normal for 10" screens and wide for all the other, bigger screens (usually the desktop). So where fits default template?

  Try resizing your browser window to see the changes between layouts.

I´ve tried that, setting just a line of code in every css file, determinig different body background colors for each case.
global.css showed on the mobile screen.
global.css showed on the 7" tablet on portrait mode.
narrow.css showed on the 7" tablet in landscape mode.
normal.css showed on the 10" netbook.
wide.css showed on the 19" desktop screen.

The color that I´ve set at the default.css file didn´t showed. I´ve took mozilla firefox and resized the browser manually, and all the other templates showed just fine, but default settings never appeared.

I´ve asked this at Drupal community forums, but I would like to know what you think about this. Thanks!


texts: Geofield Display Format Data Options (Using Bounding Box)

texts:
I am using Geofield to store point and polygon features. Input works fine with all the different widgets I have tried.

Display formats (GeoJSON, WKT, KML) with Data Options "Use full geometry" and "Use centroid" work fine with either point or polygon geometries. When I use the Data Option " Use bounding box" it does not work with any geometry and get the following error:

Exception: Cannot construct Point. x and y should be numeric in Point->__construct() (line 23 of ....../sites/all/modules/geophp/geoPHP/lib/geometry/Point.class.php).

Is this a known bug? My search did not find any reports. Or is it my configuration?

Drupal 7.20
Geofield 7.x.1.1
geoPHP 7.x.1.7
PHP (MAMP) 5.4.4


texts: How do I use the global class \Drupal static methods to access services?

texts:
Is there a difference between calling \Drupal::service('config.factory') and \Drupal::configFactory()?

Is it better to use the second one?

Can \Drupal be used to do something else than calling services?

The documentation says:

  Accessing services in global functions

  The global Drupal class provides static methods to access several of
  the most common services. For example, Drupal::moduleHandler() will
  return the module handler service or Drupal::translation() will return
  the string translation service. If there is no dedicated method for
  the service you want to use, you can use the Drupal::service() method
  to retrieve any defined service.

In which cases isn't there any dedicated method? How do I easily list all the retrievable services?


texts: drupal_render in hook_form_alter prevents javascript from being included in the header

texts:
I'm calling drupal_render to render a textarea element in another element's #prefix field in hook_form_customtype_node_form_alter().  When I load the form, most of the script tags in the header do not get printed.  If I comment out the line with drupal_render they print out and the accordions and sliders load on the page.

Why would calling drupal_render prevent some of the javascript files from being included in the page header?

UPDATE

Here's my code:

$deltas = preg_grep('/^[0-9]*$/',     array_keys($form['field_recommendation_reference'][LANGUAGE_NONE]));
foreach ($deltas as $delta) {
  if ($form['field_recommendation_reference'][LANGUAGE_NONE][$delta]['field_key']['#default_value']['finding_wrapper'] == $wrapper_field_name) {
    $wrapper = $form[$wrapper_field_name];
    $wrapper['#printed'] = FALSE;
    $wrapper['#value'] = 'test';
    //$form[$field]['#suffix'] = drupal_render($wrapper);
    dpm(drupal_render($wrapper));
  }
}

When I output the element with dpm, the form loads all of the javascript.  Also, when I include the markup without using drupal_render, the page loads correctly.

If I included the rendered markup manually the form doesn't load all of the javascript.  Could it be a conflict with id's being used already?  I have the same element stored in the $form array but with #printed set to TRUE.

Found the Issue

if I set #autocomplete_path = '', the form element's markup does not disrupt the rest of the page.  Is it possible to get autocomplete to work with drupal render?  I saw some comments related to this on the drupal_render api documentation


texts: Drupal Rest services "access denied user anonymous"

texts:
I have created a custom service where I am passing parameters and retrieving result from another file.

So to test it I tried on Postman and I put URL with sitename/endpoint/resource and passed parameters in key value.
When I submit I get an error as access denied user anonymous.

I have return my custom services under hook_services_resources() function

function mymodule_services_resources() {
 $api = array(
  'blog' => array(
    'actions' => array(
     'math' => array(
      'help' => 'Retrieves posted blogs',
      'file' => array('type' => 'inc', 'module' => 'MYMODULE', 'name' => 'mymodule'),

      'callback' => 'mymodule_blog_retrieve',
      'access arguments' => array('services_access_menu'),

      'access arguments append' => TRUE,
      'args' => array(
        array(
          'name' => 'var1',
          'type' => 'string',
          'description' => 'variable 1',
          'source' => array('data' => 'var1'),
          'default' => '0',
        ),
        array(
          'name' => 'var2',
          'type' => 'string',
          'description' => 'variable 2',
          'source' => array('data' => 'var2'),
          'default' => '0',
        ),
      ),
    ),
  ),
),

 );
  return $api;
}

and inc file just takes parameters var1 and var2 and adds it and returns the sum.

Please help me finding out where i have done mistakes.


texts: Drupal7: Private/Password Protected Section in a Drupal Website

texts:
What would be the best way to do this In a Drupal7 Website:
I want to add to an already existing Public Drupal Website an 'Internal Section' that can be viewed only by Login (Password Protected).
This 'private/internal' Website will have 60+ info. pages, its own menu hierarchy, and any content that relates to it will also be private (private directory for images and files)
Thank you.

Boutros.


texts:
I have several custom entities, about 8.

Each contains information about a given subset of data.

Currently, this is being created by filling 8 different tables with data from an API and exposing it to Drupal with Views and making them custom entities.

I'm wondering - is it best practices to have each as a custom entity, or should they be made into node bundles?

One of the entities either has to have a relationship with a taxonomy term as well - either with the taxonomy term having multiple entity references to the custom entities, or making the custom entity fieldable and adding multiple taxonomy terms to it. This would be used to organize one of the custom entities.

So I guess I'm asking two architectural questions here - when is it best practice to put content into nodes, and when is it best practices to put it into custom entities? Should you make an entity a child of a taxonomy term, or make taxonomy terms children of other entities? I'm not seeing any information about how to make big architectural decisions like this. It seems like there would be a relatively straight-forward argument for one and only one architectural choice in these use-cases.

Excuse me if this is simple data architecting - I'm self-trained and never took computer science in college, so this may be easier to others than it is to me.


texts: How to show a date in the correct timezone?

texts:
I have a Datetime Range field (field_date) in a content type. Once I create my content type I set the Start Date as:

2017-02-27 19:30:01

Now I want to get the value and show the date in other format, so try to use the following code:

// Loading the node.
$node = Node::load(2100);
// Getting the start date value.
$date = $node->field_date->value;
// Printing to see what is the output.
dpm($node->field_date->value);
$date = strtotime($date);
// Printing my timezone.
dpm(drupal_get_user_timezone());
// Applying my custom format.
$date = \Drupal::service('date.formatter')->format($date, 'custom', 'Y-m-d H:i:s', drupal_get_user_timezone());
// Printing to see the output.
dpm($date);

This is my output:

// It's fine.
2017-02-28T00:30:01
// Its fine.
America/New_York
// This is not what I waiting for. I'm waiting here: 2017-02-27 19:30:01
2017-02-28 00:30:01

So, how to show a date in the correct timezone?


texts: How to add web app icon png to root document folder?

texts:
To specify an icon for the entire website (every page on the website),
  place an icon file in PNG format in the root document folder called
  apple-touch-icon.png

Exactly how do I do this in Drupal 8?

Yes, my site adds lots of different touch icons to the html.html.twig template in an assortment of different sizes for Android, Apple, and MS Tiles but all this does not have precisely the effect I want for my web app. For further info see Apple docs here.


texts: How to show validate error of a node listing page

texts:
i am trying to save form state in database and want to view in a listing page with its error validation.

i.e, i want to validate a previously saved form state from my database.

this is a node type form .

i had already tried node_validate its not working because i fetch the data before submitting the node . so there is no nid and for that it is not working

and also tried  drupal_validate_form but it is showing

[form_token] => The form has become outdated. Copy any unsaved work in the form below and then reload this page

Any help is most Appreciable.

EDIT :

Can any one just say How To save my form and retrieve it from database and load all result in a page .


texts: How to check in a Rules Condition if an Ubercart product is out of order?

texts:
There isn't a good support for "out of order" in Ubercart for Drupal. I'm trying to fix that with the Rules module.

I'm trying to add a rule that disables the product after the stock is updated, using Rules event After updating existing content of type Product.
I want to disable the product that is sold out (stock = 0).

Here is an export of the rule I have so far:

{ "rules_product_sold_out_check" : {
    "LABEL" : "Product sold out check",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_update--product" : { "bundle" : "product" } },
    "DO" : []
  }
}

But the stock isn't a field of the node. How can I select that field within a Rules Condition? I have no idea how to use that in the Rules module as a data selector.

  The data to be compared, specified by using a data selector, e.g.
  "node:author:name".

I'm using the stock also in a view. This is what I use there (export-code-view to show the fieldnames / structure).

$handler->display->display_options['fields']['stock']['id'] = 'stock';
$handler->display->display_options['fields']['stock']['table'] = 'uc_product_stock';
$handler->display->display_options['fields']['stock']['field'] = 'stock';

I use Ubercart 7.x-3.10 (with Stock 7.x-3.10), Drupal 7, Rules 7.x-2.10


texts: How to resolve the error when posting a new node with Image Field and Entity Reference?

texts:
I'm trying to create a new node using Drupal 7 + Services 3. The node type is 'activity_photo' has an image field, and a reference to a node. This is what I'm posting to the service
{
 "type":"activity_photo",
 "field_node_reference":{
 "und":[{
 "target_id":"x (1273)"
 }]
 },
 "field_photo":{
 "und":[{
 "fid":"20077"
 }]
 }
}

The response is status 200:
{"nid":null,"uri":...}

My error log shows the following:

Notice: Undefined index: display_field in file_field_widget_value()
Warning: end() [function.end]: Passed variable is not an array or object in file_managed_file_validate()
Notice: Undefined index: nid in _node_resource_create()

Any help on how to proceed?


texts: How to get a rendered output field from view object programatically

texts:
I can get the value of the field from the view object like this:

foreach ($view['#view']->result as $row){
      $field_slide_banner = $row->_entity->get('field_slider_banner')->getValue();
    }

However, in this case I get the target_id of the referenced image file, but I need to get the full rendered output data, which depends on format that I set for this field at the view display, for example, that should be the URL of the image in my case.

In other words, I want to be able to get final output data or HTML markup programmatically for any view field from the given row of executed view object.


texts:
So I have created a block in which I've added a form, build with the form API. It contains a textfield and a submit button. My next step is to create a route that calls a method in a controller in my Module.

I am wondering how to do this. The form itself part of the main menu, so visible on any page. I'm not sure how to define this route. I've read there are form routes, but I don't think that's what I am looking for.

The Drupal Form API documentation says something like this:

module_search.form:
  path: '/'
  defaults:
    _title: 'Search form'
    _form: 'Drupal\module_search\Form\SearchForm'
  requirements:
    _permission: 'access content'

But I have no clue how to handle the request itself to do something with the data this form provides.


texts: Drupal extra subdomains for some special nodes

texts:
I have the following in mind and I'm not sure how to realize it nicely.

Drupal 7 serves many nodes from several different taxonomies
If I visit a taxonomy page e.g. example.com/category-one/taxonomy-term-one I get a list of all the corresponding nodes
If I click on one of the list nodes, I get to the page example.com/content-type/node-name
There are some special nodes in this list, when I click on them, I get to the following special page node-name.example.com. This page is exactly the content like example.com/content-type/node-name but in this case, only the subdomain URL is accessible and example.com/content-type/node-name doesn't exist to avoid content duplication.

The first 3 items are easy standard tasks: The Pathauto module handles all the taxonomy url alias tasks etc.

The 4th item is my problem. My idea so far: The subdomain node-name.example.com just references a special folder under the drupal root, which contains some logic to determine the name of the node according to the subdomain. With the given subdomain I get the node id and just load all the stuff from drupals db with a service implemented for this usecase.

Questions:

Ist it possible to give a drupal node an absolute url alias like node-name.example.com just like node-category/node-name?
Are there any problems going to be concerning drupals $baseurl/site configuration?
As I'm editing everything just over the example.com/node/node-id/edit there should be no problems with the editing functionality, no?
What remains to be done?

Did anybody had to fulfill a similar apporach and could share some thoughts regarding my approach?


texts: How to attach token in a custom form field

texts: I have a custom form in Drupal 8. I need to attach tokens for fields of my form. Basically I want to add "Browse tokens" option for each field of my form.


texts:
When I crate a Webform I do have an option to make it available as a block as well. But in this case it creates a node as well.
How can I create a Webform as a block only?


texts: How to create (& pre-populate) multiple “field collection” fields on an ajax call

texts:
This is an extension of this question - "How to pre-populate multiple "field collection" fields in node form"

I'm trying to do the same thing, but I'm trying to get it to work on an ajax call rather than on the form load.

The form loads, the user selects an option on a dropdown and then the form automatically populates several field collections with ajax.

The Problem

The existing solution on the question above involves altering the form when it's first built, by changing:

 $form_state['field']['--machine-name-of-field--'][LANGUAGE_NONE]['items_count']

And then rebuilding the form using the new form state values.

The problem with an ajax call is that, it seems to ignore any changes made to $form_state in the callback. i.e.

function ajax_get_parent_field_collection ($form, &$form_state) {
  $form_state['field']['field_collection_entity']['und']['items_count'] = '3';
  return $form['field_collection_entity'];
}

The changes made in $form_state above are ignored, so when the form is rebuilt nothing happens and if you then dump $form_state none of the changes made are saved.

I could manually create the field collection entities and insert them, but I was hoping there's a cleverer answer. Has anyone tackled this before?

EDIT:

The ajax is currently called on a select field, so the ajax triggers when the select dropdown is used.

$form['field_company_for_center']['und']['#ajax'] = array (
  'callback' => 'ajax_get_parent_field_collection',
  'wrapper' => 'ajax-wrapper',
  'effect' => 'fade',
);


texts:
I have added fields to my entity via Field UI and trying to fire an ajax callback but it is not working.

This works

$form['customField'] = array(
        '#type' => 'textfield',
);

$form['customField']['#ajax'] = array(
      'callback' => 'just_test',
      'wrapper' => 'membership_suggestions',
);

But this does not ('field_member_first_name' is added to the entity via Field UI and is a text field)

$form['field_member_first_name']['#ajax'] = array(
    'event' => 'blur',
    'callback' => 'just_test',
    'wrapper' => 'membership_suggestions',
);

Thanks a lot.


texts: Moving Exposed Views Filter into another region of the page

texts:
Is there any way to move the exposed filters of views into another region of the site? i.e. I want to have a Search functionality attached to the a view by exposing the "Search: Search Terms", but I want the search to reside to the right in the "Right Side Bar" region and not directly above or below the actual Views field display.

Or put another way: Is there a relatively straightforward method of replicating the Exposed Views Filter functionality of one View through another Block that resides on the same page? This way, the Block which would act as the filter "controller" would reside separately from the View on a different region of the page.


texts: facebook sharing a node gets wrong preview

texts:
I used the fb js share

  $node_link = url('node/32711');
  $output .= '';
  $output .= 'Share';
  $output .='
';

It works well on our testing site but when deploying to live it shares the homepage preview and gets 3 images from the homapage not the node image title and preview

so what to do to force previewing that node exactly to be shared rather than the homepage

I used the FB Debug tool and when changed the node it previews the node but gets an image from the homepage too soo please help


texts: Theme Organic Group Entity Reference on user profile

texts:
On my site, users join groups via an Entity Reference field using the "Check boxes/radio buttons" widget.

The widget default is to display only the group Title. Like so (where the list bullet is a checkbox):

Group1Name
Group2Name
Group3Name

The group content type has an additional field called "description" that I'd like to include on this display. Like so:

Group1Name: Group1Description
Group2Name: Group2Description
Group3Name: Group3Description

Is there a way to theme either the checkbox widget or something in Organic Groups to display this additional field?


texts: How to print ordered list number in Node Full view

texts:
I have a views page with nodes in ordered list. I need to show the row number in the node in Full View. I don't know if it is possible.

Example:

Michael Jordan
Magic Johnson
Kobe Bryant
etc.

I want that when I see the node, for example Kobe Bryant, it says "Kobe Bryant is number 3".
If I see Jordan's node it says "Michael Jordan is number 1", etc.

How can I print this number?


texts:
I have a following problem.

I have a bootstrap modal with a form which I submit using jQuery. Upon sussesful Ajax I hide the form in the modal and append a message.

Now, when I close the modal and open it again I would like to have an empty form. Instead obviously I see the message. So I thought that I will use the bootstrap 'hidden.bs.modal' event to trigger the reoval of the message, showing the form and resetting it. The problem is that the event listener is never attached to the modal:

  Drupal.behaviors.myBehavior = {
  attach: function (context, settings) {
  //code starts
  $('#feedback-form').submit(function(e) {

    $('#feedback-form').hide().parent().append('

Please wait ...

');
    $.post("email_us.php",form.serialize(), function(data){
        $('#loader').replaceWith('

'+data+'

');
        $('#feedbackModal').on('hidden.bs.modal', function (e) {
                        $('#loader1').remove();
                        $('#feedback-form').show().trigger('reset');
                    });
        });
    e.preventDefault();
    })
  }
}

I do not see any error in the console it simply seems that the 'hidden.bs.modal' event listener is not attached to the modal.

Interestingly. If I execute this part of th code in console:

$('#feedbackModal').on('hidden.bs.modal', function (e) {
                    $('#loader1').remove();
                    $('#feedback-form').show().trigger('reset');
});

and then

$('#feedbackModal').trigger('hidden.bs.modal')

the modal and form behave as intended.

Any has an idea how to solve this problem?


texts: I want to load a plugin definition by its string id within a controller extending ControllerBase. What is the relevant service or class I am looking for?


texts: Does node_load() function prevent multiple loading of the same node?

texts:
In some cases, for example page where a lot of block are loading the same current node in one request it could be useful to load node just once for every block. Once I read somewhere this is default functionality for node_load() function.

Is it really true, or do I have to workaround that by myslef (store node as global variable or something like that)? Documentation says nothing about that.


texts: How do I add inline JavaScript to the footer?

texts:
I want to add third-party JavaScript code at bottom of the every page. I build an module and I am able to add the JavaScript on the head tag, instead of footer.

I am using the following code.

function ur_optin_monster_preprocess_html(&$variables) {
  $config = \Drupal::config('ur_form.admin_settings');
  $variables['#attached']['html_head'][] = [
    [
      '#tag' => 'script',
      '#value' => $config->get('my_js'),
      '#weight' => 400,
    ],
    'ur_form_js',
  ];
}

I also tried changing 'html_head' to 'html_scripts', but it doesn't help. I tried with the batrik.theme file, but it gives the following error.

  Error: Call to undefined function drupal_add_js() in bartik_preprocess_html() (line 95 of core/themes/bartik/bartik.theme).

function bartik_preprocess_html(&$variables) {
  $config = \Drupal::config('ur_form.admin_settings');
  if ($config->get('my_js')) {
    drupal_add_js($config->get('my_js'), array('scope'=>'footer'));
  }
}

Can you suggest me the correct way to add JavaScript code at the footer of every page?


texts: I've installed the Drupal commerce module, and made an article with some products. So I've got this [node:field-product:title] title for the article in the Page title module, but it shows all product titles. I need only the selected product from list in the page title.


texts:
Using the steps explained here: http://www.lullabot.com/blog/article/beginners-guide-caching-data-drupal-7 I'm storing an array with specified expiry time.

But what is happening is that even after expiry of time, the cache_get is returning the stale cache. Even Cron run is not deleting the cache entry(I've checked the cache_block table).

This is the code:

     $out = &drupal_static(__FUNCTION__);

        if ( !isset($out)) {
            if ( ( $cache = cache_get(__FUNCTION__,'cache_block'))) {
                $out = $cache->data;
                dsm("cache returned");
            } else {

//do something
//...........
  $out = '
' . $out . "
";
            cache_set(__FUNCTION__, $out, 'cache_block', strtotime("23:59:59")+2);
        }//else ends
    }//!isset ends

    return $out;
}//function ends

Only cache clear all in the Performance tab is clearing this cache entry in the cache table.

I'm confused how this expired cache will be deleted.

In that article I can read this statement:

  Expired entries will be automatically discarded as they pass that
  date.

But does not seem to be happening. Also I've verified that "expire" value in the cache table is beyond current time.

I can clear the cache myself but then cache_get function does not return the "expire" time in the table.

Anything I'm missing here?


texts: How do you get field groups to render for a block_content entity loaded programmatically?

texts:
I added some field groups to my display, but they don't render on my custom block_content entity.

$blocks = \Drupal::entityManager()->getStorage('block_content')->loadByProperties(['type' => 'footer_bottom']);
if (!empty($blocks)) {
  $block = array_shift($blocks);
  $render_controller = \Drupal::entityManager()->getViewBuilder('block_content');
  $footer_bottom = $render_controller->view($block);

  return $footer_bottom; // won't render field groups.

}

I see the field groups in the render array when I dump the $footer_bottom array:

  "#fieldgroups" => array:2 [▼
    "group_tricolumn" => {#5505 ▶}
    "group_subfooter" => {#5465 ▶}
  ]

Is there another step to process the field groups?


texts: How to register a new PHP function in Twig?

texts:
I am trying to create a theme for Drupal 7 with Twig. If I wanted to register a new PHP function, I should implement "hook_twig_function()" as the module explains.

My simple question is: where should I implement my functions? If I write code - as usual -  inside my "template.php", I have this alert: "Unknown "my_module_coolfunction" function in "sites/all/themes/abc/templates/page.tpl.twig"

If I edited the "Extension.php" file, after every update, I would lost all my custom functions.


texts: Is there a Module to edit php just like live css?

texts: I have downloaded Live css and it seems to be very good for editing . I am new to drupal and I don't know all where the php files are stored . is there any Module to edit php just like what live css does ? :  please any help will be essential


texts:
I would like to know how to switch from one language to another while staying at the same page.
For example if I am at www.mysite.com/en/pageEN then I switch the language and I arrive at the same page but in French:  www.mysite.com/fr/pageFR
I already use "translate" to translate the content, the path prefix is activated. I do not understand why it doesn't work.

Thank you in advance!


texts: How to attach Dropzone.js uploads to a form element

texts:
I'm integrating dropzone.js into my form, but I have an issue regarding my file uploads.  I have my dropzone set up, and file uploads are in the $_FILES array.  I want to call file_save_upload to handle the file management, but per the code:

// Make sure there's an upload to process.
if (empty($_FILES['files']['name'][$form_field_name])) {
    return NULL;
}

it looks for the files under $_FILES['files']['name'].  The dropzone.js uploads my files to $_FILES['file']['file'].

I haven't seen an easy way to specify an input element for dropzone.js to upload to.  On the Form API side, I could just mimic the functionality of file_save_upload(), but all the code already exists and it does a lot, and I'd hate to duplicate it.

Maybe I can copy the $_FILES['file']['file'] array over to $_FILES['files'], then call file_save_upload()?  I'm trying to make sure there is a better way to do it before I start hacking.


texts: Is is possible to show the weight select box on admin/content, rather than having to go into the node to edit it?


texts: restrict user access to sub domain if assigned to another sub domain

texts:
I have a site using the domain access module. I created 2 sub domains. agent1.example.com for agent1 and agent2.example.com for agent2. However, I can login to agent1.example.com with agent2 login info. I only want agent1 to login to agent1.example.com and agent2 to only be able to login to agent2.example.com.

The reason why I am using domain access instead of multi site is because I am sharing training videos, documents, and corporate documents across all sites. However, each agent will have their own page where they can track clients and sales statistics, so I want only them to see it.

What is the best way to go about this, or is there a better module for this? Or is there a way to share content across multi-site domains?

Thanks,
  cquigs


texts: CKEditor links wrap the contents of a container individually instead of a container

texts:
I'm in a situation where I want to use WYSIWYG with CKEditor because of the easy Media integration. However, I'm building a page with some interactive tabs that have markup something like this:

(#1)

            [[Media markup to insert an image]]

Some text.

            [[Media markup to insert an image]]

Some text.

I want to wrap each of these tabs with a link, this being the desired end result:

(#2)

                [[Media markup to insert an image]]

Some text.

                [[Media markup to insert an image]]

Some text.

If I try to do this in CKEditor, however, I get this:

(#3)

            [[Media markup to insert an image]]

Some text.

            [[Media markup to insert an image]]

Some text.

This creates problems with styling and, more importantly, makes some regions of the tab unclickable. What's even more maddening is that even if I disable rich text and edit the HTML directly to #3, if I switch back to CKEditor it "corrects" the markup to #2.

Is there any way to change or otherwise prevent this behavior? I still want to use the Media module integration to insert and modify images, so I'm hesitant to simply disable CKEditor and leave it off. I can insert my images, then edit the HTML to insert my link tags properly, then save the page, but it can still break again if I go back to make changes.

I'm currently running CKEditor version 3.6.6.7689, WYSIWYG module 7.x-2.2, Media 7.x-2.0-alpha3, and the latest Drupal 7 core.


texts:
Hi, my friends!

Sometimes, making an override of a contributed module consists only of: in template.php, copy the function we want to modify and change its prefix "theme" for "my_theme". But this is not enough.

Speaking of the Quiz module:

1. I need to modify the multichoice-alternative.tpl.php file. This file contains functions. But, there is only one foreach, and within it is what I want to change. How do I override it?

2. I need to modify the multichoice.classes.inc file. This file has functions without the prefix "theme". So, I can not replace "theme" for "my_theme" in order to make the override.

Help me!


texts:
I'm new in Drupal. I had to migrate a page from a client to another server. The page work well on a development test but not anymore.

I have these errors:

Notice: Undefined index: highlighted en include() (línea 126 de /home/portal/public_html/modules/system/page.tpl.php).
Notice: Undefined index: sidebar_first en include() (línea 138 de /home/portal/public_html/modules/system/page.tpl.php).
Notice: Undefined index: sidebar_second en include() (línea 144 de /home/portal/public_html/modules/system/page.tpl.php).
Notice: Undefined index: hotel en drupal_theme_initialize() (línea 100 de /home/portal/public_html/includes/theme.inc).
Notice: Trying to get property of non-object en _drupal_theme_initialize() (línea 146 de /home/portal/public_html/includes/theme.inc).
Notice: Trying to get property of non-object en _theme_load_registry() (línea 335 de /home/portal/public_html/includes/theme.inc).
Notice: Undefined index: hotel en theme_get_setting() (línea 1431 de /home/portal/public_html/includes/theme.inc).
Notice: Trying to get property of non-object en theme_get_setting() (línea 1478 de /home/portal/public_html/includes/theme.inc).

The link to the page is: http://www.portaldelcuadrado.com.ar/
What can i do?

Thanks


texts: How to resolve error Unable to install the responsive_tables_filter module since it does not exist

texts:
I am getting an error when importing the configuration from our development branch. When running. drush cim staging.
The error is.

  The import failed due to the following reasons: Unable to install the responsive_tables_filter module since it does not exist. We installed this module a long time ago but then unistalled it, disabled it, then deleted it.

There were settings for responsive_tables_filter in these 2 config files.
/config/core.extension.yml
/config/lightning_core.versions.yml

I removed both settings. Then ran drush export then pulled from development again and ran drush import and the error was gone.
Is it safe to manually edit these files?