texts: Unable to Retrieve Custom Taxonomy Fields Using PHP

texts:
I have added a custom image field to a Drupal 7 taxonomy called "field_uc_catalog_image2".

I am now attempting to get the path of that field using PHP with this code:

$normal_path= drupal_get_normal_path($_GET['q']);
$tid = array_pop(explode('/', $normal_path ));
if ( is_numeric( $tid ) ) {
  $term = taxonomy_term_load($tid);
  print $term->field_uc_catalog_image2['und'][0]['uri'] . '
';
}

However, I am getting the following error:

  Notice: Undefined index: und in eval() (line 6 of C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\le\modules\php\php.module(80) : eval()'d code).

Whereas, this similar expression for the standard image works fine:

print $term->uc_catalog_image['und'][0]['uri'] . '
';

Do you have any suggestion?


texts: How can I pass page variable to a form builder function in a custom module?

texts:
I have an entity page where the entity has an email field. On that page, there is a form built in a custom module. What I'd like to to is that on form submit, the module sends an email to the address that is the value in the entity field.

So somehow I need to pass that email address to the form submit function.

What is the best way of doing this?


texts: How should i get corresponding field value for taxonomy filed attached?

texts:
I use drupal 7. I created a content type with these fields:

one field to upload a file to private folder
a taxonomy field (for that file)

my problem: i can save one file with one taxonomy! but how should i get these data again!(is there any API here) I want to know which taxonomy was saved for a certain file(i need to check it inside my custom module).  i raised similar question here: so by following code i can get corresponding field:

$nids = db_query("SELECT nid FROM node WHERE title LIKE :title", array(':title' => '%'.$title.'%'))->fetchCol();

$nodes = node_load_multiple($nids);

foreach($nodes as $node) {

// using field_get_items here automatically loads the field in the correct language
$field_items = field_get_items('node', $node, 'field_subtitle');
$subtitle = $field_items[0]['safe_value'];
}

but it seems it dose not work taxonomy attached field.

why do i have this question: i sell some digital files and now i am developing a module for selling my files. i want to sell them this way: each file has a certain taxonomy. when my user buys that file he or she gets that taxonomy(and i will keep it in one table). once he clicks on download link i have to check whether that user has that taxonomy already or not! if he has i will let him to download it.


texts: Submit AJAX form and update database then show all database results

texts:
Is what i am trying to do is on this page it will display all items from the database that currently exist. Then at the top of this list will be a small form that will allow someone to add an item to the list. After someone submits the data and posts the form I want the list below to automatically populate with the updated data. I am having a really hard time trying to figure this out.

function clay_mod_blacklist_form($form, &$form_state) {
drupal_add_css(drupal_get_path('module', 'clay_mod') . '/css/clay_mod.min.css');
drupal_add_js(drupal_get_path('module', 'clay_mod') . '/js/jquery.maskedinput.js');
drupal_add_js(drupal_get_path('module', 'clay_mod') . '/js/clay_mod.js');

$form['company'] = array(
    '#type' => 'textfield',
    '#title' => t('Company Name'),
    '#required' => TRUE
);
$form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Contact Name'),
    '#required' => TRUE
);
$form['phone'] = array(
    '#type' => 'textfield',
    '#title' => t('Phone'),
    '#required' => TRUE
);
$form['email'] = array(
    '#type' => 'textfield',
    '#title' => t('Email'),
    '#required' => TRUE
);
$form['submit_button'] = array(
    '#type' => 'button',
    '#submit' => array('clay_mod_blacklist_form_submit'),
    '#ajax' => array(
        'callback' => 'clay_mod_blacklist_form_ajax',
        'wrapper' => 'box',
        'method' => 'after'
    ),
    '#value' => t('Add To Blacklist'),
    '#id' => 'ajax-save-form-values'
);

$form['results'] = array(
    '#type' => 'container',
    '#prefix' => '
',
    '#suffix' => '
'
);

if(isset($form_state['values'])) {
    $form['results'][] = $form_state['values']['results'];
}
// This is where I was display info from database before the form was submitted
//    if(!empty($form_state['values']['results'])) {
//        $form['results'] = $form_state['values']['results'];
//    } else {
//        $rows = db_select('blacklist', 't')
//            ->fields('t')
//            ->execute()
//            ->fetchAll();
//        foreach($rows as $k => $v) {
//            $form['results'][$k]['#markup'] = "
x{$v->name}y
";
//        }
//    }

return $form;
}
function clay_mod_blacklist_form_ajax($form, $form_state) {
    return $form['results'];
}
function clay_mod_blacklist_form_submit($form, $form_state) {
   ddl('ajax submit');
   $form_state['rebuild'] = TRUE;
   clay_mod_blacklist_form_save($form, $form_state);

}
function  clay_mod_blacklist_form_save(&$form, &$form_state) {
$companyName = $form_state['values']['company'];
$name = $form_state['values']['name'];
$phone = $form_state['values']['phone'];
$email = $form_state['values']['email'];
$query = db_insert('blacklist')
    ->fields(array(
        'company_name' => $companyName,
        'name' => $name,
        'phone' => $phone,
        'email' => $email,
    ))->execute();
}


texts: Maintaining order history when creating orders as admin

texts:
I have learned that much of the sales tracking and order history is dependent on the sales being made through the use of commerce checkout. For my project, however, I was utilizing the Commerce Kickstarter distribution to create a system to manage business sales whereby the admin would create customer profiles and, subsequently, be able to select from existing customer profiles when an order is created.

That is to say, the admin is the only necessary user.

I soon found, however, that order histories for each Customer Profile remained unchanged after orders. To get around this, I created a rule to create a User Profile to match every Customer Profile whenever the latter is created. In order to associate ownership of the Customer Profile by the New User, I wrote an additional script and triggered it as part of the rule.

Although the Customer Profiles are now owner by their respective Users, the Order History remains unchanged for each user - new orders do not create any history. This is because the user associated with the orders is whichever user is logged in, rather than the user associated with the Customer Profile being chosen for the order. I would like to rectify this as it would allow me to enjoy the full benefits of Commerce Reporting.

My first intuition is to use function hook_commerce_order_presave -> but I have found no examples of this, and am unsure as to the specific structure of $order. Can anyone shed some light on this?


texts: Is it a great idea to upload php instead of writing phps in drupal interface

texts:
At each time I write PHP code in blocks and views, I always think about this question : "What are the downsides of using 'custom' PHP code in blocks, nodes, views-args, etc?".

Is it a great idea to make users able to send php files instead of writting it. It would be a first step to manage the code after with name conventions to find the code easily and to be also able to read easily the code?

Or it's just a stupid idea that will generate a security mess ??


texts: I'm getting 'page not found' when trying to access my custom module

texts:
I am working from a pre-existing Drupal 7 install.  I downloaded the source files and downloaded a dump of the DB. When I first installed Drupal worked fine.  I built a custom module, it was working just the way it needed to, a link to the page appeared in the navigation, and I was able to navigate directly to the page by typing in the url.  Yesterday, I had to download a new dump of the DB, drop the tables from the DB I had in place and import the new download.  After doing that, my module still shows in the available modules to enable, but it isn't in the navigation and when I try to type the pages url, it say's "The requested page "/TLSConnect3App/floor_map_page" could not be found." I've tried disabling/enabling it  clearing caches, I've even tried replacing my hook_menu with an example, but nothing seems to work.

Here is my hook_menu :

function floor_map_menu() {
    $items = array();

    $items['floor_map_page'] = array(
        'title'     => t('Floor Map'),
        'page callback' => 'floor_map_page',
        'access callback'   => TRUE,
        'type'          => MENU_NORMAL_ITEM,
    );

    $items['floor_map_page/floor_map'] = array(
        'title'             => t('Floor Map'),
        'page callback' => 'floor_map_page',
        'access callback'   => TRUE,
        'type'          => MENU_DEFAULT_LOCAL_TASK,
    );
    $items['floor_map_page/setup_floor_map'] = array(
        'title'             => t('Floor Map Setup'),
        'page callback' => 'drupal_get_form',
        'access callback'   => TRUE,
        'page arguments'    => array('new_floor_map_form'),
        'type'          => MENU_LOCAL_TASK,
    );
    $items['floor_map_page/select_floor_map'] = array(
        'title'             => t('Floor Map Select'),
        'page callback' => 'drupal_get_form',
        'page arguments'    => array('select_floor_map_form'),
        'access callback'   => TRUE,
        'type'          => MENU_LOCAL_TASK,
    );
    return $items;
}

And here is an example I tried replacing it with:

function quick_menu() {

  $items = array();
  $items['quick/hello'] = array( // change to the url you want
    'title' => 'Quick Hello',
    'type' => MENU_CALLBACK,
    'page callback' => 'quick_hello',
    'access arguments' => array('access content'),
  );

  return $items;
}

function quick_hello() {

  $content='Hello. Thank you for surfing over to ' . $_GET['q'];
  return $content;
}

Either way, I get the same message, "Page not found"....
I'm assuming the page callbacks are in a database table and I wiped that out with the import, but reinstalling the module/clearing caches should fix this, right?

I did find a script here: https://drupal.org/node/559364
but it is for Drupal 6..

Have also tried using menu_rebuild() and clearing all caches several times now.

So, I just went through and changed everything in my module that say's floor_map to floormap and it's working now..not the best way to fix the issue, but I can actually see my pages now, so I'll take it.


texts: How do I check if a module is being used by another?

texts:
I'm using a multi-site setup with Drupal 7.14 core, and I want to disable some modules within my sites/all/modules shared folder. One of them in particular is the File_Entity module.

Is there a way (drush, programmatically, bash script, etc) to check if another module (e.g. Views, custom CCK) is using it? drush pml | grep File Entity only let me see what is enabled or disabled, not if it is currently in use, or safe to remove.


texts: Give users a stripped down version of add node page and then require admin approval

texts:
I want to give my users stripped down versions of the 'add node' pages to create nodes of various content types. Once they fill out the stripped down version (less fields and options) an admin/editor can then approve each node manually and fill in fields not in the stripped form. What method or modules can I use to achieve this?

For example, a user would fill in the title, body, tags and the admin would fill in custom fields such as the imagefield, filefield etc.


texts: URL & Geomap Lat/Lon fields are not showing in Target List during mapping in Feed?

texts:
I am using the Feeds module. All the fields from node are showing in target list except URL field Type and Geomap Latitude and Longitude Fields. I can't figure out how to map values from CSV to them.

