texts: How to get an array of referenced entity ids from an entity reference field

texts:
I have a entity_reference field with BaseFieldDefinition::CARDINALITY_UNLIMITED cardinality. I want a list of referenced entity ids.
I know that I can get all the referenced entities by calling $x->referencedEntities(), but I want only the ids to get the entities loaded later. Currently I am doing this:

  $a = [];
  foreach ($entity->autoren as $v) {
    $a[] = $v->target_id;
  }
  $this->setCurrentAnwaltReferenzen($a);

Does anyone know a better solution like it was in D7 (->raw())?

Thanks


texts:
I'm attempting to get the taxonomy term id from a field in the node template for a content type. I'm currently rendering the names of the terms using this

render($content['field_tags'][value]);

This works fine for grabbing the names of the terms. However I would like to be able to grab the actual term ids from those fields instead of just the names. Using devel I do see that that information exists, however I'm not sure how to refer to it.


texts: I am using the Schema.org module for schema tags, I tried to add html elements    but they never get printed. Is it possible to do this?


texts: logging in after exiting website under maintenance

texts: i was installing updates for drupal website, while on maintenace mode. waited for updates to finish and then signed out. i've been trying a lot of things i'm reading online and it doesn't work. on another note, possibly related, when i've tried to do some editing on certain blocks i get the message that i don't have sufficient permission to edit. also, while googling online i found my website, though, with a different url that had the log-in ability, but my credientials didn't work. i believe my next attempt is to insert or edit code in the db..how can i do that? or whats the best solution? sorry to type so much, i've been doing a lot of research on this and i've become desperate.


texts:
Can drush be run on a site when I have the server connected to my machine as a network share? I am running Win10 and the server is Windows based with IIS. The website folder mounted as a drive, so the path to it is something like Z:\website.

I noticed that I can switch between Acquia DevDesktop sites by changing the cmd line path (ie. from c:\devdesktop\site1 to c:\devdesktop\site2)

Can I essentially do the same by changing over to z:\website?

My thinking is that getting everything setup as if the webserver were remote (what most install tutorials asume) seems overkill. But, I am not really sure what DevDesktop is doing to get drush running on it's sites.

Is anyone doing anything similar?


texts: Ubercart thumbnail saving in sites/default/files - Its messy - How would I get it to save in a specified folder?

texts: All of my ubercart thumbnail images are saving in sites/default/files and its getting way too messy. Is there a way I can tell them to save in a folder inside this directory? There is a media style for them and they get the prefix thmb_ but I cannot figure this out. Thanks


texts:
I have a site with a many users, and public registration is not allowed, I'm the only one who can create accounts. I'm pretty new to drupal, and looking in the log messages I see this FREQUENTLY! What is this all about? Is someone trying to hack my site (sorry for the newb-termanology) but is this some sort of sqli or something I should be worried about? This happens often, and I'm wondering if my site has any vulnerabilities I should be worried about.

Thanks for helping shed some light on the situation!

page not found  02/20/2013 - 2:56pm register'). Anonymous
page not found  02/20/2013 - 2:56pm .url('user/register').  Anonymous
page not found  02/20/2013 - 2:56pm register'). Anonymous
page not found  02/20/2013 - 2:56pm .url('user/register').  Anonymous
page not found  02/20/2013 - 2:56pm register'). Anonymous
page not found  02/20/2013 - 2:56pm .url('user/register').  Anonymous
page not found  02/20/2013 - 2:56pm register'). Anonymous
page not found  02/20/2013 - 2:56pm .url('user/register').  Anonymous
page not found  02/20/2013 - 2:56pm register'). Anonymous
page not found  02/20/2013 - 2:56pm .url('user/register').  Anonymous
page not found  02/20/2013 - 2:56pm register'). Anonymous
page not found  02/20/2013 - 2:56pm .url('user/register').


texts: I know nothing but the admin functions of Drupal.  The developer of my site used Roboto and other fonts when I asked for Arial.  Now my website design gets completely screwed up in Chrome and Firefox browsers.  The developer has since gone out of business.  I was told that something could be added to the code to "embed' this roboto font so that when someone accesses my site that does not have roboto installed - which is just about everybody apparently - that  roboto will automatically be installed in their computer?  Someone at Go Daddy told me that the problem is that HTTPS should be inserted in the code instead of HTTP.  That the developer does have the roboto code inserted but it should be HTTPS.  I know I probably sound completely stupid but I cannot even find the code to even look at it or CSS style sheets.  I have no idea where the code actually is for my site.  If anyone can assist - I would greatly appreciate it.  My site is nightvisionnv.com.


texts: How do I get multiple references from the autocomplete?

texts:
I am using the following form element.

$form['group']['one'] = array(
    '#type' => 'entity_autocomplete',
    '#title' => t('Tags'),
    '#target_type' => 'user',
);

I submit values similar to the following ones.

  user00 (0), user01 (1), user02 (2), user0x (3)

What I receive from the form is the following:

  one = 3

It only picks up the last ID.

How can I get all the references entered in the form element? How does the form element handle the references to not existing entities?


texts: Build context menu for news articles (sample image included)

texts:
I have a complex view that queries and presents a lot of news articles depending on year and month contextual filter arguments. Everything works fine so far. However, now I want to show kind of context menu next to the view result that looks like this (shows multiple screens with different menu content depending on current display):

What is the best/most elegant way to realize such a context menu? (no ugly hacks)

What I've already tried

I tried to accomplish that using the Views UI – no luck. Creating two different View blocks (one for a list of years and one for the months of currently selected year) didn't work, because in order to get a distinct result set I need identical fields that are used for "collapsing". The field I used was "Post date" – and this always differs.

I guess that I must write a custom module where I leverage the Views API and create that markup for the context menu. But where do I start? And how can obtain the current contextual filter arguments?


texts: Custom menu-items permissions are erased when features are refreshed

texts:
I am using D7.37 with features 7.x-2.5 and Features Tools 7.x-2.x-dev (2014-Nov-27). I have 2 environments (dev, prod), and I use git and features to sync.

After I refresh features and download to the file system (updated), the menu-item permissions tend to be erased.

This is killing me, since menus are the face of the system. Any ideas?


texts: How do I extract individual fields from rendered user?

texts:
I am developing a community website. We have two separate types of members -- regular members and business members. Business members can access subscription options to sponsor the chapter (website) but the members are not able to access these subscriptions.

I am using lm_paypal for the subscriptions, as it seems to do just what we need it to do.

My only problem is that lm_paypal hardcodes their information in the user profile. THere are three blocks it places on the user profile (or rendered user): a donations block, an active subscriptions block and a block to allow you to subscribe and unsubscribe from subscriptions.

Here is the function in lm_paypal_paid_averts that does this (I think!)

/**
* Implements hook_user_view().
*/
function lm_paypal_paid_adverts_user_view($account, $view_mode) {
global $user;

// In the "my account" view area show all paid_adverts
if (user_access('administer lm_paypal') || $user->uid == $account->uid) {
$account->content['paid_adverts'] = array(
  '#type' => 'user_profile_category',
  '#title' => t('PayPal Paid Adverts'),
  '#weight' => 6, // under History which is 5.
);
$account->content['paid_adverts']['subs'] = array(
  '#type' => 'user_profile_item',
  '#title' => t('Adverts you paid with us:'),
  '#markup' => lm_paypal_paid_adverts_list_nodes($account->uid, 10),
);
 }
}

The only way I can see to display this information is by using the "Rendered User" field in Panels, which displays a lot of other things, including history, recent content, etc. It also displays it on all user profiles, regardless of whether the user can actually access the subscriptions or not (my members can click on the link, but they get access denied page). I would like to have the subscription blocks showing only on the business member profiles and the donation blocks showing on all profiles.

What I need is a way to pull out just this lm_paypal information from the rendered user so that I can display it in its own block and set access control on it so only business members can actually see the subscriptions.

I've been googling for an answer to this for almost a week and found a few different solutions that may work, but require extra modules to be installed and it seems like a lot of extra weight for just needing a piece of a whole. I've found some answers regarding placing code in places, but I have to admit, I'm so close to having this presentable, I'm slightly terrified of trying too many things and somehow messing up. I've built this site myself, starting with no experience at all, and I've had many ups and downs along the way... I am terrified being this close to done and doing something to mess it up and not be able to recover it.

So I am hopeful that someone here can give me a clear answer where I don't have to make guesses and assumptions and perhaps mess myself up!

Is there a way to pull these fields from the user profile and print them separately in their own block?


texts: How can I fix a pager limited to 2 pages?

texts:
The pager on the home page of my website is limited to 2 pages, ie the paging links are only for page 1 and 2 and both next and last point to page 2, but there are a lot more pages than that.

Is there some setting which controls this?


texts: How To Rescue Content from a Corrupt Database

texts: I have spent many weeks inputting content into a commerce system. The database is corrupt. (The website displays fine for an anonymous user, but if you log in you get a blank page. Backups/restore all yield same results) I have now set up a new version of the system, but would like to export/import content and content types from the old system to the new one. How can I do this? Which tables would I need to transfer?


texts: How to make expandable text on clicking more button in views?

texts: I have created a views with trimmed fields and displaying more button to show the full content.I want to do something like collapse text ie.,when i click on more button it has to expand and show the full text.Any help will be much appreciated on how to do this.Thanks in advance.


texts: Taxonomy term not translated in edit node

texts:
I have a taxonomy called « categories » which have terms as listed below:

Here the term “visuels” is the French version of “visuals” that has been translated.

Now in the edit section of an article with ‘french’ selected as the language, I am not getting the French term but instead it is listing the English version as shown below:

Can someone help me with this?


texts: How to hide node edit / delete link in a view conditionally?

texts:
I have a view that lists a content type in a table. There are edit/delete links so the users can edit the content. I want to display these links conditionally.

These are just orders sent in by customers and I only want to let them edit or delete them until the "status" field is set to "processed". Once their order has been processed, they shouldn't be able to modify nor delete it.
I can show them a message via a custom module, but it would be nice to remove the edit/delete buttons for these nodes.


texts:
I'm working on migrating a custom coded site over to Drupal and am having trouble with one piece of functionality.

Currently, if a user wants to download a certain file, they have to enter a serial number into a form. That serial is compared to a list of serials in the db. If the serial matches, the end user can download the file.

Is there any way to create this same type of functionality? I'm willing to use any Commerce add-on, as Commerce will be used for other products.


texts:
The following code allows me to print the secondary menu.

<?php print theme('links__system_secondary_menu', array('links' => $secondary_menu, 'attributes' => array('id' => 'secondary-menu', 'class' => 'menu nav navbar-nav secondary hidden-xs'))); ?>

I get the following output.

link 1

link 2

link 3

Now, I need to add dropdown to the last menu item but I have no idea how to do it. Any guidance much appreciated!


texts: Field value not updating when posting data via JSON

texts:
Here I am getting 200 response but the date field over here is not getting updated.

The node is getting created and other fields are getting updated, only this date field is not getting created.

the error which iam  getting

The Json and content type format is below:

"field_date_of_cage_card_creation": {
        "und": [
            {
                 "date":"17 Dec 2018",
                  "time":"02:45 pm",

                "timezone": "Asia/Kolkata",
                "timezone_db": "Asia/Kolkata",
                "date_type": "datetime"

            }
        ]
    },


texts:
I've recently upgraded to Drush 8, from Drush 6.2 (That was installed using pear).

Drush on cPanel runs fine as root, but when I try to run it as a regular user in a valid Drupal directory I get the error:

Command pm-refresh needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run[error]

this command

Or for just trying to clear cache using drush cc all:

No Drupal site found, only 'drush' cache was cleared

And when I add --debug to the end of a command I get a mysql error with drush:

Access denied for user 'username'@'localhost'


texts:
Recently I updated from Drupal 7.38 to 7.39. It broke access to the site; the error message that i get is the following:

Fatal error: require_once(): Failed opening required
'/home/admin/domains/blahblahblah.info/public_html/blah/blah/includes/includes/database/select.inc'
(include_path='.:/usr/local/lib/php')
in /home/admin/domains/blahblahblah/public_html/blah/blah/includes/bootstrap.inc
on line 3186

Is there anyone who can help me with this?


texts: Provide User with list field of images to select

texts: I am using the flexslider module in conjunction with the views slider to create a slideshow on my Drupal project. Instead of just allowing the user to upload an image for the slideshow (the image really just acts as a background), I would like to provide the user with a list of possible images to choose from. I'm new to Drupal, so this is probably a really easy thing to accomplish, but multiple Google queries have left me in the dark.


texts:
I'm in the process to move the development on Ubuntu 14.04.

At the beginning everything seemed to work fine but quickly I discovered it was not.

Installing new modules, by UI, Drupal stops without (displaying) any error and shows a blank page. After that, the site works undisturbed. You can go back and continue on other tasks.

After many attempts to log the error without success, I run few test with NetBeans discovering that the code stops, with no reason, in system.tar.inc, when preparing to untar the package. Really weird.

Tried with fresh install of Drupal 7.28: the same.

Now I don't know how to go on. Main suspect is PHP 5.5.9, but before starting a new adventure with PHP versions, I'd like to hear you. What should I try first?

No way.
Reinstalled starting from a new VirtualBox, Ubuntu 14.04 and Ubuntu 7.28.
Same story, all is working but stops when I try to install a new module (without errors).

I took note of every piece i installed and can't find a reason why.

apache

    apt-get install apache2

in global section of /etc/apache2/apache2.confd:

ServerName localhost

replace run user in /etc/apache2/envvars

export APACHE_RUN_USER=joe
export APACHE_RUN_GROUP=joe

rewrite mode

sudo a2enmod rewrite

MYSQL

    apt-get install mysql-server
    apt-get install mysql-client
    apt-get install mysql-workbench
    mysql_secure_installation

PHP5

    apt-get install php5
    apt-cache search php
    apt-get install php5-curl php-pear php5-imagick php5-imap
    apt-get install php5-mcrypt libssh2-php php5-dev php5-gd php5-mcrypt

changed values in php.ini

realpath_cache_ttl = 36000
max_execution_time = 300
max_input_time = 60
memory_limit = 256M
post_max_size = 128M
upload_max_filesize = 256M
default_socket_timeout = 60

apt-get install phpmyadmin

complete manually some missing conf in: /etc/apache2/apache2.conf

include /etc/phpmyadmin/apache.conf

virtual host test-me

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName test.me
ServerAlias *.test.me
DocumentRoot /home/joe/Workarea/test-me
<Directory "/home/joe/Workarea/test-me">
Options All
AllowOverride All
Require all granted
 </Directory>
</VirtualHost>

in /etc/hosts

127.0.0.1   test.me

DRUPAL

created a db test-me with collation utf8_unicode_ci
in: /home/joe/Workarea

wget http://ftp.drupal.org/files/projects/drupal-7.28.tar.gz
tar xzvf drupal-7.28
mv drupal-7.28 test-me

in settings.php file:

$databases['default']['default'] = array(
  'driver' => 'mysql',
  'database' => 'test-me',
  'username' => 'root',
  'password' => '',
  'host' => 'localhost',
  'prefix' => 'main_',
  'collation' => 'utf8_unicode_ci',
);

Permissions:

chmod 644 settings.php
chmod  a+w sites/default


texts: How to make page.html.twig based on Vocabulary?

texts:
I want to make different page.html.twig according to different Vocabulary.
 I found this code:

function THEME_NAME_theme_suggestions_page_alter(&$suggestions, &$vars) {
  if (\Drupal::routeMatch()->getRouteName() == 'entity.taxonomy_term.canonical' && $tid = \Drupal::routeMatch()->getRawParameter('taxonomy_term')) {
    $term = Term::load($tid);
    $suggestions[] = 'page__taxonomy__' . $term->getVocabularyId();
  }
}

in How do I theme a taxonomy term page?.
Code does not work:

  Fatal error: Class 'Term' not found in...

Excuse me, what is the reason, I really need to customize the page.html.twig according to the vocabulary, you can help me？


texts: Reload a View with AJAX on a click event

texts:
I have a view displaying a table of related nodes that is embedded on another node's page. The info displayed in embedded view is periodically changing, I want to allow the user to refresh the view by clicking a "Refresh View" link or button without reloading the entire page.

I've checked out the views-hacks module which provides the auto-reload feature, but that doesn't do exactly what I need it to do.


texts: Migrate from xml with two attributes as condition

texts:
I have a problem with drupal migrate, i'm trying migrate content with this xpath:

item_xpath = '/import/content/contentInstance[@contentTypeId=\'ac1ssss___\' @window=\'blank\]';

when i execute drush ms return 0 results, however if i use only one condition in item_xpath:

item_xpath = '/import/content/contentInstance[@contentTypeId=\'ac1ssss___\']';

Return 15 results

'/import/content/contentInstance[**@contentTypeId=\'ac1ssss___\' @window=\'blank\]';

Return 10 results

The xml have content with two attributes, not migrate allows two conditions as attribute?

Thanks for all.


texts: Disable search form in nav from collapsing

texts: Is there a way I can have my search form in nav bar not collapsed when screen size decreases? I'm using bootstrap on Drupal 7


texts: Single custom template file for multiple URLs, in Drupal 7

texts: How do I use same custom template file for multiple URLs in Drupal 7?


texts: I have a content type of event. I need to send all users an email after each 5th events saved, listing this 5 recently created events. What would be the most proper way to do that? I am tending to use hook_node_insert but I'm not sure how to check if it is the 5th node after the last email sent.


texts: Masonry effect not loaded in D7 Masonry Views

texts:
I had installed Masonry Views module, along with Masonry module in my Drupal 7 site.
In my view, I can select format as "Masonry", and had updated the details such as column width.
But the output still displays the view like unfomatted list.

In my status report, it shows
jQuery Masonry: 2.1.08
jQuery Update: jQuery 1.7.1 and jQuery UI 1.10.2

My js file is in: www/mydomain/sites/all/libraries/masonry/jquery.masonry.min.js

I had flushed cached, but the masonry effect still doesn't appear. Any idea what's the problem?


texts: How to configure the CORS module for multiple domains?

texts:
I have JSON content I want to deliver to multiple domains. I have installed the CORS module. I have configured to deliver to one domain like this:

*|<mirror>,http://www.other-domain.com

This works. However, I want to configure for a list of domains and can't work out how to configure that. The following doesn't work:

*|<mirror>,http://www.other-domain.com,https://www.and-another.com

Nor does

*|<mirror>,http://www.other-domain.com
*|<mirror>,https://www.and-another.com

How do I configure this?


texts: How deal with taxonomy term parameter in multilingue site?

texts:
I have a custom controller, who take the tid parameter :

/myroute/{tid}

The tid is upcast with the taxonomy Term so in my controller method I have:

public function index(TaxonomyTerm $tid)

In this function I can get the taxonomy entity.

But for call my controller, it's not SEO friendly... i have : /myroute/43 for example.

So I won't pass the term name, because you can have spécial caractere and it's not a good pratice in a multilingue site.

So for me the best way is to work with pathauto, generate the path for the taxonomy term so i can have :

/[term_category]/[term_name]

Now my question is how pass this to my controller.

I need to call my controller like that:

<a href="myroute/{param_taxo}">

So I am not sure how get the tid of the term with friendly url for SEO.

Any experience about that?


texts: Unable to transfer php logic from node--post-esl-material.tpl.php to template.php

texts:
If I use the following code in template.php and print $link in node--post-esl-material.tpl.php, everything works fine; I get "hey baby."

function eslmooc_preprocess_node(&$vars, $hook) {
   if ($vars['type'] == 'post_esl_material'){
      $vars['link'] ='hey baby';
   }
}

However, if I use the following code and print $link in node--post-esl-material.tpl.php, it doesn't print anything.

function eslmooc_preprocess_node(&$vars, $hook) {
   if ($vars['type'] == 'post_esl_material'){
      $xyz = '';
      if (empty($content['field_link']))
         $xyz .= '';
      else {
         $xyz .= '
';
          $xyz .= '
LINK
';
           $xyz .= '
';
            $xyz .= $content['field_link'];
           $xyz .= '
';
         $xyz .= '
';
      }
      $vars['link'] = $xyz;
   }
}

I cannot get the PHP logic to work. Can anyone see a mistake within the code?


texts:
HI I'm trying to work out how to translate my menu items, weirdly Log Out appears to be the only one which translated from the onset. But I can't see where this was implemented. If I search for the menu name as a string in transate interface/transalte they can't be found. and editing a menu offers no extra fields for translate options??

any body know?


texts: rendering node $content but not all $content is there

texts:
node $content variable does not contain all node elements