Any suggestions?


texts: convert node/id to node/path-alias in content body

texts:
I added a link to a content body from ck editor as /node/7. When viewing this page I want to show www.sitename.com/example/alias.

This is working fine in drupal 7 (earlier version of my site), but not sure which module does this work.

I have installed pathauto, redirect, pathologic modules. I also configured the text format at admin/config/content/formats and set pathologic filter as first priority. But no luck.

After installed redirect module, if I hit node/7 in browser it automatically redirect to expected alias. But I want is the content page should show only url alias even If entered /node/7 in ckeditor.

Am I missing any configurations in any of the above module? or am I missing any module?


texts: How do you create a custom permission to administer a custom module?

texts:
I just finished the Hello World module tutorial for Drupal 8. The tutorial takes you through the process of creating an administration page to configure the module so that you can change via settings to whom the page says hello.

By default, the config page only requires the 'access content' user permission to view. I realize I can change the value to require any other already defined permission if I want, but how can I define a new permission specifically to administer just this module and nothing else? I found this similar question by searching, but it's for Drupal 7 instead of 8, and the solution leaves a lot to be desired; I would like my module to be self-contained, and requiring that the user download a non-core third-party module is not something I am prepared to do.


texts: Drupal Commerce: Alter 'Checkout' link in user menu

texts:
How do you hook into the 'checkout' link in the user menu?

If there is an item in the basket, want to be able to add a class to the 'checkout' link.

Ideally from the theme template and not hacking the core.


texts:
I am working on a D8 instance and i would like to have 2 dates which are in different fields to be displayed at once when the month is the same i.e. :
21-22 december instead of 21 december 22 december.

What is the best way to do that ?


texts: Drupal Gardens Template builder: Can I have this feature on my site

texts:
When you build a new site on Drupal gardens, you can select what features and blocks/regions you want on your new site.

Is there a module, which would let me choose my own set of features each time I create a new site on my own hosting (i.e. separate from Drupal gardens).


texts: Is it possible to select all results in Views bulk actions form?

texts: By all results I mean even those that are not displayed on the current page(if there is paging).


texts:
Migrated a drupal database from a preview site to a live site and am now getting an error.

(I only moved the database)

The selected file /tmp/filethQvCf could not be uploaded, because the destination css/css_4b1c49411f8ee294df61cf73ebc413c6.css is not properly configured.

I should note that /sites/default/files/ctools/css is chmod 777


texts:
When I click a Term (such as "Garden Accesories"), I get some kind of a blog list with all the content associated with the term. I fear it might cause content duplication (it copies whole texts from different parts of the site). Is this fear rational?, and if it is, is there any way to control it (without Views)?

Thx.


texts: What are the correct steps to run a site as HTTPS?

texts:
There is some information on https://www.drupal.org/https-information about installing the Secure Pages module to force SSL. This gives me a redirect loop on the login pages.

When I try without the Secure Login module I get mixed mode errors due to JS being served in plain http. Is a module really the only method to enable SSL on D8?

Assuming the server configuration is set-up for HTTPS and has the relevant SSL certifications and settings:
Specifically, with the Drupal configuration, what is the correct way to make a Drupal 8 site Https only?


texts: Why am I getting redirect to node?destination=node when trying to login?

texts:
I just moved my site to another server, and when  I try to login drupal redirects to a blank page. I have no idea
what can I do?
Please, help me. thanks for your support.


texts:
I enabled Twig debug and I tried to debug some custom fields. However, if I try this with debug() or kint(), my application always crashes. My PHP memory size is currently 512MB; I assume that should be enough.

I realise that node is a bit too much to debug, so I tried debugging a field as in node.field_video, but that didn't work out as well.

How do I check the content of variables passed to a template file?


texts: How to manage contrib modules composer dependencies on drupal 8

texts:
Let's say I have a module exposing a composer.json file, composer manager let me merge it with others modules composer.json.

In Drupal 8 composer.json are used from the core, so is it possible to avoid dependencies duplication with contrib modules ? Is composer-manager still used for that ?


texts: "attempt to write a readonly database" with BrowserTestBase Functional tests

texts:
I have a functional test that is currently empty. I run it with the following command;
php core/scripts/run-tests.sh --sqlite /db/drupal.sqlite --php /usr/local/bin/php --verbose --directory modules/custom/

I have tried with and without the --sqlite command, as well as trying a non-existant file like tmpfs/drupal.sqlite, but I always get the same error:

Drupal\Tests\answers\Functional\AnswersTest::testAddContentPage
Exception: Drupal\Core\Database\DatabaseExceptionWrapper:
SQLSTATE[HY000]: General error: 8 attempt to write a readonly
database:

From that error I have gathered that the issue is that the user doesn't have write-access to the database, but without knowing where the database file is I'm not sure how to check this. I tried settings the permissions on /db/drupal.sqlite to 777 but this didn't help either.


texts: Write the value of a field as a css class to another field

texts:
Could someone point me in the right direction to write the value of a field A to the css classes array of field B?

In my case I'm using a field collection (with text and file/image field, to make a sort of paragraph) and want to make a select field (with 4 preset options) so the node creator can choose if they want the file/image field displayed top, left, or right.

I don't really want to mess around with dynamic views or special formatters, just write the value of my select list to the class of the file/image field wrapper.


texts: How used function drupal_render_children in file twig?

texts: I want use function drupal_render_children in file *.html.twig Drupal 8. What solution for do ?


texts: How call a block named Poll Recent from template?

texts:
I need to call the block Poll-recent from template.  I have tried this code and not work for me.  I am working in Drupal 7.

<?php
$block = module_invoke('block', 'block_view','poll-recent');
print $block['content']; ?>

or

<?php
$block = module_invoke('poll', 'block_view','recent');
print $block['content']; ?>

What is my error?

Thanks for your help.


texts: Is there an right way to override format_date?

texts:
When attempting to answer this question, I started out by looking for a way to override the core function format_date().

I came up with nothing.

Searching this highly esteemed site yielded no results.  Google managed to find some more or less (mostly more) nasty suggestions for how to hack the core and get away with it (including this sandbox).

But I didn't find anything useful.

A typical use case is to replace the strings days with something beyond the scope of the PHP date() format characters.  For instance, all calls to format_date() outputting the names of days should return the string: "laundry day" instead of "saturday".

So the question is simply: Does a right way for overriding the core function format_date exists?

I'll accept "no", provided the answer also explain why no right way of doing this exists.


texts: Catch the selection of the values in select/drop-down-box prior to the node submission

texts:
I have a Drupal 7 custom module with a couple of select/drop-down-boxes.  Is there a hook to catch the selection of the values in those boxes prior to the submission of the content node?  I am looking for a hook before the hook_node_submit occurs.

Thanks,
Derek


texts: Variable_get question default value in form

texts:
So I am reading Drupal Development Pro 7 and have stumbled upon something I am a little bit unsure about to do with the variable_get function & form element. I understand it retrieves a stored value from the database and the second parameter is a default value if it cannot find anything in the database matching that form element.

My question is what does the second parameter do in this example below.

foreach($types as $node_type){
    $options[$node_type->type] = $node_type->name; //access the $node_type object and store specific properties from the node_type object in $options array
}

//Checkboxes on Form
$form['annotate_node_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Users may annotate these content types'),
    '#options' => $options,
    '#default_value' => variable_get('annotate_node_types', array('page')), //when using the system_settings_form, the name of the form element must match the key of the variable_get ie $form[] = variable_get('$form[]', '') Always form_element name
    '#description' => t('A text field will be available on these content types to make user-specific notes.'),
);


texts: Does Entity Translation hijack i18n's operations?

texts:
I'd ideally like to use i18n to handle backend translation but use entity translation to maintain multiple language versions for each content node.

Does this require a lot of extra work or lead to caveats? I'm hoping they just handle different sides of the translation puzzle.


texts: How can I trim the display of text and expand with "more" link?

texts:
On my user profile page I have a "about me" text field that can get pretty long.
I would like to only show about 200 characters of text with a "more" link.
When you click more it would show the rest of the text, ideally on the same page.


texts:
I am trying to make a node inherit the url of where it is clicked form.

eg : .com/blue-work/node-1

not .com/node-1

This is so when a link is clicked from a certain destination the node inherits its parents block settings. Is this possible with Drupal?


texts: What is the scope of the drupal session cookie?

texts:
I am bootstrapping drupal 7 (using DRUPAL_BOOTSTRAP_FULL) so that I can use drupal's authentication/security features in the rapid development of a web app I'm doing a proof of concept for. (And yes I know it is better to use drush to bootstrap drupal.)

If the PHP file that I am bootstrapping drupal from is in the root drupal directory, then the bootstrapping works -- I know this because inspecting the $user global variable will show that I am logged in.

If the PHP file is not in the root drupal directory (whether a subdirectory of the root drupal directory or a sibling of the root drupal directory), then the bootstrapping works -- I can inspect the $user global variable, but the $user variable says I am an anonymous user rather than the logged in user that I am.

Is my suspicion right that this is related to the scope of the drupal session cookie? If so, what is that scope?


texts: Send data from a Drupal site to a web service

texts:
Is there an existing module that sends data from any form from my Drupal site to a web service?

UPDATING my PROGRESS:

Ok, I decided to continue my project using cURL. I created my form that contains 2 fields: "Name" and "Phone" and a submit button. (All in my own module)

Then I show my code that I just did. However, when I see the web service. The shipping data, not shown. I did a debug and uh I realized that when running: "curl_exec ($ch)" returns me FALSE.

function mymodule_form_submit($form, &$form_state){
    $name = $form_state['values']['name'];
    $phone = $form_state['values']['phone'];

    $att = array(
        'name' => $name,
        'phone' => $phone
    );

    $attendee = http_build_query($att, '', '&');

    $url = 'http://[IP]/event/management/attendee';

    $headers = array('Content-Type: application/x-www-form-urlencoded');

    $userpasswd = 'user:pass';

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_USERPWD, $userpasswd);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $attendee);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
    curl_setopt($ch, CURLOPT_FAILONERROR, FALSE);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    $result = curl_exec($ch);
    curl_close($ch);
}

The params,in the web service, are: attendee['name'], attendee['phone'].
What is my error?

UPDATE 2: NOW with this code, the variable $result return me a bool(TRUE). That tell me that the data was pass to the webservice. But, when I see the web service, I see no records with the data that I supposedly sent.