On my local test site the $content variable contains around 10 elements which I used to build my custom node template.

but now on the live site I only have 2 elements in the $content array.

I can't figure out why and looked everywhere but can't find where $content is set and or why the the other 'elements' of my node are not loaded in the $content variable.

using the normal 'view' all content is available.
using my node--teaser.tpl.php not on the live site.

Both sites have the same modules enabled and are using similar node types.


texts: Showing "New content" form on main theme

texts:
I'm using drupal 8
I have a page with diferent content types like "beers, wines, etc". I want to let users publish their own content inside this content types, but I want a form in the main theme, no administration theme. How can I do it?


texts: How can I hide the alt text shown for an image?

texts: When I upload an image and write text in alt field in Basic Page, the alt text later show up in down part of image. How can I remove it?  I am using Drupal 7.


texts:
I was looking at the SWEAVER module and managed to shorten the login field somehow in BARTIK theme. Now when I log out as ADMIN, it is not possible to Log in again because the LOGIN field is just too short to write in.

I wanted to use THEME DEVELOPER module to identify where the CSS for the region is, but I can't, because in ADMIN account the LOGIN field is not present.

The question is how to write something into this very short username and password fields? If I click in it the field gets highlighted, but when I write in it, nothing happens.

Unfortunately, I was trying to restore an older version of the database and restored a different one by mistake. Now im trying to restore the one I wanted but currently fighting with BACKUP AND MIGRATE module. Seems I just can't restore it because it's too big.


texts: Restrict webform component use to certain roles

texts:
I want to restrict the usage of a custom component only to a specific role.
What's the drupal way of doing that?
I tried https://drupal.org/project/webform_component_roles but this just defines usage permission for all the components not each specific one.


texts: Drush package handler - recommendations?

texts:
After a day of cursing drush for refusing to update anything, I finally discovered that using --package-handler=wget instead of =git_drupalorg allowed everything to run smoothly. I suspect there were still problems with my git settings.

Why would I want to use git_drupalorg as the package handler? I see that most examples online use it, but perhaps people are defaulting to it on the basis that they're versioning with Git. Sure, I'm versioning my projects with Git too. But that versioning still happens, regardless of what technique is used to download core or modules. I just can't see what advantage there is in using git as the package handler.

But since everybody else is doing it... have I missed something?

(I don't ever contribute code to drupal.org. I can see why using git would be necessary for that. But then presumably contributors keep a totally separate installation for code development.)


texts: How can I build an FAQ Page with sections?

texts:
I am seeking to build an FAQ page that covers a few different types of topics, thus creating a need for sections, preferably with links. Like below:

I am using Drupal 8 and have the FAQ Field module installed. I'm having trouble creating a content type since I cannot add the FAQ Field multiple times to the same content type. Does anyone have any ideas?


texts: Programmatically schedule the execution of a component

texts:
I have found the function rules_scheduler_schedule_task() under the rules module which supposedly does exactly what I want, but I have trouble interpreting how the function arguments are built. The arguments of that function are an array with the following keys :

config: The machine readable name of the to be scheduled component.
date: When the component should be executed.
identifier: User provided string to identify the task per scheduled

And finally :

state: A rules evaluation state to use for scheduling.

I don't have any trouble with the first three arguments, but what is the meaning of the later (state) ? Is it where I put the arguments of the components ?
Could someone provide an example ?


texts: How to set admin settings in custom module in drupal 7

texts:
I have inserted some html div tags in page.tpl.php file which expands on mouse click. I want to make dynamic style like widh, height or margin from top left/right via admin setting form.
I have created admin setting form. How can I achieve this?


texts: Where can we translate Format settings label?

texts: I am just wondering that where we can translate the Format setting labels which is configured in Manage display of content type. I checked in configuration translation, user interface translation but i didn't find the label which i am searching for.Can anyone help me in this regard. please find below screenshot for reference:


texts: Webform 4 - More than one conditional hides or shows component - Confusing Is & Isn't Shown?

texts:
I'm getting the following error: More than one conditional hides or shows component -- Once a user selects one option, it should hide other fields not pertaining to the selection. attached screenshot.

not sure what I'm doing wrong.


texts: How to print the drupal username -without a link to it- inside the node profile?

texts:
So far the only thing that works is $name wich prints the username with the link.

I´ve tried $account->name, and it won´t print anything at all (I´ve tried $author and $account_name; too, without any luck).

I want to print the username inside their profile usernode in a Drupal 6 installation, but don´t want to print it with the link to it, just the username.

Thanks for your help!


texts: Views and Panels: Exclude already displayed items from view

texts:
I have two views on the frontpage, first one is a gallery and it should show only articles which have "promoted to frontpage" checked. The second view should show all the articles except the ones show in the first view.

I saw this question, but the answer does not help me, because in the second view, i don't want to exclude the "promoted to frontpage" articles, i just want to exclude the first 6 of them, all the other should appear mixed up with the other articles.

I also found this question, but as i use panels, i think it's not working for me.

How can i pass varibales from one view to another, or how to setup conditions to work like that? Or how can i set up more complex filters in a view, like

(promoted_to_frontpage== 1 && offset == 6) || (promoted_to_frontpage == 0)


texts: How to theme back end forms created by a custom module?

texts:
I want to be able to theme a custom form I create using a custom module that builds a form. The form is created programmatically using the code below:

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

    $form['name'] = array(
      '#type' => 'textfield',
      '#title' => $this->t('Name'),
      '#required' => TRUE
    );

    $form['address'] = array(
      '#type' => 'textfield',
      '#title' => $this->t('Address'),
      '#required' => TRUE
    );

    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => $this->t('Submit'),
    );

    return $form;
}

This form is rendered on the Drupal 8 back-end and uses the admin theme classy BEGIN OUTPUT from 'core/themes/classy/templates/form/form.html.twig'. However there isn't a override file name suggestion.

How would I theme this form?


texts: Make visible the article in Draft and Needs Review mode to other members of the community group

texts:
I am facing a permission issue, I found not yet a resolution.
I am using Workbench, Workbench Moderation and Organic Groups.

User1 creates a content in a community (organic groups)
Then he creates content setting its moderation mode to: Draft

Now User2 ask permission to join group, but he is unable to see the above article until is set to Published mode.

How can they share the article set in Draft mode?


texts: How do I hide/remove a views menu tab from some pages?

texts:
I created a page view with Page Settings for the path being equal to:
node/%/content/recentnews

I also set the Page Settings menu to have a menu tab.

How does that system decide what pages will display the menu tab?

I have one page where the menu tab is displayed, but I don't want it to be shown on that page. Is there some way to remove/hide it?

Thanks,
Greg


texts: Modules installed with composer do not have a version number

texts:
Recently we ran into an issue where the Focal Point module has a dependency on a specific version of the CropAPI module. Since composer is installing these modules directly from git, they dont have the version numbers that were added to the .info file by the drupal.org packaging scripts. This cause the focal point module to fail during enable.

Has anyone else solved this?


texts: How to load a entity or node in form builder class?

texts:
I want to load default values in my form. I am fetching the node of the table row from form list and passing it into route.

my_form_eform:
 path: '/edit/{bar}'
 options:
 parameters:
  bar:
  type: entity:node
 defaults:
  _form: '\Drupal\my_form\Form\EditForm'
  _title: 'Edit Item'
 requirements:
  _permission: 'access content'

and code for editform.php is

namespace Drupal\my_form\Form;

use Drupal\Core\Session\AccountInterface;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Form\NodeInterface;

class EditForm extends FormBase{

// public function content(AccountInterface $index, Request $request) {

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

public function buildForm(array $form, FormStateInterface $form_state , NodeInterface $bar = NULL){

 // $id = $bar;
//  $result = db_select('my_form','t')
// ->fields('t',array('id','title','author','stream','description','price'))
// ->condition('id',$id)
// ->execute()->fetchAssoc();

// $dtitle = $result['title'];
// $dauthor = $result['author'];
// $ddesc = $result['description'];
// $dstream = $result['stream'];
// $dprice = $result['price'];

$form = array();

$form['title'] = [
  '#type' => 'textfield',
  '#title' => t('Title of your book.'),
   '#default_value'=> $dtitle
];
$form['author'] = [
  '#type' => 'textfield',
  '#title' => $this->t('Author.'),
   '#default_value'=> $dauthor
  ];
$form['stream'] = [
  '#type' => 'select',
  '#title' => t('Stream'),
  '#options' => array(
  'ECE' => t('ECE'),
  'CSE' => t('CSE'),
  'ME'=> t('ME'),
),
   '#default_value'=> $dstream
  ];
  $form['desc'] = [
  '#type' => 'textfield',
  '#title' => t('Description'),
   '#default_value'=> $ddesc
  ];
  $form['Price'] = [
  '#type' => 'textfield',
  '#title' => t('Price'),
   '#default_value'=> $dprice,
  ];
$form['ADD'] = [
  '#type' => 'submit',
  '#value' => $this->t('Update'),
];
return $form;

}

I read about parameter upcasting, but its not required for node instance.

If I am passing the id in function itself through account interface it's giving the error

  must be compatible with formbuilder class

Now I am using NodeInterface argument but its also giving the error