texts: How can I escape the brackets so they are seen as literal characters

texts: I am using clientside validation along with the field UI module in a Drupal 7 site to request some custom input fields on user registration. I need to set some custom error messages using the clientside validation modulename_clientside_validation_rule_alter() function. The problem is, the field UI module creates fields with brackets in the name attribute like so: field_first_name[und][0][value]. When I use this as the first argument of _clientside_validation_set_required(), the proper error message is not being shown. I believe this is because the brackets are not seen as part of the string. How can I make the brackets literally brackets and not look like an array to drupal?


texts: Programmatically build module permission list

texts:
I'm defining a few new roles in the install hook of my module and one of them is an "admin light" role, which will need some, but not all of the admin account permissions.

I need to pragmatically build a list of available permissions from a pre-defined list of modules (User, Node, Toolbar, etc) and assign them to the role. Without having to hard code all of the permission strings.

In Drupal 7 I could do something like:

$modules = array( 'user', 'node', 'toolbar' );
foreach( $modules as $module) {
 $permission_hook = $module . '_permisson';
 if( module_exists( $module ) && function_exists( $permission_hook ) ) {
  user_role_grant_permissions( $rid, array_keys( $permission_hook() ) );
 }
}

I'm struggling to find an solution as neat for Drupal 8 seeing as hook_permssion has been removed in favor of $module.permission.yml. Is there something I'm missing?

EDIT: Final Solution:
This is the final implementation, just in case anyone else need to do this:

  // Define our new roles
  $roles = array(
    array(
      'id' => 'mymodule_client',
      'label' => 'Client',
      'mymodule_permissions' => array(
        'view project status reports',
      ),
    ),
    array(
      'id' => 'mymodule_agent',
      'label' => 'Agent',
      'mymodule_permissions' => array(
        'view projects',
        'view project status reports',
      ),
    ),
    array(
      'id' => 'mymodule_agent_manager',
      'label' => 'Agent Manager',
      'mymodule_permissions' => array(
        'view projects',
        'administer projects',
        'view project status reports',
      ),
    ),
    array(
      'id' => 'mymodule_employee',
      'label' => 'Employee',
      'mymodule_permissions' => array(
        'view projects',
        'administer projects',
        'view project status reports',
        'view project financial reports',
      ),
      // Assign all permissions for the listed modules to this role
      'provider_permissions' => array(
        'user', 'node', 'toolbar'
      ),
    ),
  );

  // At the default level all roles should have the same permissions as authenticated users
  $permissions = Role::load( Role::AUTHENTICATED_ID )->getPermissions();
  // Get permissions for all modules and add them to an array keyed by the module
  $provider_permissions = array();
  foreach( \Drupal::service('user.permissions')->getPermissions() as $key => $permission ) {
    $provider_permissions[ $permission['provider'] ][] = $key;
  }
  // Lets loop our new permissions and create them
  foreach( $roles as $role_values ) {
    // Merge our modules bespoke permissions with the authenticated role permissions
    $permissions = array_merge( $permissions, $role_values['mymodule_permissions'] );
    // Remove our module permissions before we create the role
    unset( $role_values['mymodule_permissions'] );
    // If the role needs access to other module permissions merge them in
    if( isset( $role_values['provider_permissions'] ) && is_array( $role_values['provider_permissions'] ) ) {
      foreach( $role_values['provider_permissions'] as $module ) {
        if( array_key_exists( $module, $provider_permissions ) ) {
          $permissions = array_merge( $permissions, $provider_permissions[ $module ] );
        }
      }
      // Remove the module_permissions before we build the role
      unset( $role_values['provider_permissions'] );
    }
    // Create the role
    $role = Role::create( $role_values );
    // Assign all the required permissions
    foreach( $permissions as $permission ) {
      $role->grantPermission( $permission );
    }
    // Save the role
    $role->save();
  }

This code uses the authenticated role as a base, then adds our module permissions (defined per role), and then adds any other modules permissions to roles that require them.


texts: Send notification e-mail after new content was added

texts:
Some people refuse to learn about RSS and wish they could give me (e.g., via some form) e-mail (without registration) and they would be automatically notified about new content.

Could you help me how to achieve this functionality in Drupal 7? I heard about three modules that could help : Rules, Subscriptions and Notify. Only the first works under Drupal 7. Could you configure this functionality with some suitable module?


texts: How do you render a table within a custom module in drupal?

texts:
I have a page on my Drupal module that is responsible for the input of goals to be completed by an admin. What I would like to happen is have all of the goals within the database table render below the input form. However the only thing that gets outputted is the description tag. Using the DBA module I can plainly see a populated achievements table so I assume that the code to call and render the table must be wrong. Does anyone see where I went wrong?

I have the following code...

function achievementList_form($form, &$form_state) {
$form['generateList'] = array(
    '#type' => 'item',
    '#description' => 'This is the achievements table',
    '#value' => achievementList_generate_table(),

);

return $form;
}

and

function achievementList_generate_table() {
$query = db_query('SELECT * FROM {achievements}');

$table = array(
    '#theme' => 'table',
    '#header' => array('NID', 'Name', 'Description', 'Points'),
    '#rows' => array(),
);
foreach($query as $row) {
    $table['#rows'][] = array($row->achvmntID, $row->achvmntName, $row->achvmntDesc, $row->achvmntPts);
}

return $table;
}


texts: Use node title as page title in views full node page display

texts:
I'm using views to link a menu-item to the last node added of a certain content-type.

To accomplish this, I've set up a view to display a 1 full node sorted by post date.

this all works just fine, but now I want to use the node title as page title () instead of the view page title. I also don't want the node title to link to the node again.

Does anyone know how I can do this?

Thx in advance.


texts: How to reorder vertical tabs by weight in Drupal 7?

texts: I have some vertical tabs I am trying to reorder and the dpm()'d weights are not matching the visual output. Can someone explain this or point me to the right documentation on how weights and vertical tabs work?


texts: Line breaks with theme settings textarea

texts:
I'm using the following to get a form field in the theme settings page

function theme_form_system_theme_settings_alter(&$form, $form_state) {
   $form['foo_example'] = array(
   '#type'          => 'textarea',
   '#title'         => t('Widget'),
   '#default_value' => theme_get_setting('foo_example'),
   '#description'   => t("Place this text in the widget spot on your site."),
 );
}

The problem is when I output the result in my theme file with this:

$foo_example = theme_get_setting('foo_example');
print render($foo_example);

It doesn't respect the line break and puts it all in one p tag. I'd like it to respect the line break and put each line in a p tag if possible.


texts: Drupal 7 - eRecruiter profile with Solr Fatal Errors

texts:
I just installed Drupal 7 using the eRecruiter profile release but I am gettig loads of errors. I know it's not me server as I run 10 other drupal site on my server and there is nothing showing up in the drupal logs.

These are the errors:

This one when I click in Job Search:
Fatal error: Call to a member function pre_execute() on a non-object in /var/www/vhosts/xxx/public_html/profiles/recruiter/modules/views/plugins/views_plugin_display.inc on line 2432

This one when I click on Resume Search:

Fatal error: Call to a member function pre_execute() on a non-object in /var/www/vhosts/xxx/public_html/profiles/recruiter/modules/views/plugins/views_plugin_display.inc on line 2432

And this when I click on My Resume:
Fatal error: Call to undefined function entity_i18n_string() in /var/www/vhosts/xxx/public_html/profiles/recruiter/modules/field_collection/field_collection.module on line 913

I used the exact drupal and module releases that were included with the profile from here:
http://epiqo.com/recruiter

I got the errors... did some searching on line and one person recomended updating Drupal and ALL the mondules. I did all the updates but the errors are still present.

I have installed Apache Solr and it's working fine and drupal says that it has found it.

I then tried to install it localy on my mac and I'm getting the same errors.

My php_error.log reported the following:

[01-May-2012 17:50:28] PHP Fatal error:  Access level to SearchApiViewsHandlerField::$additional_fields must be public (as in class views_handler_field) in /Users/xxx/Sites/vhosts/eRecruiter/profiles/recruiter/modules/search_api/contrib/search_api_views/includes/handler_field.inc on line 195

and:

I get the same sort of log message when I click on Job search, Resume search and my resume.

Here's a link to the online demo version: http://drupaljobs.epiqo.com/

I'm desperatly needing help with this as I have spent hours search forums and blogs.. got me nowhere :(
Any help will be much appreciated.

C


texts: How to display a Flag in a tpl file for different View modes?

texts:
There is no field in manage display of content type to display Flag link.
There is a tpl file (node--article--teaser.tpl.php) for teaser mode displaying bookmark

<?php if (isset($content['links']['flag'])) : ?>
    <?php echo render($content['links']['flag']);?>
<?php endif; ?>

But for another mode this having View mode teaser_2_col and tpl file name node--teaser-2-col.tpl.php, $content['links'] does not have a Flag element.


texts: Filter nodes by paragraph user reference

texts:
Say you have a content type Exercise which has a Related Users paragraph field. In turn, Related Users has a user reference field:

(content type) exercise --> (paragraph) related_users --> (user) user

I want to filter all Exercises with a certain related user:

/api/node/exercise?filter[field_related_users.field_user.name]=some_user

But it returns empty data: "data": [],. Same if tried with user id.

I'm sending a request with admin user, so there are no permission issues. Also, I did a similar filtering on a referenced content type (with a user reference) and it does return data.

I couldn't find anything related to this in JSON:API open issues. Does filtering by paragraph reference work differently? Or maybe there are limitations on this?


texts: Struggling to start a project from scratch

texts:
I am having 6 months of experience in drupal 6. I can able to handle bugs and any new functionality in the existing project.

But i can't able to move single step ahead in the new project. I know PHP very well and if i need to start a project from scratch in PHP i can do without any hesitation.

But i can't able to do with drupal :(

  What is the problem with me ?
  What should i need to do to start a project from scratch ?
  What are the things i need to improve ?

Any guidance will help me a lot..

Thanks in advance..


texts:
i need to set theme setting programmatically. I use mothership theme.
So for example:

$type = theme_get_setting('mothership_classes_view');
dpm($type);
//dpm displays 1 - so this setting is checked
//i need to uncheck it, set it to 0

i can't find a function to do this, what is the best way to set it?


texts: is there any module which gives domain list as content type field

texts:
we are using domain access. we need to add domain list as a field to one content type so based on that result we need to display the result on main domain itself. is there any field module for it?
Thanks.


texts: Page Categorisation and Multi-level Paths

texts:
I want to categorise my pages and see the category names in path.

For example: instead of http://localhost/a-funny-story, http://localhost/stories/funny/a-funny-story.

What is the best practice? I tried to do it with Pathauto module. I created a content type with a term reference of a category taxonomy.

I use this pattern [node:field_my_page_category]/[node:title] in "CONTENT PATHS". But this doesn't work for multi-level categories. I tried to use "join" [node:field_my_page_categories:parents:join:/]/[node:title]  as mentioned here.

But I get this error: The Pattern for all Sayfa paths is using the following invalid tokens: [node:field_my_page_category:parents:join:/].


texts: Problems with composer manager on windows

texts:
I'm trying to use the dev version of openlayers which requires composer mananger. I can successfully install the module, and the module creates a json file with my packages inside my sites/default/files/composer folder. The problem I have is that the drush composer install command isn't recognized by drush. I get the drush error

The drush command 'composer install' could not be found.  Run `drush
cache-clear drush` to clear the commandfile cache if you have
installed new extensions.

not sure how to proceed from here.


texts: How can I set up the media file selector for an image with the image styles in the same row?


texts: ahah fields in custom form stopped working after migration

texts:
I migrated my drupal 6 website to a new machine. my custom form with ahah-fields are not working in the new server.

          OLD    =>  NEW
............................
ubuntu => 9.10   => 14.04
php    => 5.2.10 => 5.5.9
apache => 2.2.12 => 2.4.7
mysql  => 5.1.37 => 5.5.41
jquery => 1.2.6  => 1.2.6

I tried updating below modules (using drush):

ahah_helper   =>  6.x-2.1  => 6.x-2.2
jquery_update =>  6.x-1.1  => 6.x-2.0-alpha1
jquery_update module updated:
      JQUERY => 1.2.6 => 1.3.2
      jquery.form.js  =>  2.01  => 2.43
      ahah.js  => to  =>  1.1.2.1

ahah fields are select fields; after selecting a value in the first(parent) fields, all the below fields dissappears..

Please help..

Thanks in advance..


texts:
I'm trying to figure out how I can limit the maximum length of an image title to 40.
I have enabled title from the image field in my content and it works fine except that it seems to take unlimited number of letters. I want to reduce the maximum length of image title to 40.
Does anyone have any idea how to do it?
Thanks


texts: Call a JS function when a views ajax request completes?

texts: I want to run some JS stuff on the exposed filters of a view which uses ajax. How can I know every time the view is reloaded by ajax, and run some JS?


texts: How to use Taxonomy Facets together with Apache Solr Multisite Search ?

texts:
This regards http://drupal.org/project/apachesolr_multisitesearch
I'm trying to enable Multisite Search Facets (based on Taxonomies) for a few sites. The 'normal' multisite facets such as 'filter by site', 'current search' etc appear fine but facets based on Taxonomies do not appear not matter what I do. The facets are enabled and the blocks added to regions, caches cleared etc.

Tested in Drupal Core 6.20 with the latest stable version of Apache Solr & Apache Solr Multisite Search

Has anyone else successfully enabled this functionality?

Any help greatly appreciated


texts: Is it possible to use Google to find Drupal with a specific version of Drupal?

texts:
Ideally it wouldn't be possible to use Google or another search engine to find many Drupal installations with e.g. Drupal core 7.31. But I'm not sure if it's not.

So I would like to know: is it in fact possible to find Drupal installations of a specific version?


texts:
How can I upgrade from Drupal 8.0.x to Drupal 8.1.x?

Do I have to copy the core files in the project folder and then run update.php as usual, or do I have to do something more complicated like when migrating from older versio


texts: How to add user picture to search result when using Search API

texts:
Am using the Search API and Search API Solr Search module on my site.

I have indexed users on my site and added the corresponding view to display the search result.

My question  is how do i add the user picture. This does not appear to be included in the views field by default.


texts: How do I send webform submission data to a google sheet?

texts:
I have implemented the webform module on my Drupal 8.4 site. I have some forms that I would like to submit the data to a google spreadsheet, instead of the drupal database.

Can someone help me get started with this?
Do I need to create a custom module to implement this functionality? What hooks do I need to use? Is there any documentation/tutorials out there on how to do this?


texts:
On the Login page, there are 3 tabs i.e. "Create new account", "Log in", and "Request new password". Are there modules out there that let us add more? If not, how can I achieve this manually?

Cheers


texts: How can I turn several Fields into a menu via a View?

texts:
I have 3 text Fields that I use for URLs, attached to a Panel Page. I'd like to create a menu with these URLs.

I've sort of done this with a View, by setting the Contextual Filters to use the node ID, then adding the Fields output and setting the Format to a pre-made Menu format I've used in the past. I've used Rewrite Results to make the  tag.

However, the issue is that all my fields are treated as a single menu item, not 3 individual ones.

Instead of the desired result being something like:

Link Name
Link Name
Link Name

The result I get is:

Link NameLink NameLink Name

Would anyone know how I can iterate through and Format each Field within a View?


texts: Changing permission on node access that linked with other nodes

texts:
I have a Jobs type content which include a user reference field

I have another content type called Applications which includes a node reference field that links to Jobs.

Register applicants can apply for Jobs via Applications, permissions have been set so only individual applicants can view their own applications and not anyone's else.

I want to set permissions so recruiters can only view applications to their own Job content type and not anyone's else. I can do this in views but if a recruiter knows another recruiters Application url (i.e /application/4) then the recruiter can view that application as well, in this example change the url to /application/5.


texts: drupal_add_js cannot find my javascript file

texts:
I am trying to add a simple footer.js to my page.  I created a new block and put it in the footer.  I then use PHP snippet in the body of the block with the PHP code:

<?php
drupal_add_js('footer.js');
?>

When viewing the source code, footer.js is there but when I click on it, it is a 404 error (not found).  The footer.js is located under: /var/www/drupal/sites/www.example.com/footer.js. Then I tried:

<?php
drupal_add_js('footer.js', array('type' => 'file', 'scope' => 'footer'));
?>

I don't think that is working, either.  I think the issue is with the path.  Any ideas, or do I have to write a custom module?


texts: Passing the actual path in File Save Data

texts:
I have the following line in my script, but it fails to save the file in site/default/files folder. Is it possible I can replace public://feedproducts.xml with an actual absolute path to the files directory?

$file = file_save_data($sxe->asXML(),"public://feedproducts.xml",FILE_EXISTS_REPLACE);

This script runs from the command line, and is inside a sub-directory inside the root. It also loads Drupal Bootstrap.


texts: how to make a field disabled, greyed out

texts: I found the hide() function to make a form field hidden. Is there a similar function for making a field disabled or greyed out? I want it to display but not allow it to be edited.


texts: How to set root term in Hirerchical select

texts:
I have a vocabulary like the following:

Parent 1
  Child 1
  Child 2

Parent 2
  Child 3
  Child 4

I want the dropdown only to show Parent 2 and its childs, so I changed the root_term id to parent id

'root_term' => termid, // Enter a term ID here if you want to display only terms below the term with that ID.