  Argument 3 passed to Drupal\my_form\Form\EditForm::buildForm() must be an instance of Drupal\Core\Form\NodeInterface

Please help. How can I load my id so that default values for form fields can be fetched from db?


texts: Add meta tags when block exist on page and its cached

texts:
I have block with social sharing buttons. Need add 'og' and 'twitter' meta tags on page where block exists. I know that can add it throw drupal_add_html_head() inside block content render, but if block is cached meta tags not appear.
How do this?


texts: How does the #submit property works with #ajax?

texts:
I'm having trouble understanding how works the #submit property of a submit element in Drupal 8, when Ajax is used.

I found this code, as an example of how to implement ajax buttons which add or remove items to/from a form : https://gist.github.com/leymannx/72d41cf0baa4dee62d6ddc89bc7c7a5a

The "add item" submit button in the form is described by the code below :

$form['container']['actions']['add_item'] = [
  '#type'   => 'submit',
  '#value'  => $this->t('Add another name'),
  '#submit' => ['::MYMODULE_MYFORM_add_item'],
  '#ajax'   => [
    // Could also use [ $this, 'colorCallback'].
    'callback' => '::MYMODULE_MYFORM_ajax_callback',
    'wrapper'  => 'my-container', // CHECK THIS ID
  ],
];

There are 2 callback functions used here : the value of the #submit property and the value of callback in the #ajax property.

What happens exactly when the user clicks on the button ?
As I understand it, MYMODULE_MYFORM_add_item function is first called, then MYMODULE_MYFORM_ajax_callback function.

But, in a custom module, I'm currently doing something like this :

// Implementation of hook_form_FORM_ID_alter(), to customize the user register form
function mymodule_form_user_register_form_alter(&$form, FormStateInterface $form_state, $form_id) {

    // Add a "Fill username" button
    $form['account']['fill_username'] = array(
        '#type' => 'submit',
        '#value' => t('Fill username with Bob'),
        '#weight' => -1,
        '#submit' => ['mymodule_fill_username_submit'],
        '#ajax' => array(
            'callback' => 'mymodule_fill_username_callback',
            'wrapper' => 'edit-account'
        )
    );
}

// #submit function of the button
function mymodule_fill_username_submit( $form, FormStateInterface &$form_state ){
    \Drupal::logger('mymodule')->notice('mymodule_fill_username_submit');
    $form_state->setValue('name', 'Bob');
    $form_state->setRebuild( true );
}

// callback function of the button
function mymodule_fill_username_callback( $form, FormStateInterface &$form_state ){
    \Drupal::logger('mymodule')->notice('mymodule_fill_username_callback');
    return $form['account'];
}

The aim is to inject a value in the "Username" field, just to try and understand how this works.

As I click on the button, mymodule_fill_username_callback is called (I see the log) but mymodule_fill_username_submit never. And, of course, the field is not filled at all...

I don't understand what happens here. Nor how it's supposed to work.

Can anybody help ?


texts: Making track of who has seen which content

texts:
In a system with users number changing anytime, I need to make a system which shares content between them and makes track of who has seen which content.

Is there any module for doing it?

(I read about Flag module, but it is sharing one flag for all users, so it's not a good recommendation)


texts: How to use a link in Main Menu to switch language of current page?

texts:
Now I have three links to switch language on Main Menu:

http://www.example.com/en
http://www.example.com/de
http://www.example.com/it

The problem is the above all links to the <front> page. How can make the links dynamic? Hopefully there is a:

http://www.example.com/it/<current_node> or
http://www.example.com/it/<current_page>

I tried Menu Token and Menu Block (to embed the Language Switcher Dropdown) but failed.

Any suggestions?


texts: How to use CKEditor for basic HTML formatting with webforms automatic emails?

texts:
How do I use CKEditor for the 'email template' field when setting an automatically generated email for a webforms submission.

The email template field is found when you go to Content of type 'webform' > Click the Webform Tab > Click the sub-tab Emails > And edit an existing automatic email.

I want to render this textbox as CKEditor and have the email follow through with any bold, underline and heading HTML formatting.


texts:
I'm using Apache SOLR as search engine. Everything works fine, indexing as I want, showing the data as I want. I only need to show the PDF which belongs to a certain snippet on a search result. Example:

Result 1: Node Title
Snippet1 -> snippet from node
Snippet2 -> snippet found in pdf x on this node
Snippet3 -> snippet found in node

Result 2: Node Title
Snippet1 -> snippet from node
Snippet2 -> snippet found in pdf x on this node
Snippet3 -> snippet found in node

Result : Node Title
Snippet1 -> snippet from node
Snippet2 -> snippet found in pdf x on this node
Snippet3 -> snippet found in node

The idea is, to have a list of snippets which can be either on the node itself or in a pdf (or any other file) which is attached to this node and link to it (in file case).

Tika extension and Apachesolr_attachments are in place and working.

I get the $vars['snippets'] from hook_apachesolr_search_snippets($vars) and I can modify the output. But I don't see how I could add more information to it.

Any help appreciated.


texts: Using migrate with a multi-page / paginated source

texts:
I have a working module pulling a JSON feed into Drupal using the Migrate module. However, the feed is paginated, and I am only getting the first page of results (ordered DESC on creation, so giving the latest items).

I need to go back through all pages and get all/any changed items, but I can't see how to tell Migrate to iterate through the pages.


texts: Call another field inside preprocess_views_view_field

texts:
how can I access the value of another field inside the preprocess_views_view_field.
This is an example:

function THEMENAME_preprocess_views_view_field(&$variables) {
  $view = $variables['view'];
  $field = $variables['field'];

  if ($view->id() == 'VIEW_NAME' && $view->current_display == 'DISPLAY_NAME') {
    if ($field->field == 'FIELD_NAME') {
      $my_output = manipulation(ANOTHER_FIELD_NAME_IN_VIEW);
      $variables['output'] = $my_output;
    }
  }
}

It's possible or should i use it _preprocess_views_view?


texts:
The idea behind this module Commerce Bundle is great, i need to use this module in a fashion e-commerce site to enable the user to buy a set of clothes grouped in one style or one look, for example a shirt and a trouser and a jacket, those are separate products, with color and size variations. we need to group blue trouser with white shirt and black jacket in one bundle (style), the problem i face when i need to group those products is the size matter, as when i try to group the products in one bundle i had to select those products also based on size! while actually i don't need the size in bundle. the size will be selected by the user for every product in the bundle when he checkout.

How i can solve this problem?


texts:
For my job site, jobs are tagged from terms of Tags vocabulary where new ones can be added. Sooner jobs expire and new arrive.

That has resulted in bloated taxonomy vocabulary with 2400 terms (or 2400 pages). I guess many remain empty for long periods.

Many tag pages simply show no classified content available which has attracted Google's Panda penalty.

What I want is removing those tags not used for any node, and automatically deleted those that have not been used in the past 3 months or so get.

Is there any simple way for doing this?


texts: Which Rules Event should I use to trigger a Rules Action when accessing a particular Views page?

texts:
I have a Views page, located at, say, www.example.com/entrepreneur.

When a user accesses that particular url, I want some rule to be executed.

I've looked at the Rules admininistration page to find out what exactly I should use as (the mandatory) "React on event", which looks like so:

But I am not able to find "page is viewed", but I need to execute the rule when user accesses the particular single page.

Any suggestions?


texts: How to alter existing page of a node that is Organic Group and add Two links above

texts:
i am using Drupal 7 with og support and also the og corresponding modules (og, entityreference, services_menu) inside DrupalGap.

As can be seen from the picture i want to add some links(drawed in red color) on top of the display of an Organic Group. I want the subscribe/unsubscribe button AND the navigation buttons above.


texts: How to alter the Views field Format drop-down menu

texts:
I am exporting some XML feeds using Views. One of these fields needs to look like this:

<image>http://example.com/path/to/myimage.jpg</image>

I am storing my image in a CCK field. When selecting that field in Views, these are the options provided:

I don't need an teaser, full node, editable something, or HTML formatted link, just the path to the image. How do we alter that Format selector?


texts: Drupal Commerce - add fields to product or product display?

texts:
Ive used Ubercart before but im making my first site with Commerce. Im wondering if I should add fields (eg image and description) to my product or product displays?

Im making a site where most of my product displays will relate to one product only.

In some cases however you will have a choice of different weights to purchase. I dont yet know if Ill do this with multiple products and one product display, or if  another method would be simpler.

In the future I may want to make multipacks, so combine 10 products into a single purchase and then either give a discount on this pack, or a discount on the total price (which would allow users to substitute the chosen products so long as the total price is the same). Thanks


texts: Alter Address field in order to add a list of cities

texts:
I need to alter the address field because I want to transform the locality textfield in a nested select box along with administrative_area value.
I've tried to do that with a hook widget_alter, form alter, after_build callback, but any of them run my ajax callback.
Here is what I'm trying to do:
function ffcore_field_widget_address_default_form_alter(&$element, FormStateInterface $form_state, $context) {
  $element['address']['#after_build'][] = 'ffcore_validate_cities';
}

function ffcore_validate_cities(array $element, FormStateInterface $form_state) {

  foreach (Element::getVisibleChildren($element) as $key) {
    if (!empty($element[$key]['#required'])) {
      $element[$key]['#required'] = FALSE;
    }
  }
  $element['locality']['#weight'] = 1;
  $element['locality']['#prefix'] = '
';
  $element['locality']['#suffix'] = '
';
  $element['administrative_area']['#weight'] = 0;
  $element['administrative_area']['#ajax'] = [
    'callback' => 'ffcore_change_cities_by_dept',
    'event' => 'change',
    'wrapper' => 'change-city-list',
  ];
  return $element;
}

function ffcore_change_cities_by_dept(array $form, FormStateInterface $form_state) {
  return $form['locality'];
}

In that way, I can change the order of the fields, but I can't use the ajax callback.
Is there any other way to achieve that?


texts: View Custom Table not showing up in views list

texts:
I am using "View Custom Table" module, and am trying to render a table from the drupal database. According to the documentation, after the Custom table is defined, it should be available as a dropdown to "Show" when creating a new View. But the Custom Table is not showing up for me in there. I have already tried clearing both Views cache, and the site cache, but none of them work.

Any ideas? or other ways of rendering a database table


texts: How to clear or update only anonymous cache from module?

texts:
I have nodes updating from my module in Drupal 7 and also complicated view with result cached in the module by cache_set() and cache_get() functions.

Anonymous users get old info with broken links and other problems after nodes updating in module. Disabling "Cache pages for anonymous users" solves the problem, but how can I update anonymous page cache by the function after update?

I can't just clear all cache because of complicated views cache, it will disable all site for the time.


texts:
I'm trying to rewrite the output of the title of a panels page. I would like to add a class, for example. Actually, if I understand well, panels takes the layout from page.tpl.php then from the selected layout for its contents.
I tried to use taxonomy-term.tpl.php (I'm using the taxonomy page override by panels) but it doesn't work. Still, panels takes header, navbar and title styles from page.tpl.php.
Is there a way to avoid this? Is there a way to add a class or an id to the title element of a panels page?

Edit:
I found this which is for node_view panels template. I don't know if for term_view is different.


texts: Ajax properties in draggable table not being rendered with drupal_render, need workaround

texts:
I'm building a form where part of it is a draggable table. The table consists of rows with a picture in one cell and a delete button on another. Basically a user can click the delete button on each row and an ajax call will delete that specific row.

This is the code for the table:

$header = array(
    t('Image'),
    t('Operations'),
    t('Weight'),
);

$form['images'] = array(
    '#tree' => TRUE,
    '#prefix' => '
',
    '#suffix' => '
',
    '#theme' => 'table',
    '#header' => $header,
    '#attributes' => array('id' => 'images-table'),
);

foreach ($image_array as $fid => $uri) {

  $image_data = array(
      '#type' => 'markup',
      '#markup' => theme('image_style', array('style_name' => 'object_image_preview', 'path' => $uri)),
  );

  $button_data = array(
      '#type' => 'button',
      '#value' => t('Delete'),
      '#submit' => array('ajax_callback_remove'),
      '#ajax' => array(
          'callback' => 'ajax_callback',
          'wrapper' => 'image-fieldset-wrapper',
      ),
  );

  $weight_data = array(
      '#type' => 'weight',
      '#title' => t('Weight'),
      '#delta' => 10,
      '#title-display' => 'invisible',
      '#attributes' => array('class' => array('images-weight')),
  );

  $form['images']['#rows'][] = array(
      'data' => array(
          drupal_render($image_data),
          drupal_render($button_data),
          drupal_render($weight_data),
          ),
      'class' => array('draggable'),
  );

}

drupal_add_tabledrag('images-table', 'order', 'sibling', 'images-weight');

return $form;

The code creates the draggable table with the images and the buttons but i'm running into  drupal_render not rendering the ajax properties of the button.
This has also been discussed here Drupal 7 API/drupal_render

Despite that discussion I haven't been able to find a solution that applies to my code. I've tried rendering the data this way:

drupal_render_children(drupal_get_form('object_image_create_data', $vars)

where object_image_create_data() returns the same data and it works in rendering the ajax properties correctly, but with this I'm getting an error

  Notice: Undefined index: callback in ajax_form_callback()

Also, I'm not able to get to the $form_state of the original form to make the changes so that when the form is rebuild the clicked row is removed

Any help on how to fix this would be appreciated.


texts:
I'm using Drupal 8 and I created a global layout with a custom theme I coded myself, and I added a custom content type for the home page. I have almost exactly what I want except for the following points.

I should have a block somewhere in the home page containing the last 3 articles posted on the website, and of course, a link to each of these articles. How am I supposed to do that? All answers I found were talking about Drupal 7.
I'm supposed to do the same as the last articles but for photos albums. I guess I have to use a module,  do I?


texts: Trying to get one image field to pop up images from another field using lightbox2 in Views

texts:
I have two image fields in a View that shows one of the image fields and the other image is excluded from display.

I would like to click on the image that's displayed and have the other image popup using Lightbox2 which I have installed.

I'm a little bit confused because there's different information about how to go about doing that.

I got as far as rewriting the output of the displayed image field to the popup image field using replacement tokens and I put 'lightbox' for rel text. But nothing happens. The displayed image doesn't become a link.

What am I missing?


texts: How to change the image style used in a field in specific view results?

texts:
In Drupal 7 I used hook_views_pre_render() to update the image style for specific results. I'm trying to do the same for a view in Drupal 8 but I don't have the same options available in the field.

An example of the code I used before:
$view->result[4]->field_field_image[0]['rendered']['#image_style'] = 'image_style_name';

There's no longer a 'rendered' array, just an ImageItem object with the target_id, title, width and height.


texts: Why is the blocks configuration screen is showing regions from the .info file of the admin theme, not the default theme

texts:
I have a Drupal 6 site with a default custom theme called c2. I also have Rubik/Tao installed, and have Rubik set as the admin theme.

When I access admin/build/block page, the regions listed are for the admin theme, not the regions from the c2 theme. When I'm on this page the first theme/tab listed is c2, and it's active. When I set the admin theme to c2, the missing regions show on admin/build/block.

How do I get the block confirmation page to show the regions for the current theme it is claiming to be showing?


texts: How do I show only those node that have images available via a view?

texts:
I have a content type with image, title, and body fields. I created a view to show these things on front end.
Here images are not available for all nodes of this content type.

I need to show only those nodes in front end that have images.


texts: how to a translatable string in drupal theme?

texts:
I want to put a string as a signature in drupal theme I am working on. the website is multilingual and the string should be translated based on the current language of the website. I don't know how to do it.

my drupal version is 6.

Would you help me?


texts:
I have a structure of a leaflet showing the current marker

  $marker = array(
    'type' => 'point',
    'lat' => $lat,
    'lon' => $lon,
  );

  // Add icon only if we got url (most of the times).
  if ($marker_url) {
    $marker['icon'] = array(
      'iconUrl' => $marker_url,
      'iconSize' => array('x' => '38', 'y' => '38'),
    );
  }
  $markers[] = $marker;

How can i add, via code, an alt attribute to a leaflet marker in drupal?

Thx!


texts: Field is not removed from 'field_config_instance'

texts:
Possible Duplicate:
  Clean Deleted Field from Database

Why the record about deleted field still exists in  'field_config_instance' only status 'deleted' = 1 ? But from 'field_config' records about field removed completely.

function mymodule_uninstall() {

  field_attach_delete_bundle('spproduct' , 'spproduct' );
  field_delete_field('field_spproduct_image');
  field_purge_batch(10);
}

I wont to remove field from all entity types wherevere it is used and from tables.


texts: How to put conditional multiple recipients in drupal 7 default contact us form

texts:
I am working on a multilingual Drupal 7 site using a single contact us form. It has 4 languages. The contact us form is multilingual i.e labels of form fields changes, depending on the language you have selected. But it has a single recipient now.

Now I want it to have conditional recipients i.e if English is selected the contact us form should be emailed to a@gmail.com and if Danish is selected then to b@gmail.com and so on.

Any suggestions how to do it ?

website form : http://dev-salman.com/venuepoint/contact


texts: How can you create a list of referenced nodes in a view?

texts:
I have a content type on my Drupal 7 site which has a field called field_related, with a type of Node reference (I've installed References). This allows me to select nodes that are related to the one I am editing. I'd like to then display these in a view, but am coming unstuck with the setting up of the view.

I've set up a single document with some related nodes for testing. If I set a relationship up in my view as "Content: Related Nodes (field_related) - reverse", I see a list of the related nodes I defined. But I see these same related nodes on every single page - not just the page they are defined for. ("Require this relationship" is ticked.)

If I set up the relationship as "Content: Related Nodes", nothing appears. I've tried a variety of filters, contextual filters and relationships, but that hasn't helped much.

I'm sure I'm missing something obvious ... can anyone enlighten me?

Some screenshots of the current setup, so you can see what I've got so far:

View

Contextual filter

Relationship


texts: How to resolve 404 Not found: Could not find the controller?

texts:
I am new to Drupal and its web services.

I am working on user forgot password API by using the Services module. Below is my service resource code:

function test_api_services_resources() {
    $definition = array(
        'test_api' => array(
            'actions' => array(
                'forgot_password' => array(
                    'help' => 'Reset user password',
                    'callback' => '_test_api_resource_forgot_pass',
                    'args' => array(
                    array(
                        'name' => 'email',
                        'type' => 'string',
                        'description' => 'The user email id',
                        'source' => 'data',
                        'optional' => FALSE,
                    ),
                    ),
                    'access callback' => 'services_access_menu',
                    'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/user_resource'),
                ),
            ),
        ),
    ),

    return $definition;
}

function _test_api_resource_forgot_pass($email){
    //Just for testing purpose i have returned my input parameter
    return $email;
}

Whenever I try to run this in Firefox Poster addon I get an error 404 Not found: Could not find the controller. I don't know what is the exact issue!


texts: Is Drupal Console aimed to replace Drush?

texts: Is Drupal Console (which is available for Drupal 8) aimed to totally or partially replace Drush?


texts: Show content of custom password field on mouseover

texts: I need to hide a custom password field content and display it when a user needs to see and copy it. Using Password Field module is one way to go. But then Password Toggle module doesn't seem to support Password Field module yet. Using QTips module feels like overkill for just one small field on the whole website. So what are cheaper performance-wise alternatives?


texts:
I have used Authcache and memcache to cache pages for authenticated users.

However, I have a user specific menu displayed at top right of every page, and the menu sometimes displayed a wrong users' infomation (avartar, username).

I have checked the Authcache Retrieve menu title using Ajax or ESI option at every menu entry's config page.

I also have tried to generate the menu items in code, but both with no good.


texts:
I am trying to create a TEXT column.

function _mymodule_installed_fields() {
  return array(
    'mymodule_summary' => array(
      'field_name' => 'mymodule_summary',
      'label' => $t('Summary'),
      'type' => 'varchar',
      'not_null' => TRUE,
      'length' => '400',
    );
  );
}

I get a VARCHAR column. How do I get a TEXT column?


texts: How can I tell if module_load_include() is working?

texts:
I'm getting errors such as

Fatal error: Call to undefined function webform_expand_select_ids()

and so I'm trying to include all the includes in /sites/all/modules/webform/components.

I'm not even sure if that's going to help, but to help figure that out I was hoping that I could at least check and see whether module_load_include() is successfully including files?

  if ($form['#form_id'] == 'quiz_answer_key_node_form'){
    $url = "./sites/all/modules/webform/components/*.inc";
    $filenames = glob("$url");
    $type = 'inc';
    $module = 'webform';
    foreach ($filenames as $filename)
    {
       dsm(module_load_include($type, $module, $filename));
    }
}


texts: How do I use paging in a content type containing a paragraph?

texts:
I created a content type with just one multivalue field which turns to be an "entity type revisions" (i.e. Paragraphs).

I would like to have paging working on this setup (when number of Paragraphs exceeds some quantity) but just creating a view with paging does not work as the "pageable" content is the content type itself, not its fields.

Having Paragraphs as a standalone content type is a no-go as I do not want to have them scattered in the content section.

How can I achieve this?


texts:
I have 2 user roles in my Drupal 7 site 'A' and 'B' respectively:

users of role 'A' can create and publish content.
users of role 'A' can see content they created on their profile page. (For this purpose I created a block to display content and put it on user's page.)
users of role 'B' can not create content but they can view all published content.

Content in my case is an invitation to some event (ie "Who wants to play football on Friday?")

Each content has 'Participate' button which users of role 'B' can submit.

How can I display in 'A' users pages the names of 'B' users who want to participate in their event?
How can an 'A' user confirm participation of some 'B' users and dismiss the rest?


texts: Why does the Wysiwyg module and Ckeditor library not show the CKEditor when editing a node?

texts:
I installed latest version of the WYSIWYG module (dev version) and also the latest CKEditor library. This module can find the library, I selected the ckeditor for text format "Full html" only.

But when I try to edit the content it does not show up. All modules are update to date. I have other Drupal sites and this module works with no problem.

What to do?

Notes:

The text is there when you start an edit session of the node. But it is just full html text, with all the HTML code being shown, as in this example:

I also tried by enable of an additional editor, as shown here:

But still nothing happens.
The link to enable/disable the editor is missing (and it should be there). I spotted that problem at first. I wanted it to be disabled by default and then by clicking on it it should be enabled. but the link is not there. Here are the scripts errors:

I cannot see something.


texts: How much memory and storage does a website take on a server?

texts:
Hello Drupal community!

This is my first time working with Drupal and AWS. I would like to know if an AWS t2.micro instance would be good enough for running a new Drupal 8 website with moderate requirements. My main goal with this is to stay within the AWS free tier, i.e, spend no money for one year whatsoever. The EC2 information page states that a t2.micro instance has 1GB of memory and "EBS only" storage (bear in mind that this is the storage for the server). After looking into this I found that EBS has 30GB's of storage. Will that much be sufficient?

Totally I have to run a Drupal 8 site, an AWS RDS MySQL database and AWS S3, all on this instance comfortably (which obviously means a good amount of people should be able to view the website  at the same time too). Any requirements for Drupal 8 would be welcomed.

Please get me out of this jam. Thanks a bunch!


texts:
For SEO reason I need my site to always use language code in the URL. At the moment mysite.com/en/news is also accessible through mysite.com/news, according to my SEO contact, mysite.com/news should return content.

How do I achieve this behavior?


texts: How to get node ID from drupal 7 when i know title (title shouldnt be duplicated) Drupal

texts: My module is creating node with title "123title", after this i want to create next node, with entity reference field whose have to contain id of node with title "123tile" whose i created before. –


texts:
I have create a new content type with a field of email. In this field I put the email address of the person I want.

The case is:
I want every time the node of this content type updated, to send an email to the address from the email field.

With Rules module I cannot find a proper way to make it work because Rules are on a very early point of development.

There is two problems with rules:
1st - I have create a simple action to send an email every time the node is updated. This is work fine. When I create a condition "Node is of type" and select only one content type the sending email action is still working for all content types.

2nd - I cannot find any proper method for what suppose to write to the reciptient field to send the email to the address from the email field.

Can any one help? Any thoughts?


texts: Is it possible to use a user display form in a page?

texts:
I've seen that it's possible to create different user display form here :

/admin/config/people/accounts/form-display/my_infos_form

How can I call it in a particular page for instance : /my/infos ?

As we have a lot of fields, we would like to separate the user edit page into multiple form page.


texts: Schema.org itemprop="url" inside anchor object (link)

texts:
I'm trying to use the preprocess function to change the default outpot of links  to include Schema.org's itemprop="url" inside the anchor object, as well as adding a  to the title of the link. For example:

Example Title

*Just to clarify: I want to do this for any link, not just menu or breadcrumb links.

I have managed to do something similar with images using the following code inside my template.php file, but had no luck with adapting it to links:

function THEME_preprocess_image(&$vars)
{
$vars["attributes"]["itemprop"] = "image";
}

Source can be found here.

I know that Microdata module might be able to handle that with a few modifications, however, I'd rather do everything manually instead.

I have spent hours searching for solutions but couldn't find any..
Any help would be greatly appreciated, thanks!


texts:
In a "course" content type, I have an "instructor name" field, which points to a registered user.

When the "course" content is saved, I need to check if there are any registered users with the name in the "instructor name" field. If there is, I'd like to relate the created content with his id. If not, I'd like to create a new user (a dummy user maybe)  and relate the content with that user.

Is this possible without php coding, just using modules? And if it is, how? I am a new drupal user with .net background and have no knowledge of php.


texts: How to define an optional argument to Route callback

texts:
I want define a simple controller action, which receive optional argument:

<?php

namespace Drupal\hello\Controller;

class SimpleCallback extends ControllerBase
{
    public function sayHiAction($name = 'there')
    {
        return new Response('Hi ' . $name, 200);
    }
}
?>

If I define the routing like this

# file @hello.routing.yml
hello.sayHi:
  path: '/hello/{name}'
  defaults:
    _title: 'Say Hi'
    _content: 'Drupal\hello\Controller\SimpleCallback::sayHiAction'
  requirements:
      _permission: 'access content'

GET /hello just gives me 404 response.

Follow official documentation, I updated my route:

# file @hello.routing.yml
hello.sayHi:
  path: '/hello/{name}'
  defaults:
    _title: 'Say Hi'
    _content: 'Drupal\hello\Controller\SimpleCallback::sayHiAction'
    custom_arg: 'there'
  requirements:
      _permission: 'access content'

But nothing changed.


texts: How to hide webform block for users who submitted the form already?

texts:
I have created an inquiry form using the Webform module. I displayed it using block by enabling Available as block (Form Settings -> Advanced Settings) which is working fine and the form submitted by all (Anonymous, Authenticated user).

I want to add a visibility that if a user has already filled the form, the form should not be visible to that user until the site is close.


texts: How to write a template_preprocess_node hook to get the Image Style for an Image field?

texts:
I have an image field on Basic Page content type with a View Mode where format = Image and Image Style = Large.

How can I write a template_preprocess_node hook to get the Image style that is based on the View mode?

Here is what I was thinking but got stuck and cannot figure out what to call.

function mymodule_preprocess_node(&$variables) {
  $variables['view_mode'] = $variables['elements']['#view_mode'];
  $node = $variables['elements']['#node'];
  if($variables['view_mode'] = 'default' && $node->hasField('field_image')){
    $fieldImage = $node->get('field_image');
    /** stuck here as I cannot find method to get the Image Style **/
    //goal
    $image_style = $fieldImage->getImageStyle() // not sure what method this would be
    $image_path = $fieldImage->entity->getFileUri();
    $image_url = ImageStyle::load($image_style)->buildUrl($image_path);
    $variables['content'][0]['image_url'] = $image_url; // this is the goal
  }

}

twig template


texts:
I override node display for content type Match Fixtures by creating node--match-fixtures.tpl.php file and put code below:

<?php
$location = $content['field_stadium'][0]['#locations'];
$stadium_map = array('id' => 'stadium_map',
             'latitude' => $location['latitude'],
             'longitude'=> $location['longitude'],
             'zoom'     => 13,
             'width'    => '100%',
             'height'   => '400px',
             'type'     => 'Satellite',
);

echo theme('gmap', array('#settings' => $stadium_map))
?>

But it show wrong map and also not 100% width. I use gmap and location module. What is the correct way?


texts: How can I save a file in specific folder?

texts:
I want to upload files to specific folders. How can I achieve this programatically. How can I modify below code such that upload_location should be dynamic.

    $form['document'] = array(
    '#type' => 'managed_file',
    '#upload_validators' => array('file_validate_extensions' => array('xml')),
    '#upload_location' => 'public://',
    '#submit' => array('custom_document_submit'),
    );


texts:
I always thought styled images are smaller than original ones in file size. So the main reason for styling was to reduce the file size. But today I noticed it isn't always the case. For example:

I downloaded an image abcd.jpg from facebook and then uploaded it to my Drupal website.

Originally the image was 405.3 kB which is 2048px X 1536px.

After downloading the same image from my drupal website the image is 698 kB which is 1100px X 845px.

Style Effect:(Scale width 1100)

And when I checked I found the same in most of the cases. Can anything be done about it without compromising image quality?


texts: Entityqueue - Get field values from the queue

texts:
First off, i'm very new to Drupal. Kindly help me and forgive if im being a noob.
Im using the module - Entityqueue https://www.drupal.org/project/entityqueue
Im created a view block for a entity queue that gets specific blog articles.
The problem im facing is that, this view only gets the blog title, and not the other custom fields within each blog.
Is there anyway to get the custom fields also ?
Thank you for your support.
EDIT: Please see below for screnshot of what i've done.
Entityqueue

View Block

If i select fields below, it doesn't get the custom field that are in the blog article.


texts: How to translate a panel page title and a pane title

texts: I want to ask if there is a way to translate the title of a panel and also its panes titles whatever content they are. I use panels to override user/%user page and there i putted  as panel title the token "Profile of %user:user-raw" and i have also other content(views,blocks,nodes) with their titles. Thanks in advance.


texts: I am using the sitemap module and have enabled 3 menus to display. However, I dont like the order the menus are being displayed in. Is there a way to change this?


texts: How do I change the uploading image file name

texts: How do I change the image name while uploading through a file uploading field? In drupal 8 whenever I add an image to a file field, it automatically uploads the image file to my S3 bucket. I need to change the image name before uploading because I need to list my image names with a specific pattern. I searched the internet but couldn't find a hook for that auto image uploading.


texts:
My client drupal site stopped working suddenly and gave me this error Fatal error: Class 'RulesI18nStringController' not found in entity.i18n.inc on line 31 i checked the rules module and entity module and nothing seems to be messing.
I searched for a solution on the internet with no luck.
I have rules 7.x-2.2 and entity 7.x-1.0-rc3 but i can't login to the site so i can't access update.php to update the rules and entity modules to the latest versions "as it may fix this problem".

So can anybody help me find solve this problem?

PS: If you need any additional information about the problem just ask about it in the comments.

Thanks in advance for you all.


texts: How to insert records in different table

texts:
function lawyer_register_form($form,&$form_submit)
{
$form = array();
$form['name'] = array(
    '#title' => 'Username',
    '#description' => 'choose a username',
    '#type' => 'textfield',
    '#required' => TRUE,
);

$form['mail'] = array(
    '#title' => 'email',
    '#description' => 'enter a valid email address',
    '#type' => 'textfield',
    '#required' => TRUE,
);

 $form['fname'] = array(
 '#title' => t('Full Name'),
 '#type' => 'textfield',
 '#size' => 20,
 '#maxlength' => 20,
);

 $form['phone_no'] = array(
 '#title' => t('phone_no'),
 '#type' => 'textfield',
 '#description' => t(''),
 '#size' => 20,
 '#maxlength' => 20,
);

$form['street_address'] = array(
'#title' => t('Street Address'),
'#type' => 'textfield',
'#size' => 50,
'#maxlength' => 100,
);

$form['county'] = array(
'#title' => t('County'),
'#type' => 'textfield',
'#autocomplete_path' => 'lawyer_register-autocomplete-engine',
'#size' => 20,
'#maxlength' => 20,
 );

$form['send_message'] = array(
    '#type' => 'checkbox',
    '#title' => t('Notify user of new account via email.'),
    '#description' => 'If left unchecked, a message will not be sent.',
    '#default_value' => 1,
 );

 $form['submit'] = array(
  '#value' => 'Submit',
 '#type' => 'submit'
 );
 return $form;
 }

 function lawyer_register_form_submit($form, &$form_submit)
 {
 $new_password = user_password();
 $edit = array(
  'name' => $form_submit['values']['name'],
  'pass' => $new_password,
  'mail' => $form_submit['values']['mail'],
  'init' => $form_submit['values']['mail'],
  'status' => 1,
  'access' => REQUEST_TIME,
  ');
   $edita=$edit->uid;
  db_insert('field_data_field_name')
  ->fields(array(
'entity_type' => 'user',
'bundle' => 'user',
'deleted' => 0,
'entity_id' => $edita,
'language' => 'und',
'delta' => 0,
'field_name_value' =>$form_submit['values']['fname'],
))->execute();
   db_insert('field_data_field_county')
->fields(array(
'entity_type' => 'user',
'bundle' => 'user',
'deleted' => 0,
'entity_id' => $edita,
'language' => 'und',
'delta' => 0,
'field_county_value' =>$form_submit['values']['county'],
))
->execute();
    db_insert('field_data_field_address')
->fields(array(
'entity_type' => 'user',
'bundle' => 'user',
'deleted' => 0,
'entity_id' => $edita,
'language' => 'und',
'delta' => 0,
'field_address_value' =>$form_submit['values']['street_address'],
))->execute();
    db_insert('field_data_field_phone_no')
->fields(array(
'entity_type' => 'user',
'bundle' => 'user',
'deleted' => 0,
'entity_id' => $edita,
'language' => 'und',
'delta' => 0,
'field_userphone_value' =>$form_submit['values']['phone_no'],
))->execute();

   user_save(drupal_anonymous_user(), $edit);

I have already created table in database. I want to insert value of

fname, street_address, phone_no & county

In those table. How is it possible?

I have searched lots of time in google but not getting right answer.


texts: How do I display the user login in a popup?

texts:
When menu item "Login" is clicked, I want to display the login form as a popup. How can I achieve this?

I have looked into the following but with little luck. (Let me know if the answer is below and I am missing it.)

modules: Overlay paths, Popup, Ajax login/register
Code: hook_admin_paths_alter()

Any help will be great. I am looking for a clean pop up option that I can theme too.


texts:
this is my first Drupal installation (I'm a symfony dev) and I've spent several hours trying to get dump() working. However it just causes a WSOD.
Maybe related: I'm unable to install kint, there's issues with it now being a sub-module of devel and I haven't been able to install it.
Settings:

Drupal version 8.9.1
memory limit set to 6,000mb
execution time set to 90 seconds
Windows
acquia dev desktop
php 7.3.15
Apache/2.4.33 (Win64) OpenSSL/1.1.0h mod_fcgid/2.3.9

If anyone has suggestions I'm keen to hear it! Drupal is quite interesting from what I've seen so far. It's been a bit frustrating as someone new to Drupal, trying to get basic things working.
== Update ==
I have corrected a config error I made while configuring the site. See here (for correct config).
Calls to dump() (in twig) for null variables work, but {{ dump(items) }} will hang and then result in a 500 error (see link above).


texts: "Rate Module" How to put the number inside the button?

texts:
http://drupal.org/project/rate

As you can see, the "yes/no" widget on the bottom of the screenshot is:

[button] [number]

The number is not part of the button.  How to make it like this instead:

[button number]

edit: a perfect example, the thumbs-up/thumbs-down rating widget on Yahoo Answers: http://answers.yahoo.com/question/index;_ylt=Ao37OQz9iO3ZJvacOl9pH8_j1KIX;_ylv=3?qid=20121104010935AAs5NQk

The number is in the button.  Clicking anywhere on that button registers a vote.


texts: Changing Global: Text Area based on an exposed filter in views?

texts:
A client wants to display different text in a page depending on the value of the View's Exposed Filter.

I could throw this logic into the template.php or use javascript (showing and hiding a span depending on the value), but this feels like a very poor way to do this when considering maintainability?

Does there exist a Views plugin to perhaps show different text blocks in the header based on the value of an exposed filter?

Currently on Drupal 7.31 using Better Exposed Filters. I'm open to using something other than Global: Text area if there is a better mechanism.


texts: How can I get public files path in javascript files?

texts: I want to display files present in the public folder(sites/default/files). So in the module file when I click on a link it will call to js function, How can I get all file names which are present in the public folder in js file.


texts: db_select with join, union and add columns with null values

texts:
I try to extend the search functionality and want to search in the node AND users table. For this I need new columns with NULL values. How can I do this?

Here is my query:

SELECT *
FROM (
  SELECT uid, name, mail, login AS date, picture, NULL AS nid, NULL AS type, NULL AS title, NULL AS status, NULL AS word, NULL AS score FROM users
  UNION (SELECT NULL, NULL, NULL, changed AS date, NULL, nid, node.type, title, status, word, score FROM search_index JOIN node ON search_index.sid = node.nid)
) AS Result
ORDER BY Result.date ASC;

Now I have another problem with this query. After solving the problem with the NULL values the columns are sort in wrong order. Is there a workaround?


texts:
Hi I'm trying to replace a Webform email with a token which works from the tpl file like this:

$company_email = token_replace('[node:field-charter-company:field-company-email]', array('node' => $node));
echo $company_email;

This works fine but when I try to do it from a module it just outputs "[node:field-charter-company:field-company-email]" instead of the contents of the token.

function webform_node_token_form_alter(&$form, $form_state, $form_id, $node) {

        if ($form_id == 'webform_client_form_126') {
            $company_email = token_replace('[node:field-charter-company:field-company-email]', array('node' => $node));
            $form['submitted']['company_email']['#value'] = $company_email;
  }
}

I know I'm doing something wrong but kind of lost. Can anyone give me a pointer?


texts: How to load into a normal page instead of the (blog-like) front page?

texts:
I have my drupal site, loading the  page when I open the site. It is the normal behaviour, but I don't want it.

I have a different HOME page that I want to see when I open my site (instead of the  page with all my articles).

I still have the  page with articles and I have a link NEWS in my menu that points to it, because I want to keep the articles page.

I tried this:

Configuration > Site information > Default front page > (I wrote "home")

But the NEWS link didn't point to the articles anymore, because it seems that now the page is my HOME page.

So, it loads the HOME page on opening, like I wanted, but now my articles page is not accessible via the NEWS link in the menu.

How can I see my HOME page as default page when entering the site "without" losing access to the page of articles?

Thanks


texts:
I'm new to Drupal, so bare with me...

I created a menu that I placed inside the Sidebar First Region.

1st question: I was able to place my menu in the Sidebar First Region by going to the blocks page "admin/structure/block". Is a menu seen as a block, since i am able to assign a region for a menu inside the BLOCKS page ? or is just the name of the page misleading, since it can take care of both blocks and menus ?

2nd question: How can i import/export a menu that has a bunch of links inside it ? i want to export it from local to staging and prod. Features doesnt seem to work? i found menu Block and menu_import to say to be able to do that, but is there another easier or better way ?

Any other suggestions and tips are more than welcomed...

Thanks


texts: Custom exposed filter with single on/off checkbox doesn't respect the default value and the $_GET parameter

texts:
I've created a custom filter with a checkbox exposed field in my module.

class my_module_helper_handler_filter_timetracking_children extends views_handler_filter {

  /*...*/

  function value_form(&$form, &$form_state) {
    $form['value'] = array(
      '#type' => 'checkbox',
      '#title' => t('Show subtasks'),
      '#default_value' => isset($this->value) ? $this->value : NULL,
    );
    return $form;
  }

  /*...*/

}

When by default in Views UI settings checkbox is disabled, everything works fine; when it's enabled, it doesn't work. It doesn't respect the default value and the $_GET parameter.

I can't understand this strange behavior of single on/off checkboxes in exposed filters in a view.

I also tried using '#attributes' => array('checked'=>'checked'), but the filter didn't work correctly.

Might somebody can show his code how to create custom exposed filter with single checkbox? Or give usefull link


texts: Indexing all pages of a website in Google

texts:
I use Google CSE on my website, which contains upwards of 5000 stories. Naturally, I would like all of this content to be indexed in Google. Many of these stories will not be linked elsewhere on the site... can they still find their way into Google's search index?

Thanks!


texts: How to add css class attributes to the anchor element inside the links of a given menu by theme function

texts:
Do I miss something or is it impossible to theme the link anchor HTML element

  for a targeted menu on the theming level (theme functions)?

We can theme the
 elements and the menu block elements with HOOK_menu_link_MENU_NAME(). Thanks to David Thomas for pointing that out to me. But I had no luck with targeting the nested anchors itself. The Devel array output and the drupal.org docs only brought me to theme_menu_item_link(), theme_links, theme_link(), and others, but I can't see an opportunity here to elegantly incept dynamic values for css classes on the anchor element?

I would like to add style class attributes to the  element in  ul > li of a given menu (not of all menus, thats what theme_links() does)...

NOTES:

nested css targeting by altering the upper element is not an option
here, since the required css class is level sensitive and should NOT
be applied to the upper html element.
And yes, I know the menu_attributes module. It's an awesome
module I use very often. But the approach is different. I don't want
to change the menu link data in the DB, but the output only.
There is an issue for the theme_links() function on drupal.org mentioning
some trouble with its scope and how it works: https://drupal.org/node/588148

  theme_links(): Returns HTML for a set of links. => theme_links($variables)
  https://drupal.org/node/588148 => theme_links() is not really
  themeable [#588148] => Drupal core, theme system, normal, needs work,
  49 comments, 1 IRC mention

Another option would be to add  elements inside the anchor elements. I already did this for node objects but I don't know if this is possible here and if this is the right way to do it.
Edit: Here are two questions - 1 - 2 - on stackexchange I read thru' atm, since there are near issues discussed. Maybe it will enlighten me soon ... (Thanks to Clive, who has pointed me to the second one.)


texts: Where to place php code snippets in Drupal?

texts:
Whereabouts are you meant to place a snippet of php code? I am guessing the root of site? Don't you need to have something point to it?

I am wanting to place this snippet I found to encode email http://shamsphp.blogspot.com.au/2012/11/how-to-encode-email-address.html


texts: Drupal 7 - How to get AJAX response displayed in a ctools modal?

texts:
I want to create a ctools modal popup when a button is pressed.

function custom_form( $form, &form_state ) {
  $form['btn'] = array(
    '#type' => 'button',
    '#value' => t('add'),
    '#executes_submit_callback' => FALSE,
    '#ajax' => array(
      'callback' => 'custom_callback',
    ),
  );
}

function custom_callback() {
  ctools_include('ajax');
  ctools_include('modal');

  ctools_modal_render( 'Error', 'Error Message');
}

I only get the alert message with the un-rendered ajax response. How can get I this response displayed in rendered format in modal?


texts: Setting entity reference field value in Drupal 8 programatically

texts:
I have this following code that creates a node in the page.

$data = array(
  'type' => 'post',
  'field_post' => [
      'value' => 'test',
      'format' => 'basic_html',
    ],
  'field_visibility' => 1,
  'user_id' => $uid
);
$node = Drupal::entityManager()
  ->getStorage('post')
  ->create($data);
$node->save();

I have another field field_pattern that is an entity reference for another content type. How can I properly set it inside my code?

Since with creating the content from the site when dealing with Entity reference field selects autocomplete to Title, then I tried to test this but fails. Meaning no value is set to entity reference.

$title = $entity->label();
$data = array(
  'type' => 'post',
  'field_post' => [
      'value' => 'test',
      'format' => 'basic_html',
    ],
  'field_pattern' => $title, // this is the entity reference field
  'field_visibility' => 1,
  'user_id' => $uid
);
$node = Drupal::entityManager()
  ->getStorage('post')
  ->create($data);
$node->save();


texts: How to include a form in a listing page?

texts:
I am displaying a content information page. At the end of the content displaying page i need to display a form.

How shall i do it?

What have I done?

Written a menu callback in hook_menu()
Written a method to collect the information
Registered a theme in hook_theme()
Written hook_preprocess_theme() to register variables
Created a template and assign the variables

By doing all the above, I am displaying the Content Information.

What do I need to do, to display a form at the end of the content?

I have done these thing.

Created a form in a function called content_form() (including logic)
Wrote a submission function (content_form_submit()).

My only todo left is displaying the form at the content information page.


texts: No option to validate for email in drupal webforms validation

texts:
I've installed both the Clientside Validation module, and Webform Validation, but there is no option to validate for "valid email" in the "Form Validation" tab of the webforms edit panel. Clientside Validation claims to validate for email - what's going on?

How should I go about adding email validation?


texts: I accidentally deleted basic_cart_vat, there's a way to a restore this field?

texts:
I accidentally deleted the field basic_cart_vat from Orders, now I'm receiving an error because I don't have the field.

  InvalidArgumentException: Field basic_cart_vat is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 586 of /home/sgpam/www/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php).

How can I fix this?


texts: Automate clear of mysql database in drush site install

texts:
Is is possible to automate clearing the database when I run site install?
e.g. here is my drush command:

drush si geoslate --db-url='mysql://root:root@localhost/geo_test' --site-name=Geoslate

But the db has to be cleared first. Can I automate this process?


texts: "&" displaying as "&" in Views exposed filter

texts:
So I'm not sure where this happening, but would love to understand & fix it.

The same data is being displayed elsewhere on the website without the above issue, only in this exposed filter (& the content editor form) does it seem to happen.

In the configure filter window the ampersands appear as expected:

The filter is referring to a node reference field:

If I go to edit one of these content types, the ampersands DO NOT appear correctly either (in select list / drop-down box), only in the configure filter window do they appear correctly.

I checked the database & it's saved in "&" form, so somewhere Drupal is converting it...

I could write a javascript snippet to fix it, but I'd like to understand & fix it the "Drupal way"


texts: How do I hide render elements if a checkbox that controls a form #state is checked?

texts:
I have a form where a user can either choose a gallery field to populate or a video field to populate but they have to choose one of the other -- there can't be a video and gallery on a page.

The logical way to do this is make three seperate content types, an article, a video and a gallery. However, since they all function about the same and an article could be about a video or a slideshow. Nevertheless, there isn't a case where a slideshow and video should be together. If they user wants video and images they can embed images through wysiwyg.

Using the #state mechanism, I have a select radios field that has the option of none, video, or image / gallery. This is set to hidden in the content display interface. If they choose image then the file field widget shows and if they choose video then the youtube field shows (once again I could use Media but that is huge and overkill for this application.)

The interface is quite sweet.

.

However, there is a problem because here a slideshow gallery has been created before the user decided to use a youtube video embedded.

What is the best practice for hiding the image gallery if the Youtube setting has been choosen? Do I make the media setting visible and then hide it and the image gallery? This doesn't make good sense because it is processed and therefore ineffient doing extra work. I don't want to force the form field to be deleted because then the work is lost. It just shouldn't be processed rather than have work deleted in the case the user would like to revert from one to the other. Any ideas?

EDIT:

I tried this code which works but I don't know if it's the best practice.

function helper_preprocess_node (&$variables) {
  switch ($variables['type']){
    case 'article':
      if (isset($variables['field_article_media'][0]['value'])){
        if ($variables['field_article_media'][0]['value'] == 'gallery'){
          unset($variables['content']['field_youtube']);
        }
        if ($variables['field_article_media'][0]['value'] == 'video'){
          unset($variables['content']['field_image']);
        }
        unset($variables['content']['field_article_media']);
      }
      break;

    default:
      break;

  }
}


texts: Some of node links of content types are corrupted

texts:
There are about 5000 nodes in my website of different content types. After a while (updating the Drupal to 7.34 and configuring the Server by server administrator) some of node links are corrupted and they are redirected to the front page. They are not too many but I don't know why some links that were working, are not working now. As an example the link /node/286 is redirected to the front page.

Is there any problem with the update that causes such thing?

The host server was victim of an attack and a few guest websites on it were hacked. So I guess (not sure!) the administrator may blocked some PHP functions, could this be the reason for such misbehavior of the links ? If it is right then why only a few of them are broken?


texts: Change image style during hook_node_view()

texts:
I'd like to programmatically change an image style during hook_node_view(), and I thought this would be relatively straightforward like so:

/**
 * Implements hook_node_view()
 */
function example_node_view($node, $view_mode, $langcode) {

  if (example_ok()) {
    $node->content['field_image'][0]['#image_style'] = 'new_image_style';
  }

}

Unfortunately this does not work. I'm aware of the picture and breakpoints modules, and am in fact using them, however there are sometimes when a dynamic decision needs to be made that these modules don't cover.


texts: How to show html  marks to Views Custom text - field?

texts:
I need to put < input    > - html tag to my Views Custom text field, but it wont show up? Somehow these codes will be disabled? What I need to do?

I tried to find solutions from web, but I didnt find anything for this. But I really need to put these html to Views custom text - field.

Text format settings is fine, but no help.

This works when I put < input > tag to Views "Header" and "Footer" section with "Custom text" field, but  why not in section "fields"?

I hope there is a simple solution for this. Thanks.


texts: How to display search query in view's results page?

texts:
I'm using views 3 with drupal 7.

I have a views page listing content of a certain content type 'Clothes'. I have a exposed form(in a block) that filters this list by size(small,medium,large) and color(red,blue).

When I click submit, is it possible to show in the header of my results page like the following?

  Showing results for Small size and Red color:


texts:
I am working on a website for a youth organization. They desire to sell sponsorship for organization on site, and we are using Drupal 8.

We are able to create a product and a product variation. We can't find out how to create a field that will accept an end-user submitted image when added to the cart.

How can we achieve this?


texts: Change notification to different languages

texts: I have a multilingual website which has English and Chinese as the languages. I use the admin account but i have made a translator account for my chinese colleagues to make translations. Now if i make any changes to the pages in English how can they automatically get notified that they need to update the translation for that specific page. Is there any automatic way to do this ?


texts: Check empty field value in view result counter

texts:
I am using view result counter to combine and display multiple fields.
I want to check the empty condition for field.
How to check this in rewrite result option in view result counter field.

FYI,I am combining city ,state,country fields in view result counter.

Please help me if anyone knows the answer


texts: How to map Address field module sub fields (City, State, etc.) to specific (individual) fields in Salesforce?

texts:
Address module: https://www.drupal.org/project/address
Usually Salesforce mapping doesn't allow to add Address module subfields in the mapping.


texts: Video.module: Rendering playablefiles programmatically

texts:
I am trying to pull the "playablefiles" URIs from the array for a video field (hereafter: field_video).

Here's a look at how the array is set up.

I'm trying to pull a list of the files by this method, which seems to be in error:

  foreach($node->field_video['und']['0']['playablefiles']) {
    echo $node->field_video['und']['0']['playablefiles']['uri'];
  }

Can anyone tell me what I'm doing wrong here?


texts: hook_menu not producing expected tab structure, problem?

texts:
I'm trying to create a tabbed menu system with hook_menu() following the hook documentation and Clive's answer. I am using the following code.

/**
 * Implements hook_menu().
 */
function newforms_menu() {
  $items = array();
  $items['admin/config/content/newforms'] = array(
    'title' => 'NewForms',
    'description' => 'Configure web forms via drag and drop.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('newforms_administration_settings'),
    'access arguments' => array('administer newforms module'),
    'file' => 'newforms.admin.inc',
  );

  $items['admin/config/content/newforms/list'] = array(
    'title' => 'Forms',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );

  $items['admin/config/content/newforms/components'] = array(
    'title' => 'Components',
    'type' => MENU_LOCAL_TASK,
    'page arguments' => array('newforms_components_list'),
  );

  return $items;
}

I would expect this to produce two tabs, labeled 'Forms' and 'Components', but it does not. I see no tabs.  On admin/config/content/newforms/list, I get the same page as admin/config/content/newforms; on admin/config/content/newforms/components, I get "You are not authorized to access this page."

I've cleared cache and ran cron, disabled the module, uninstalled it, reinstalled it, cleared cache, and ran cron; I get the same results.
Both callback argument form functions are defined in newforms.admin.inc.

Do you have any idea as to what is going on here?


texts: Content type - manage display based on roles?

texts: Is there a way to define a custom display setting under Manage Display on a content type? I want to hide certain fields (when viewing, not editing) from non-authenticated users. I know I can do this with a custom .tpl file; just wondering if there's another way (without additional modules.)