function mymodule_alter_form_alter(&$form, &$form_state, $form_id) {

if($form_id == 'myform_node_form')
{
  $form['field_myfield']['und']['#config']['params']['root_term']= termid;
}

Please let me know how to achieve this ??


texts:
In my custom module, I would like to acquire lock on a particular function which will allow only one process to execute that piece of code at a time and then allow other process and so on. So that the code does not run in parallel.

Is it possible ?


texts: Multiple independent Views attachment pagers (load more)

texts: I have a view with two attachments. I want to have a load more button to load items for each attachment and the main view separately, I have the load more module, but it loads more items for all the views, not for each attachment separately. Any help will be appreciated.


texts:
I have external site that needs to POST my drupal site (it basically shares data). I need to take the POST data parse it and create a node from it. Is this possible? I have created a PHP file take_post.php this file receives the POST request, parses it creates a node object and then sends it to http://api/v1/node this works fine, though it seems a little long winded?

My problem is that if a post is deleted from the external system a DELETE request is send via HTTP, however the external system has no idea of what the node ID is, and at the point of delete niether do. Is there a way to delete a node without knowing it's NID, maybe via a custom field value?


texts: 8 - How to open node preview in a new tab

texts: I'm trying to get the preview button to always open in a new tab. Are there any "clean" or "correct" ways of doing this? Currently I feel like I would need to hack core to achieve the job.


texts: List of favorite articles based on number of visitors

texts:
I am working at a magazine type web project. I would like if someone would suggest me a way to display in a block the list of favorite articles based on numbers of visitors.

I assume views can do that but I need a counter for visitors who access the articles.

Thank you. Any idea is welcomed.


texts: Menu on mobile phone - How to directly show second level of menu?

texts:
Following configuration: Drupal 7, tb corpal theme, superfish menu

For mobile phones I get a menu as shown in the image. If I press the menu icon (1, red on image) I get first the "Main menu" level (2, red on image). After pressing "Main menu" the menu expands and one gets to the desired next level.

What do I have to change to get directly to the "second level" after "Main menu" level?


texts:
This is an index (of module services) I created a resource that index books on a home page of a mobile app( this is not the most important in my question) I want to get books that have same tid (from table taxonomy) and put them on an array ($livres) at this time when I return $livres it's ok, books are grouped well and no duplications, but after putting them on array $livres, i want to put the $livres on the array $sections, sections contain the "header" that is the name of the section, and the array $livres of every section : the result i want is : [ { 'section' : 'A', 'livres':[{'id_book' : '1','title':'great book'},{'id_book' : '2','title':'great book too'}]},{'section':'B','livres':[{...ect

function my_module_home_index(){
$sections = array();
$livres = array();

$home_livre = db_query("SELECT tax.name as section,field_categorie_tid as tid,field_title_value as titre ,field_prix_value as prix ,t.entity_id FROM {field_data_field_title} as t
    join {field_data_field_prix} as pr on pr.entity_id = t.entity_id
    join {field_data_field_categorie} as cat on cat.entity_id = t.entity_id
    left join {taxonomy_term_data} as tax on tax.tid = cat.field_categorie_tid
    ")->fetchAll();

foreach($home_livre as $book){
    if(!isset($livres[$book-> tid]))
    $livres[$book-> tid] = array();

    $livres[$book->tid][]= array(
        'id_livre'=>$book-> entity_id,
        'titre' => $book-> titre,
        'prix'=> $book-> prix
    );
    $sections[]= array(
        'categorie'=> $book-> section
        'livre'=> $livres[$book->tid]
    );
}
return $sections;
  }

This is a part of what postman returns :

{
"categorie": "A",
"livre": [
  {
    "id_livre": "109",
    "titre": "F",
    "prix": "4"
  }
]
  },
{
  "categorie": "A",
  "livre": [
    {
     "id_livre": "109",
    "titre": "F",
    "prix": "4"
  },
  {
    "id_livre": "110",
    "titre": "G",
    "prix": "43"
  }
 ]
},
{

"categorie": "A",
"livre": [
  {
    "id_livre": "109",
    "titre": "F",
    "prix": "4"
  },
  {
    "id_livre": "110",
    "titre": "G",
    "prix": "43"
  },
  {
    "id_livre": "111",
    "titre": "H",
    "prix": "6"
  }
  ]
 },

As you can see; Book number 109 appears every iteration of foreach, how to avoid that ?

This is what return $livres shows (just a part, whent tid : 41, array is grouping all books with this tid so it's ok):

"41": [
{
  "id_livre": "109",
  "titre": "F",
  "prix": "4"
},
{
  "id_livre": "110",
  "titre": "G",
  "prix": "43"
},
{
  "id_livre": "111",
  "titre": "H",
  "prix": "6"
},
{
  "id_livre": "115",
  "titre": "L",
  "prix": "4"
},
{
  "id_livre": "118",
  "titre": "O",
  "prix": "5"
}
  ]
  }

Thank you

EDIT : this is the result postman returns when i "range" the query with 0,5 : i want 5 books (livres) in every sections, did anyone knows how to range the first array (not the second one that contains livres)

"response": [
{
  "section": "roman policier",
  "id_section": "31",
  "livres": [
    {
      "couverture": "http://localhost/drupal/sites/default/files/Etude_en_rouge.jpg",
      "id_livre": "113",
      "titre": "Une étude en rouge",
      "auteur": "Arthur Conan Doyle",
      "prix": "8",
      "categorie": "30",
      "section": "31"
    },
    {
      "couverture": "http://localhost/drupal/sites/default/files/fables.jpg",
      "id_livre": "119",
      "titre": "Fables",
      "auteur": "Jean de La Fontaine",
      "prix": "0",
      "categorie": "30",
      "section": "31"
    },
    {
      "couverture": "http://localhost/drupal/sites/default/files/couverture-livre_2.png",
      "id_livre": "120",
      "titre": "lire_latin",
      "auteur": "ecri_latin",
      "prix": "33",
      "categorie": "30",
      "section": "31"
    }
  ]
},
{
  "section": "roman drole",
  "id_section": "32",
  "livres": [
    {
      "couverture": "",
      "id_livre": "114",
      "titre": null,
      "auteur": null,
      "prix": "444",
      "categorie": "30",
      "section": "32"
    }
  ]
}


texts: Cannot change CSS after CSS/JS aggregation

texts: I'm using D7, recently I checked all the bandwidth optimization option in admin/config/development/performance, I wanted some change-back in CSS afterwards, which now I can't with the bandwidth optimization being checked. I tried unchecking that bandwidth optimization, then it accepts the new change. But when I check the bandwidth optimization again, it takes me to an older version of CSS, Please let me know how to update the CSS as well as checking all the optimized radio buttons.


texts: hook_commerce_checkout_complete is never called

texts:
I need to send out a PDF via mail upon order completion, and according to DrupalContrib, I can use hook_commerce_checkout($order) to achieve this.

this is my module code:

<?php

function pdf_checkout_commerce_checkout_complete($order) {
  // No example.
  \Drupal::logger('pdf_checkout')->info('Hook called.');
}

My problem is, that it is never called, I've tried everything from just sending a log message when it is used, to creating a new, clean, module just to test it.
None of it has worked.

Is the hook still being used in Commerce 2.x? If not, what should I look at instead to achieve a similar effect?

Thanks in advance.


texts: Block visibility using PHP to show Vocabulary and Terms not working

texts:
In Drupal 6 I used PHP for Block visibility on selected vocabularies and terms.

The same PHP code does not work in Drupal 7 on a Centos 7 computer. Does PHP 4.4. not work on a PHP 4.5 server? I am using the same examples found here:
https://www.drupal.org/comment/reply/69076#comment-form


texts: Is there a module that provides a drop-down select box on anode/add form to select a page template to be applied to a node?

texts:
Basically you have a bunch of different page templates in your theme directory.

page.tpl.php (default)
page-myTemplate1.tpl.php
page-myTempalte2.tpl.php

When you create a new node, I want a drop down list that lets you choose which template will be used to wrap around this node so that when the node is viewed, it uses the corresponding page template file. Does this module exist? :)


texts: Show if a user is online, idle, or offline on their account page?

texts:
I want to display the status of the user on the account page. I added the following code in the theme I am using. It works, but users are never displayed offline.
Why? What is wrong in the code?
user.html.twig

  {% if status == 'Online' %}
     Online
  {% elseif status == 'Absent' %}
     Absent
  {% else %}
     Offline
  {% endif %}

bootstrap_subtheme_front_office.theme
<?php
/**
 * @file
 * Bootstrap sub-theme.
 *
 * Place your custom PHP code in this file.
 */

use Drupal\Core\Database\Database;

/**
 * Implements hook_entity_presave().
 */
function bootstrap_subtheme_front_office_preprocess_user(&$variables) {
  // get user object
  $user = $variables['elements']['#user'];
  //- The user has logged in at least once
  if ($user->getLastLoginTime()) {
    if (account_is_logged_in_less_then_thirty_minutes($user->id())) {
      $status = 'Online';
    }
    else {
      $status = 'Absent';
    }
  }
  else {
    $status = 'Offline';
  }
  $variables['status'] = $status;
}

/**
 * @param $uid
 *
 * @return bool
 */
function account_is_logged_in_less_then_thirty_minutes($uid) {
  $connection = Database::getConnection();
  $query = $connection->select('sessions', 'sessions')
    ->fields('sessions', ['sid', 'uid', 'timestamp'])
    ->condition('sessions.uid', $uid, '=')
    //- chef if the user was online in 30 minutes (60 * 30)
    ->condition('sessions.timestamp', \Drupal::time()
        ->getRequestTime() - (60 * 30), '>')
    ->execute();
  //- Get result.
  $results = $query->fetchAll(\PDO::FETCH_OBJ);
  return (count($results) > 0) ? TRUE : FALSE;
}


texts: How can I get the path to an entity whether it's a user, term, node, etc? Of course, I can just figure out the type of the entity and then go through a switch for the proper URL, but that doesn't seem to be the best solution.


texts:
I want to have a form textfield automatically uppercase the text entered as it is typed in.  I was hoping that there was as set-able property that would allow for this but I’m unable to find one.

  $form['elementName'] = array(
            '#type' => 'textfield',
            '#title' => $this->t('Address'),...
  )

The searches I have done so far point to the use of  ‘Plugins.’  However if there is a simple(er) solution I prefer that.  Any ideas appreciated;


texts: How to implement per user caching when restricting display of comments by author

texts:
I have threaded comments on a site where there are two roles, reviewers and administrators.

Comments are shown in a view block added to the node (in this case a webform). The view format is set to 'content' and it's using tag based caching.

Admins are allowed to see all comments
Reviewers can write comments and only seen their own, or replies to them

This is all ok and I've implemented it with hook_ENTITY_TYPE_view_alter (simplified example below).

The problem is caching - the view for one reviewer is being cached and shown when the other logs on.

Scenario:

Alice and Bob are reviewers
Alice leaves a comment on a node. Logs out.
Bob logs on. If the cache hasn't been cleared in the meantime, he'll see Alice's comments even though he shouldn't. (And then, were I then to clear the cache, his view would be correct, but should he logged off and Alice logs back in, she'll now see the view intended for Bob.)

Can I give each user their own cache,  or failing that, not cache the view at all? (setting caching of the view block to 'none' doesn't appear to change anything, would be useful to know why in answer.)

function mymodule_comment_view_alter(
    &$build,
    Drupal\Core\Entity\EntityInterface $entity,
    \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display ) {

    // ... some logic that deals with admins (omitted)

    $comment_uid    = $entity->getOwnerId();
    $parent_comment = $entity->getParentComment();

    if ( $comment_uid === $current_user->id() ) {
        // current user's own comment? Show it
    } elseif ( isset( $parent_comment ) &&
               $parent_comment->getOwnerId() == $current_user->id() ) {
        // a comment in  reply to current user's comment? Show it
    } else {
        // otherwise, don't show it
        $build['#access'] = false;
    }

    return;
}


texts: Where to input hook_element_info_alter() to remove format description in date_popup form field?

texts:
I want to remove format description in date_popup form field (code posted here). The solution requires me to implement hook_element_info_alter() to add a process function to the element.

I found the code I was looking for, but being a novice, I don't know where to input it?

Could someone please guide me?

I have Drupal 7.53 with Date Module Version: 7.x-2.9 installed

Thanks


texts: When you click the Add tab in a view, you have many choices including Content pane and embed.  What are those?


texts: How to implement field formatters for entity properties

texts:
I created a custom entity using Entity API that has certain properties defined in hook_schema() and also declared in entityPropertyInfo(), a class extending EntityDefaultMetadataController.

So far so good.

Now I'd like for users to be able to customize if and how these properties get displayed when viewing the entities so I implemented hook_field_extra_fields() and declared them.

Then, in my Controller which extends EntityAPIController I added the properties to the $content array in buildContent() as, outlined here.

It actually works pretty well and properties are rendered and respect the order and visibility settings in "Manage Display".

However, I can't seem to figure out how to add settings in Manage Display to customize the label positioning (inline/above/hidden) and, more importantly, how to specify custom formatters for these properties.

Any clues?


texts: How to use views to display different information sources

texts:
On my home page I want to have a series of 'blocks'. Here is a graphic illustrating what I would like to achieve

The first two would be updated with the latest two blog post, the third would be the Facebook feed iframe, then the last three would be images promoting a different page on the site via a link.

I currently have each of these blocks prepared as separate views. Each of these are hard-coded into page.tpl with views_embed_view(). This isn't ideal as I want to be able to easily add and remove these boxes from within the Drupal admin.

How do I create a 'master view' to display on the front page that will hold these separate views?


texts:
I have 2 language and these situation:

main menu -> lang1 -> link to www.foo.com/
main menu -> lang2 -> link to www.foo.com/en

All sites when switch manually on browser the language, But my main menu link not work.

I have no space to place an other block with menu switcher on main menu bar.

I hope someone can send me in right direction because I spent 8 hour around these without solutions?


texts: Render a Views table row ID using a field as the ID value

texts:
I am trying to apply an ID to table rows in a view using a field as the ID value.

I've copied views-view-table.tpl.php template to my theme template folder and renamed it based on the view I am working with.

I'm using Commerce Kickstart2, and I would like to id the table rows in this view by the SKU of each product.

I added SKU as a field in my view and then render it as a class for the Views Row using replacement patterns for the row class of a table view. (See screen capture).

In my template this is the line that writes the row class:

<tr <?php if ($row_classes[$row_count]) { print 'class="' . implode(' ', $row_classes[$row_count]) .'"';  } ?>>

I would like to add to that the field SKU as a row ID: id="SKU Value Here".

I have tried a number of ways without success.

after running print_r($view->result); at the top of the template I get this:

Array ( [0] => stdClass Object ( [product_id] => 1 [commerce_product_sku] => sample1 [field_data_title_field_commerce_product_entity_type] => commerce_product [field_data_commerce_price_commerce_product_entity_type] => commerce_product [_field_data] => Array ( [product_id] => Array ( [entity_type] => commerce_product [entity] => stdClass Object ( [revision_id] => 1 [sku] => sample1 [title] => Product 1 [revision_uid] => 1 [status] => 1 [log] => [revision_timestamp] => 1423407240 [data] => [product_id] => 1 [type] => product [language] => und [uid] => 1 [created] => 1418869347 [changed] => 1423407240 [commerce_price] => Array ( [und] => Array ( [0] => Array ( [amount] => 1600 [currency_code] => USD [data] => Array ( [components] => Array ( ) ) ) ) ) [field_images] => Array ( [und] => Array ( [0] => Array ( [fid] => 1 [uid] => 1 [filename] => tote-1v1.jpg [uri] => public://tote-1v1.jpg [filemime] => image/jpeg [filesize] => 48075 [status] => 1 [timestamp] => 1418869347 [alt] => [title] => [width] => 860 [height] => 842 ) 1 => Array ( [fid] => 2 [uid] => 1 [filename] => tote-1v2.jpg [uri] => public://tote-1v2.jpg [filemime] => image/jpeg [filesize] => 52861 [status] => 1 [timestamp] => 1418869347 [alt] => [title] => [width] => 860 [height] => 1251 ) [2] => Array ( [fid] => 3 [uid] => 1 [filename] => tote-1v3.jpg [uri] => public://tote-1v3.jpg [filemime] => image/jpeg [filesize] => 96645 [status] => 1 [timestamp] => 1418869347 [alt] => [title] => [width] => 860 [height] => 1100 ) ) ) [title_field] => Array ( [und] => Array ( [0] => Array ( [value] => Product 1 [format] => [safe_value] => Product 1 ) ) ) [field_associated_product_diagram] => Array ( [und] => Array ( [0] => Array ( [tid] => 272 ) ) ) [title_original] => Product 1 ) ) ) [field_title_field] => Array ( [0] => Array ( [rendered] =>

If anyone can lend any insight into how to accomplish this, I would appreciate it.


texts: I recently moved a module from one location to another location and I am getting a ClassNotFoundException. Is there something similar to Registry Rebuild Module that can help rebuild the registry?


texts: if current_node is in menu, do something in theme.inc

texts:
I'm trying to check if the current node (of a specific content type) has been added to a menu (using the "Provide a menu link" in the node edit GUI).

if it has, I need to set a variable in .theme.inc, using THEME_preprocess_page.

I've been digging through drupal.org docs and found those two questions find Menu Settings of node, given URL alias (or node ID) and Get menu item of a node seem relevant but not quite right.


texts: Insert a Views Block into a node in Drupal 7

texts:
[Drupal 7]

I have a block I created in Views called "handy_tips-block_1".

Now I want to insert it into the body field of my node.

How do I do this?

I found a guide on here, which suggests to use the following code:

<?php
print $block = module_invoke('views', 'block_view', 'handy_tips-block_1');
print render($block['content']['#content']);
?>

However, all what is printed out are the words "Array".
(I have enabled the PHP input filter for the body field).

Note: in the posted code, I have also tried substituting 'views' with various items such as "block". I have used 'handy_tips-block_1' as the ID, because that is what is displayed on the configuration link of the block administration page.


texts: List all node titles to better iterate on a list of names

texts:
I have a content type called Country and I have to verify what countries already exists in db and save the missing ones, comparing to a variable with all countries ($country_list). I am having trouble accessing countries names of my nodes, that are specified as the content type title.
  $country_list = ['Mexico', 'Tanzania', 'Brazil', 'Camaron'];
  $nodes = node_load_multiple(array(), array('type' => 'country_profile'));
  $nodes_name = node_title_list($nodes);

  foreach ($country_list as $country_name) {
    if (!in_array($nodes_name, $nodes)) {
      // should create new node
    } else {
      // shouldn't do anything
    }
  }

The problem is, when i get the node_title_list() it doesn't return the 'raw title' (see output below)
Output:
    Array
(
    [#theme] => item_list__node
    [#items] => Array
        (
            [0] => Tanzania
            [1] => Mexico
        )

    [#title] => 1
)

How can i do that, so that the output of this list is
Array
        (
            [0] => "Tanzania"
            [1] => "Mexico"
        )


texts: Allowing third-party modules to alter the query executed by a module

texts:
I am developing a module that exposes a public API, which includes functions to save data in his own database table, which is supposed to be used from any module that uses my module.

The module checks the content of the database to verify if a user is not allowed to access the site, or if users should be notified with an error message when they change something in their user profiles.
Considering that in most of the cases, the database table is the only table to check, should I change the code to allow third-party modules to alter the query being executed from my module through hook_query_TAG_alter() (or the more generic hook_query_alter()), or use a custom hook that other modules need to implement?


texts:
I would to create a "navicon menu", like in this article.

It seems to be a standard for mobile and responsive sites.
Is there some module that do this?


texts:
I have a field on a node which has a default value set, I need to access the default value of that field. But, I don't want to load any nodes of that type and access the field definitions, nor do I want to manually write a db_query and fetch the value directly from the db, I know there is a proper way to do it I just don't know of it.

Drupal 8.6.x


texts: if title available print $title if disabled print somthing else

texts:
I use advanced forum but it uses default Drupal title method.

I know there is a module called Comment subjects for this purpose but I need to do it in this way.

I would be grateful if anyone could help me.

 if $title >avalible print $title
 if $title disabled print
<a href="#<?php echo $comment->cid; ?>"> Re: <?php print $node->title ?>

OR

 if > node print $node->title
 elseif comment $print
<a href="#<?php echo $comment->cid; ?>"> Re: <?php print $node->title ?>


texts: Pointing links within a view to correct page

texts:
Hi guys I am having an issue with trying to get the links contained within a View to point to the correct pages of my site.

The links can be seen here: Modules Page

Currently when the user selects a link they are taking to a page like this: (if you choose "Advanced Javascript" link)

Advanced Javascript

However I want them to be directed to this page: (Which is also another View)

Ajstest

I am at a loss as to how to achieve this. Any help would be greatly appreciated!


texts:
In a multisite installations where One site is as Master and has all the taxonomy terms defined. In second site i.e. Slave site, the content types are different but taxonomy terms are similar as of Master.

My quest is, how to get taxonomy terms from Master's database whenever taxonomy is called in Slave site, either be it content creation or Display.

The solution could be, db_set_active('Master') while any taxonomy term is called and change it to default db_set_active() after the taxonomy term is already displayed. But I am not sure where to place this.

Master has 4 taxonomy terms:

Bang
Dang
Chang
Nang

Slave has none, but while creating content in Slave there is a field type for Taxonomy reference, like:

Field Name: what is diyang?  (Taxonomy terms reference with 4 options in the select list) which should get the taxonomy term from Master.

Any hints or ideas?


texts: Adding dynamic filter in module_invoke()

texts:
I have created a node named "weekday," and one named "place" on Drupal 7. Next, I created a block view of the fields in "weekday" I wanted to show in the "place" node template.

I implemented it using the following code:

$weekday = module_invoke('views', 'block_view', 'weekday-block');
print render($weekday);

Now I would love to add a flexible filter that allows to load the block module with a extra filter of the different weekdays. Weekdays are a taxonomy term field in the node type "weekday".
The reason is that I would like to request the block by jquery in a link like http://www.example.com/place#Monday.


texts: How to limit edit permission to individual values on a multi value field?

texts: If I have an image field with multiple values, for example, how could I let users create edit and delete only their own images (i.e. that they upload and not anyone else)? I tried the field permissions module but it does not limit individual values of nodes.


texts:
I am managing a website that makes extensive use of panels. I had a "system" panel page with Title = 'Registration Template' and a path of 'registration/%registration'.

Somehow, in updating the features on the LIVE site, I managed to loose this panel page. It is not available on the LIVE site. I can recreate a feature with "registration_view_panel_context" this under Page Manager.

But when I move this feature to the live site, it does not become available to me as a panel. It is included in the feature, but the feature is overridden. I am unable to "revert" the feature.

Despite being labeled as a "system" page, the 'Registration Template' is not available to me.
As a "system" page, I do not have the option of exporting it from my local site.
And when I try to revert the feature on LIVE - nothing happens.
If I try to create a new panel page on LIVE with this path - "registration/%registration" I get a message "that path is already in use. This system cannot override existing paths."

This panel page is still available to me and works on my local site, but I can't figure out how to move it back onto the LIVE site.

Any ideas?

EDIT: Solved this problem myself (not myself, but with local help :-)
See below for answer.


texts: programatically find unpublished node count in drupal

texts:
I have a task to find how many node are unpublished in a particular content type. Have to use the count for some other purposes.

How can I do that?


texts: Taxonomy view page for double nested terms

texts:
I have a content type that has an entity reference to a taxonomy term. The referenced taxonomy term has furthermore taxonomy terms referenced to it.

On the taxonomy term view page, I would like the content appear, that refers to the terms nested inside first term reference.

The idea of double nested content and display on the taxonomy view page worked for me well, when I used for the first level nesting another content type instead of a taxonomy term. That way I could successfully apply following relationship and contextual filter on the view. I added a relationship to the entity reference field’s content and applied it to the contextual filter.

Now, wanting to use a taxonomy term as first level reference, I am not able to get it work. I thought the following should work, but it does not:

What relationship do I have to apply, to get the desired result?

(I hope I was able explain my problem comprehensibly)

Edit:

The schema is following:

NODE 1 > TERM 1 > TERM 3

NODE 2 > TERM 2 > TERM 3

TERM PAGE (taxonomy/term/3)
SHOW: NODE 1 + 2

The nodes have the reference field "field_key_data" that references
the vocabulary "architecture". The terms in the vocabulary
"architecture" have a term reference field "field_style" (TERM 1 or
TERM 2) of another vocabulary.
The term in "architecture" may be different, but can reference to the same value in "field_style" (TERM 3).
If this is the case, the TERM PAGE for term 3 should show as
result NODE 1 and NODE 2.
Futhermore the result should be displayed with depth.


texts: Adjusting Height of Panel Columns using CSS

texts:
I am using panel-2col-brick to make a 2 x 2 information block. The HTML structure of the page is as follows

Now i need to change height of the second occurrence of panel-col-first and panel col-second. I have tried

.panel-2col-bricks .center-wrapper .panel-col-first:first-of-type,
.panel-2col-bricks .center-wrapper .panel-col-last:first-of-type{
       height:80px;
       overflow:hidden;
}

However this changes  the height of both top-first and bottom-first columns. Is there any way i can adjust height of both rows separately ?


texts: Does using modules Metatags and Metatags Quick together cause SEO problems?

texts:
I am checking the SEO of my Drupal 7 site, where I installed the Metatag and the Metatag Quick modules.

Does using both the modules together on a site cause SEO problems?


texts: Get translated taxonomy terms with Entity Translation

texts:
I'm using Entity Translation for Taxonomy Terms.

I've a Cities Vocabulary and I need to get translated names of some 1600 cities.

Using taxonomy_get_tree without arguments returns the term names in English. However if I pass the last parameter $load_entities= TRUE then it currectly returns $term->name as translated one.

But it seems fully loading 1600 terms by setting $load_entities can slown down the site performance heavily as mentioned in the api page.

Is there any faster way to do it?

I'm thinking of caching the results in a temp file. Or can use some query as in When using Entity Translation and the Title module, how can I get the translated term from the term ID programmatically? to fetch it myself.


texts: How do I programmatically log in a user with a POST request?

texts:
Do anyone have a working REST Login on Drupal 8?
This is what I tried.
POST /user/login HTTP/1.1
Host: 8.d8.local
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: http://nikhilmohan.in
Cache-Control: no-cache

name=test&pass=password&form_id=user_login_form

It returns me HTML instead of JSON.


texts: View test result of BrowserTestBase based test?

texts:
How can I setup my Drupal config to be able to view the results of failed tests using the new BrowserTestBase class in 8.2.x?

I don't see any files generated and the phpunit.xml config does not seem to be getting respected:

<!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->
    <env name="BROWSERTEST_OUTPUT_DIRECTORY" value="/var/www/testing" />

The command I am using is:

vendor/bin/phpunit -c core/phpunit.xml --group tvi

I have some failing tests but I can't see what the test sees.


texts: How do I use the geoip_language_redirect module?

texts:
I am working on a multilingual website, and I have setup the multilingual concept successfully.
Now I want to redirect the users to the corresponding language URL based on the IP address or country. For example, if users are from france, I want to redirect them to http://www.example.com/fr like.

I found the geoip_language_redirect module, but I don't know how to use it.

Can anyone help me on this?


texts: Price formatter for range of variation products

texts:
Is there a way to write a price formatter to display the lowest and highest price of a collection of product variations? My reason for thinking it might not work is the scope of the product variation vs. it's "parent" product display.

If not, is there some way to build a view that will query to max ( and another for the min ) price of a collection of variations under one product display?

For Example:

I have a product display with 4 variations. Each variation has a different size lets say, and therefore each variation has a different price. I'm looking for a way for my product display to show the price of the cheapest variation and the highest priced variation as a range. As opposed to the first variation price that is shown now


texts: Create a Views Block to show all Node 'Attached Files' as a File list.

texts:
In creating the CMS structure, I've been trying to do this today, but seem to be getting no where.

I simply want to show all the files as link (PDF, Doc, Docx etc) that have been uploaded by a user to a node type listing which has a Field already created in the Content type structure (by me, the Admin/web) using Views. I've got as far as creating the View with the relevant fields and set it in the Panel Page as a block, but in testing nothing seems to show.

All I require is any relevant 'attached' files related to that Node Content (ie XYZ rock Band, attached mp3 files at bottom of page) so that future readers can click to download to local.

Can someone refresh my memory as how to do it so I can compare where I may be going wrong? I have set the author ID in Relationship, but still the files I have set do not show. Maybe I'm missing something here.


texts: Adding an img inline with the content only on a specific page

texts:
I have a certain page on my site that has the following menus at the top:

I would like to add a logo just before the textual menus on the far left of the screen.  This menu is in the main content of the page.  So far I have been able to get the logo to show up just above the content by adding the img to my page.tpl.php file but I really want it to show up on the same line as my menus.

I thought maybe I could do this by adding the img into a region.tpl.php file but that would make the image show up on every page's region and I only want it to show up on this page's region.  Is there a way to the image show up inline using a page.tpl.php file?


texts: How to use Drupal in the cloud with on demand instances

texts:
Services such as Rightscale do lots of things to help mange unpredictable traffic and bring more servers online when traffic spikes.

Is it possible to use Drupal with services such as this?

While Drupal can be set up for a number of configurations, is it possible to set it up so the configuration is flexible.

What do you need to do to make sure it works?

Assuming that you can bring on demand instances online, what do you need to do to make sure that Drupal will work in this situation. What do you have to do?

What is the optimal setup?

Once you have done what you have to do, what should you do to ensure that you can scale to more servers seamlessly. What is the best configuration in terms of number of servers. How many caching servers should you bring on line for each web server. Should you scale each tier independently?

edit

Edit to clarify that this is to do with the implications of on demand scaling for a Drupal site.


texts: Link it's node link to the node:body in views

texts: I can only link it to it's node when its a node:title field when making a certain view. how can I link it to the node:body? Is there are reference id?


texts: When can a contrib module considered to be stable?

texts:
Is there a clear definition of a module being stable in comparison with a release candidate? When can a stable version be released?

As an example, can't the Read only mode module considered stable?


texts: Programmatically download last module version

texts:
Is is possible to download the last version of a module during an hook_update_N() of my custom drupal 6 module?
I am in a case where the module I created needs the last version of CCK and I would like to programmatically download this version and enable it?
Or maybe  is it possible to add the plugin version in the .info dependencies array?


texts: how to get previous step values in next step in drupal multi step form?

texts:
How to get previous step values in drupal in the next step in a multiform. I want to display the values other than drupal_set_message(). I want to use these previous values in other function in the next step.

function form_example_wizard_previous_submit($form, &$form_state) {
  $current_step = &$form_state['step'];
  $form_state['step_information'][$current_step]['stored_values'] = $form_state['values'];
  if ($current_step > 1) {
    $current_step--;
    $form_state['values'] = $form_state['step_information'][$current_step]['stored_values'];
  }
  $form_state['rebuild'] = TRUE;
}

function form_example_wizard_next_submit($form, &$form_state) {

  $current_step = &$form_state['step'];

  $form_state['step_information'][$current_step]['stored_values'] = $form_state['values'];

  if ($current_step < count($form_state['step_information'])) {
    $current_step++;
    if (!empty($form_state['step_information'][$current_step]['stored_values'])) {
      $form_state['values'] = $form_state['step_information'][$current_step]['stored_values'];
    }
    else {
      $form_state['values'] = array();
    }

    // Force rebuild with next step.
    $form_state['rebuild'] = TRUE;
    return;
  }
}

function form_example_wizard_personal_info($form, &$form_state) {
   $form = array();
  $form['pagenumber']= array(
      '#title' =>t('Page Number'),
      '#type' => 'textfield',
      '#required' => TRUE
      );
  $form['wordscount']= array(
      '#title' =>t('Words count'),
      '#type' => 'textfield',
      '#required' => TRUE
      );
  $form['calcvalue'] = array('#type' => 'hidden',
  '#value'=>'test' );
  return $form;
}

function form_example_wizard_location_info($form, &$form_state) {
  $form = array();
  $form['quoteprice'] = array(
    '#type' => 'textfield',
    '#title' => t('Editing Your Document Will Cost'),
    '#value'=>$quoteval,
    '#required' => TRUE,
  );
  return $form;
}


texts: Render node fields in the views-view--[view_machine_name].html.twig

texts:
I have a view called customfeedview showing contents of a content type viz. customfeeds.
View Setting are given in the picture below:

I created views-view--customfeedview.html.twig to customize the view. Code of the file is given here under.

{{ fields.title.content }}

{{ fields.body.content }}

But {{ fields.body.content }} & {{ fields.title.content }} does not render title and body of the contents of type customfeed.

Please help me in this issue as I am totally a beginner in drupal 8. Thank you...

N.B.: Here I am using show-type content instead of fields as only show-type content only give read-more option in the view page. Using show-type fields {{ fields.body.content }} is working fine but whenever I changed it to content {{ fields.body.content }} is not rendering the values.


texts: How do I change the permalinks to #1, #2, #3?

texts:
I would like to change the comment/forum links to something like:

TOPIC:

#1

#2

#3

Do you have any idea on how should I do this?


texts: Sortable, paged table retrieved using EntityFieldQuery

texts: How do you create a tabular, sortable and paged display in a custom module using EntityFieldQuery?  I've been looking all over for a working example and can't find one.  The entity has custom CCK fields, and using db_select it looks like I have to write joins and I'd rather avoid doing that if EntityFieldQuery brings in all the fields.


texts: Can't clear cache as drupal_test.cache_filter doesn't exist

texts:
I run into an issue, I can't clear the cache anymore as I get this error:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 La table 'drupal_test.cache_filter' n'existe pas: TRUNCATE {cache_filter} ; Array ( ) in cache_clear_all() (line 168 of C:\wamp\www\drupal-7.41\includes\cache.inc).

I've read a few posts on stackoverflow with the same problem but different table and I wonder if I can try to apply the same solution (I don't know much sql so I'm not sure if I can just copy and paste from any solution as I don't want to make things worse). Some solutions seem to be dropping and recreating a table called cache_field, others cache_rules but I couldn't find anything for that specific table drupal_test.cache_filter. Do you reckon it's worth trying both of them, or does anybody have another solution? Last time I had this problem - I can't remember if it was the same table though - I ended up reinstalling the whole drupal, and I'd like to avoid this.


texts:
I have a reservation form with entityForm and i want to limit hours in date field.
like it begins 3:00 till 9:00 .
i've searched a lot and use Date Restrictions module but i couldn't do this .
Any idea would be appreciate it ?


texts: If "tag" is "event" - how to do condition with php

texts:
I need to do a condition on a tpl.php

Basically I have a content type with taxonomy "tags" - some are News, some are Events.

On the page.tlp I want to do the following condition:

if ($content['field_tags']=='Events'):

test

endif;

But this doesn't work.

Can you help me? Thanks.


texts: I'm wondering is it possible to have a bootstrap views tab and within that tab content(images) with bootstrap views grid layout, therefore each tab would have images in grid layout.


texts: I'm not quite sure how to explain this but here goes. I want to have a link to a view that displays a collection of categories i.e. t-shirts, jeans, socks, sunglasses etc. I then want to (for example) click on t-shirts and be prestented with a list of all links to items/nodes that are t-shirts. Is views able to do this 2 tier result?


texts: Different behavior of URL response and service response

texts:
I am trying to pass csrf_token or session token without an additional request.
I am able to get token using /session/token endpoint.
I am observing a different behavior here.
The response of routing service endpoint /session/token and \Drupal::service('csrf_token')->get() are different in Drupal 9.
Why the above mentioned methods give different values. The CsrfTokenController::csrfToken class method is hit by /session/token route.
How can I get /session/token in module?
Or
Which other service can give /session/token equal response making CSRF-TOKEN validation successful?


texts: How to create a node programmatically in Drupal 7?

texts:
I know you can create nodes programmatically by creating a node object and then firing node_save() but I don't actually want to store the node in the database.

Is there a way to create nodes of a specific content type in code that show up in the Find Content screens and work with views etc, but are not physically stored in the database.

The reason I ask is that I have a view that lists a series of nodes of a specific content type, but I want to create a custom node in that list that uses PHP to set the content dynamically but if I fire node_save() will it node get stored in the database every time the module is executed.

I'm also using node reference to link to these nodes so my programatic node will need to work with node reference too.


texts: Change OG Group River of News Per Group Basis?

texts:
Hello i was wondering the best way on how to go about this. I was thinking of creating a text field for my group content type and changing the url and then adding differant block views to urls like-

blog/*
forum/*
etc

Blog will show a blog view and a forum view on forum. I dont really want to mess about with my urls though.

I dont really want to have differant Group Content Types either.

What would be the best if i could have a text select list on the Group Content Type

blog
forum
etc

and the view will change depending on the choice.

Can anyone think of a way of doing this? I think i need to bring in some relatonship for my new text field but itdoesnt seem to be happening for me.

Thanks


texts: Difference between theme preprocessor & processor function?

texts:
The question is is self-explanatory!

Another question, suppose I have a template file named a-b--c--d.tpl.php

What would be the preprocessor function for this template file? I suppose themename_preprocess_a_b__c__d(&$vars)?

Sorry for my poor knowledge. I'm newbie to drupal & started with drupal 7.


texts:
I have Drupal 8.8.* and I would like to migrate to Drupal 9 using Drush 8. I know, we can use composer however I just wanted to confirm, whether we can do by using Drush command?

I tried using Drush but it's showing no updates available.

$ drush pm-update drupal-9.0.0
Update information last refreshed: Thu, 06/11/2020 - 11:42
 Name    Installed Version  Proposed version  Message
 Drupal  8.9.0              8.9.0             Specified version not found

No code updates available.


texts: How to diagnose an undefined index in a fresh install of Drupal 7?

texts:
Question:

How do I begin to explore what is causing this error? If this were reporting errors from a contrib module, I would submit a bug report on drupal.org. However, I'm not really sure where I should begin to submit an issue.

Set up:

I installed a Drupal 7 instance installed via Quick Drupal

drush qd -y d7-mysite
cd mysite/drupal
php -S localhost:8080

And immediately installed needed modules via drush en -y field_collection_tabs workbench workbench_moderation

Field Collection 7.x-1.0-beta11,
Field Collection Tabs 7.x-1.0-beta11,
Workbench 7.x-1.2, and
Workbench Moderation 7.x-1.4.

Then the errors:

After a modicum of configuration to get work bench going and adding a writer user, I begin to see these error messages:

  Notice: Undefined index: #contextual_links in
  contextual_pre_render_links() (line 140 of
  /drupal/modules/contextual/contextual.module).

  Warning: Invalid argument supplied for foreach() in contextual_pre_render_links() (line 140 of
  /drupal/modules/contextual/contextual.module).

  Notice: Undefined index: #contextual_links in contextual_pre_render_links() (line 140 of
  /drupal/modules/contextual/contextual.module).

  Warning: Invalid argument supplied for foreach() in contextual_pre_render_links() (line 140 of
  /drupal/modules/contextual/contextual.module).

  Notice: Undefined index: #contextual_links in contextual_pre_render_links() (line 140 of
  /drupal/modules/contextual/contextual.module).

  Warning: Invalid argument supplied for foreach() in contextual_pre_render_links() (line 140 of
  /drupal/modules/contextual/contextual.module).

Location:

This is coming from a function called contextual_pre_render_links($element)

Other Tidbits:

This only happens when the Authenticated User creates new node. Administrator can create a node with out an error message displaying.
I'm trying to implement a work-flow system using Workbench on an inherited site. I'm trying to understand this process so that I can teach others.


texts: Multisite with the same domain name for different versions

texts: Is it possible to have the same domain name using https with a Drupal 7 design and use http with the Drupal 6 design? If the answer is yes, how can I implement it?


texts: View with nodes but pull only one field from collection

texts: I have a node type of photo-gallery. Each node has a field collection which contains multiple photo fields and caption fields. I want to  create a view showing the 5 most recent photo-gallery nodes but I only want to display one photo field from each without the caption field. How would I do this? I can't seem to figure out how to get only one field from the field collection in the view.


texts: Unable to rebuild a form in submit handler

texts:
I don't have much experience in drupal development. So for the purpose of learning, i have made a custom module and trying to implement various functionalities in drupal 8 module development.
I want to rebuild a form on submission of the form. I took help from here and here and drupal.org's this node. How can i rebuild the form on clicking on the button 'Click Me'. It is not throwing any error but the form is not getting rebuild in the following piece of code :

function say_hello_submit(&$form, &$form_state) {

    $form_state->setRebuild();
  }
public function buildForm(array $form, FormStateInterface $form_state) {
    $config = $this->config('hugs.settings');

    $form['default_count'] = [
        '#type' => 'number',
        '#title' => $this->t('Default_hug_count'),
        '#default_value' => $config->get('default_count'),
    ];
    $form['mytable'] = [
        '#type' => 'table',
        '#header' => [t('Name'), t('Value')],
        '#rows' => array(),
    ];
    for ($i=1; $i<=2; $i++) {
        $form['mytable'][$i]['name'] = array(
            '#type' => 'textfield',
            '#size' => 40,
            '#maxlength' => 40,
            '#title' => t('Name'),
             '#title_display' => 'invisible',
     );

        $form['mytable'][$i]['value'] = array(
            '#type' => 'textfield',
            '#size' => 40,
            '#maxlength' => 40,
            '#title' => t('Value'),
            '#title_display' => 'invisible',
     );
    }
    $form['submit'] = array('#type' => 'submit', '#value' => 'Click Me');
    $form['#submit'][] = 'say_hello_submit' ;

    return parent::buildForm($form, $form_state);

}


texts: How to control path alias in custom node form #validate function?

texts:
To change form values in code, I understand that the right way is to add a validate function with hook_form_alter, to append the function's name to the #validate array then use form_set_value.

When I inspect the form array at this point though, I cannot see a way to reliably determine the parents of the path value.

e.g. I have

$form_state['groups']['additional_settings'][4]['alias']

And I can only assume that the 4 index is not always going to be 4; that it might be a different number if more modules are installed etc.

So how can I set the alias? (I also need to un-set pathauto's checkbox so it does not auto-generate a new path.) Am I doing it in the right place?

Thanks.


texts: How do I display all the nodes for multiple Organic Groups?

texts:
I have a block that I want to display a slideshow of all the logos in a Group based on the OG of the node I am viewing.

For example, I'm viewing a node that has a “Coffee” OG, and in the block I want see the logo that is also in “coffee” OG.

I works fine works I'm viewing a node that has only one group, but when I'm on a node that has multiple OGs, it only ever displays one logo. How can I get the view to recognize the node I'm viewing has multiple OGs and then display all the logos that also have that OG.

Right now, I'm showing the logo blog like this:

In 'Advanced':

Contextual filters:
(OG membership from node) OG membership: Group ID

Relationships
OG membership: OG membership from Node

In 'Filter criteria':

Content: Published (Yes)
Content: Type (= Logo Slideshow)
(OG membership from node) OG membership: Group_type (= Node)

Thanks


texts: How do I get theme suggestions for a custom block attached via an entity reference field?

texts:
I have created a custom block type with the machine name "score_card". I am displaying it on a node page via a paragraph with an entity reference field that references blocks. I would like to get a template suggestion for it along the lines of "block--block_content--score_card.html.twig".
I have template suggestions turned on and I do see suggestions in the HTML output for the paragraph, the reference field and the individual custom block type fields. There are no suggestions shown for blocks at all, not even block.html.twig. Attempting to just place 'block--block_content--score_card.html.twig' or 'block--score_card.html.twig' in my theme has no effect.
I also attempted to generate the theme suggestion using the suggested fix in this thread of adding hook_theme_suggestions_block_alter to no effect. Running this code through the debugger shows that the hook is not called for the block referenced via a field.
Using Drupal 8.9 latest how can I implement a custom theme for a custom block type referenced via a an entity reference field?